diff --git a/man/systemctl.xml b/man/systemctl.xml index 83cc4eb560..0778c38ca4 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -295,7 +295,8 @@ transactions from replacing these jobs (or even being enqueued while the irreversible jobs are still pending). Irreversible jobs can still be cancelled using the cancel - command. + command. This job mode should be used on any transaction which + pulls in shutdown.target. isolate is only valid for start operations and causes all other units to be stopped when the diff --git a/man/systemd.xml b/man/systemd.xml index e8178ca4bb..b455b605cb 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -561,7 +561,8 @@ systemd user managers will start the exit.target unit when this signal is received. This is mostly equivalent to systemctl - --user start exit.target. + --user start exit.target + --job-mode=replace-irreversible. @@ -570,13 +571,13 @@ Upon receiving this signal the systemd system manager will start the ctrl-alt-del.target unit. This is mostly - equivalent to systemctl start - ctl-alt-del.target. If this signal is received more - than 7 times per 2s, an immediate reboot is triggered. - Note that pressing Ctrl-Alt-Del on the console will trigger - this signal. Hence, if a reboot is hanging, pressing - Ctrl-Alt-Del more than 7 times in 2s is a relatively safe way - to trigger an immediate reboot. + equivalent to systemctl start ctl-alt-del.target + --job-mode=replace-irreversible. If this signal is + received more than 7 times per 2s, an immediate reboot is + triggered. Note that pressing Ctrl-Alt-Del on the console + will trigger this signal. Hence, if a reboot is hanging, + pressing Ctrl-Alt-Del more than 7 times in 2s is a relatively + safe way to trigger an immediate reboot. systemd user managers treat this signal the same way as SIGTERM. @@ -634,7 +635,7 @@ Enters default mode, starts the default.target unit. This is mostly - equivalent to systemctl start + equivalent to systemctl isolate default.target. @@ -661,8 +662,9 @@ Halts the machine, starts the halt.target unit. This is mostly - equivalent to systemctl start - halt.target. + equivalent to systemctl start halt.target + --job-mode=replace-irreversible. + @@ -670,8 +672,9 @@ Powers off the machine, starts the poweroff.target unit. This is mostly - equivalent to systemctl start - poweroff.target. + equivalent to systemctl start poweroff.target + --job-mode=replace-irreversible. + @@ -679,8 +682,9 @@ Reboots the machine, starts the reboot.target unit. This is mostly - equivalent to systemctl start - reboot.target. + equivalent to systemctl start reboot.target + --job-mode=replace-irreversible. + @@ -688,8 +692,9 @@ Reboots the machine via kexec, starts the kexec.target unit. This is mostly - equivalent to systemctl start - kexec.target. + equivalent to systemctl start kexec.target + --job-mode=replace-irreversible. + diff --git a/src/core/manager.c b/src/core/manager.c index 1387341367..939d117ad1 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2093,7 +2093,8 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t if (MANAGER_IS_SYSTEM(m)) manager_handle_ctrl_alt_del(m); else - manager_start_target(m, SPECIAL_EXIT_TARGET, JOB_REPLACE); + manager_start_target(m, SPECIAL_EXIT_TARGET, + JOB_REPLACE_IRREVERSIBLY); break; case SIGWINCH: @@ -2161,14 +2162,17 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t default: { /* Starting SIGRTMIN+0 */ - static const char * const target_table[] = { - [0] = SPECIAL_DEFAULT_TARGET, - [1] = SPECIAL_RESCUE_TARGET, - [2] = SPECIAL_EMERGENCY_TARGET, - [3] = SPECIAL_HALT_TARGET, - [4] = SPECIAL_POWEROFF_TARGET, - [5] = SPECIAL_REBOOT_TARGET, - [6] = SPECIAL_KEXEC_TARGET + static const struct { + const char *target; + JobMode mode; + } target_table[] = { + [0] = { SPECIAL_DEFAULT_TARGET, JOB_ISOLATE }, + [1] = { SPECIAL_RESCUE_TARGET, JOB_ISOLATE }, + [2] = { SPECIAL_EMERGENCY_TARGET, JOB_ISOLATE }, + [3] = { SPECIAL_HALT_TARGET, JOB_REPLACE_IRREVERSIBLY }, + [4] = { SPECIAL_POWEROFF_TARGET, JOB_REPLACE_IRREVERSIBLY }, + [5] = { SPECIAL_REBOOT_TARGET, JOB_REPLACE_IRREVERSIBLY }, + [6] = { SPECIAL_KEXEC_TARGET, JOB_REPLACE_IRREVERSIBLY } }; /* Starting SIGRTMIN+13, so that target halt and system halt are 10 apart */ @@ -2182,8 +2186,8 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t if ((int) sfsi.ssi_signo >= SIGRTMIN+0 && (int) sfsi.ssi_signo < SIGRTMIN+(int) ELEMENTSOF(target_table)) { int idx = (int) sfsi.ssi_signo - SIGRTMIN; - manager_start_target(m, target_table[idx], - (idx == 1 || idx == 2) ? JOB_ISOLATE : JOB_REPLACE); + manager_start_target(m, target_table[idx].target, + target_table[idx].mode); break; }