Re: [PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141:
Daniel P. Berrangé <[email protected]>
| Newsgroups | gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <[email protected]> |
Please use a $SUBJECT that describes what you're fixing "Fix shutdown command path not found on Solaris" On Sat, Aug 08, 2026 at 12:34:06PM +0200, Thomas Dreibholz wrote: > Using the correct paths for "shutdown", "reboot", etc. under Solaris. > > Signed-off-by: Thomas Dreibholz <[email protected]> > --- > This patch fixes the issue of the not-working shutdown command > in the QEMU Guest Agent under Solaris > (https://gitlab.com/qemu-project/qemu/-/work_items/4141) by > fixing the command paths from /sbin/ to /usr/sbin/ in the > Solaris build. > --- > qga/commands-posix.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index 837be51c40..e24248a0f3 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -216,9 +216,17 @@ out: > return retcode; > } > > +#ifdef CONFIG_SOLARIS > +#define POWEROFF_CMD_PATH "/usr/sbin/poweroff" > +#define SHUTDOWN_CMD_PATH "/usr/sbin/shutdown" > +#define HALT_CMD_PATH "/usr/sbin/halt" > +#define REBOOT_CMD_PATH "/usr/sbin/reboot" > +#else > #define POWEROFF_CMD_PATH "/sbin/poweroff" > -#define HALT_CMD_PATH "/sbin/halt" > -#define REBOOT_CMD_PATH "/sbin/reboot" > +#define SHUTDOWN_CMD_PATH "/sbin/shutdown" > +#define HALT_CMD_PATH "/sbin/halt" > +#define REBOOT_CMD_PATH "/sbin/reboot" > +#endif I wonder why we need to use a qualified path at all. We're passing these to ga_run_command and that uses execvp, which searches $PATH. qga runs as root and can be expected to have these in $PATH. > > void qmp_guest_shutdown(const char *mode, Error **errp) > { > @@ -262,7 +270,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp) > return; > } > > - const char *argv[] = {"/sbin/shutdown", > + const char *argv[] = {SHUTDOWN_CMD_PATH, > #ifdef CONFIG_SOLARIS > shutdown_flag, "-g0", "-y", > #elif defined(CONFIG_BSD) > @@ -274,7 +282,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp) > > /* > * If the specific command exists (poweroff, halt or reboot), use it instead > - * of /sbin/shutdown. > + * of SHUTDOWN_CMD_PATH. > */ > if (shutdown_cmd != NULL) { > argv[0] = shutdown_cmd; With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|