* [PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141:
@ 2026-08-08 10:34 Thomas Dreibholz
2026-08-10 9:33 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Dreibholz @ 2026-08-08 10:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Thomas Dreibholz, Michael Roth, Kostiantyn Kostiuk
Using the correct paths for "shutdown", "reboot", etc. under Solaris.
Signed-off-by: Thomas Dreibholz <dreibh@simula.no>
---
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
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;
---
base-commit: 3e3ccab106f879b1512f8e0d51a827dd4de30e22
change-id: 20260808-solaris-qga-fix-b4-d25104a17fb7
Best regards,
--
Thomas Dreibholz <dreibh@simula.no>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141:
2026-08-08 10:34 [PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141: Thomas Dreibholz
@ 2026-08-10 9:33 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2026-08-10 9:33 UTC (permalink / raw)
To: Thomas Dreibholz; +Cc: qemu-devel, Michael Roth, Kostiantyn Kostiuk
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 <dreibh@simula.no>
> ---
> 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 :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-10 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 10:34 [PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141: Thomas Dreibholz
2026-08-10 9:33 ` Daniel P. Berrangé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.