diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 837be51c40..d0d4d99b5e 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -216,9 +216,9 @@ out: return retcode; } -#define POWEROFF_CMD_PATH "/sbin/poweroff" -#define HALT_CMD_PATH "/sbin/halt" -#define REBOOT_CMD_PATH "/sbin/reboot" +#define POWEROFF_CMD_PATH "/run/current-system/profile/sbin/shutdown" +#define HALT_CMD_PATH "/run/current-system/profile/sbin/halt" +#define REBOOT_CMD_PATH "/run/current-system/profile/sbin/reboot" void qmp_guest_shutdown(const char *mode, Error **errp) { @@ -295,7 +295,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) int ret; Error *local_err = NULL; struct timeval tv; - const char *argv[] = {"/sbin/hwclock", has_time ? "-w" : "-s", NULL}; + const char *argv[] = {"/run/current-system/profile/sbin/hwclock", has_time ? "-w" : "-s", NULL}; /* If user has passed a time, validate and set it. */ if (has_time) { @@ -328,6 +328,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) * hardware clock (RTC). */ ga_run_command(argv, NULL, "set hardware clock to system time", &local_err); + if (local_err) { + argv[0] = "/sbin/hwclock"; + ga_run_command(argv, NULL, "set hardware clock to system time", + &local_err); + } if (local_err) { error_propagate(errp, local_err); return;