systemd/0001-upstream-systemctl-halt-reboot-error-handling.patch

86 lines
2.5 KiB
Diff
Raw Normal View History

Accepting request 215598 from Base:System - Change patch 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch to skip already by the kernel managed devices - fix timeout stopping user@.service (bnc#841544) * 0001-core-introduce-new-KillMode-mixed-which-sends-SIGTER.patch * 0002-service-allow-KillMode-mixed-in-conjunction-with-PAM.patch * 0003-core-make-sure-to-always-go-through-both-SIGTERM-and.patch - Add patch 0001-upstream-systemctl-halt-reboot-error-handling.patch to be able to detect if the sysctl reboot() returns. - Add patch 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch A check for unmaintained disk like devices is added to be able to flush and maybe shut them down. Also the missing sync() system call is added for the direct halt/reboot systemctl command. Then the system halt is used as fallback if poweroff fails for both the direct poweroff systemctl command as well as for the systemd-shutdown utility. - Make systemd-mini build - Make requires bash-completion a recommends - Add patch 1017-skip-native-unit-handling-if-sysv-already-handled.patch to avoid that enabled boot scripts will be handled as unit files by systemctl status command (bnc#818044) - Drop patch 1017-enforce-sufficient-shutdown-warnings.patch as the original code behaves exactly as the shutdown code of the old SysVinit (bnc#750845) - Rename support-powerfail-with-powerstatus.patch to OBS-URL: https://build.opensuse.org/request/show/215598 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=173
2014-01-31 13:36:06 +01:00
--- systemd-208/src/core/shutdown.c
+++ systemd-208/src/core/shutdown.c 2014-01-27 11:31:38.486235816 +0000
@@ -329,6 +329,9 @@ int main(int argc, char *argv[]) {
reboot(cmd);
+ if (cmd == RB_POWER_OFF)
+ reboot(RB_HALT_SYSTEM);
+
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
--- systemd-208/src/systemctl/systemctl.c
+++ systemd-208/src/systemctl/systemctl.c 2014-01-27 11:05:18.298236035 +0000
@@ -138,7 +138,7 @@ static bool arg_plain = false;
static bool private_bus = false;
static int daemon_reload(DBusConnection *bus, char **args);
-static void halt_now(enum action a);
+static int halt_now(enum action a);
static void pager_open_if_enabled(void) {
@@ -2227,7 +2227,7 @@ static int start_special(DBusConnection
(a == ACTION_HALT ||
a == ACTION_POWEROFF ||
a == ACTION_REBOOT))
- halt_now(a);
+ return halt_now(a);
if (arg_force >= 1 &&
(a == ACTION_HALT ||
@@ -5973,7 +5973,7 @@ done:
return 0;
}
-static _noreturn_ void halt_now(enum action a) {
+static int halt_now(enum action a) {
/* Make sure C-A-D is handled by the kernel from this
* point on... */
@@ -5984,23 +5984,22 @@ static _noreturn_ void halt_now(enum act
case ACTION_HALT:
log_info("Halting.");
reboot(RB_HALT_SYSTEM);
- break;
+ return -errno;
case ACTION_POWEROFF:
log_info("Powering off.");
reboot(RB_POWER_OFF);
- break;
+ return -errno;
case ACTION_REBOOT:
log_info("Rebooting.");
reboot(RB_AUTOBOOT);
- break;
+ return -errno;
default:
- assert_not_reached("Unknown halt action.");
+ assert_not_reached("Unknown action.");
+ return -ENOSYS;
}
-
- assert_not_reached("Uh? This shouldn't happen.");
}
static int halt_main(DBusConnection *bus) {
@@ -6069,9 +6068,10 @@ static int halt_main(DBusConnection *bus
if (arg_dry)
return 0;
- halt_now(arg_action);
- /* We should never reach this. */
- return -ENOSYS;
+ r = halt_now(arg_action);
+ log_error("Failed to reboot: %s", strerror(-r));
+
+ return r;
}
static int runlevel_main(void) {