Systemd/units
Alan Jenkins f1e24a259c units: don't kill the emergency shell when sysinit.target is triggered (#6765)
Why
---

The advantage of this is that starting sysinit.target from the emergency
shell will no longer kill the emergency shell and lock you out of the
system.  Our docs already claimed that emergency.target was useful for
"starting individual units in order to continue the boot process in steps".
This resolves #6509 for my purposes.

Remaining limitation
--------------------

Starting getty.target will still kill the shell, and if you don't have a
root password you will then be locked out at that point.  This is relevant
to distributions which patch the sulogin system to permit logins when the
root password is locked.  Both Debian and RedHat used to follow this
behaviour!  Debian have been discussing what they could replace it with at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806852

So this doesn't quite achieve perfection, but I think it's a worthwhile
change.  It should be easier to understand the logic now it doesn't have
such a big hole in it.  Repairing the sysinit stage of the boot is the main
reason we have emergency.target.  And as discussed in the issue,
sysinit.target gets pulled in implicitly as soon as any DefaultDependencies
service is activated.

How
---

sysinit.target only needs to conflict with emergency.target.  It didn't
need to conflict with emergency.service as well.  In theory the conflicts
are pointless, we could just change the dependency of sysinit.target on
local-fs.target from Wants to Requires.  However, doing so would mean that
when local-fs fails, the screen is flooded with yellow [DEPEND] failures.
That would hinder the poor unfortunate admin, so let's not do that.

There is no additional ordering requirement against emergency.  If the
failure happens, the job for sysinit will be cancelled instantly.  We don't
need to worry about when sysinit.target and its dependents would be
stopped, because sysinit waits for local-fs before it starts.

emergency.target is still necessarily stopped once we reach sysinit
(you can't express a one-way conflict in pure unit directives).
This is largely cosmetic... though perhaps it symbolizes that you're no
longer in Emergency Mode if System Initialization is successful ;-).

As a secondary advantage, the getty's which conflict on rescue.service now
need to conflict on emergency.service as well.  This makes the system more
uniform and simpler to understand.

The only other effect this should have is that
`systemctl start emergency.target` is now practically the same as
`systemctl start rescue.target`.  The only units this command will stop are
the conflicting getty units.  Neither of those commands should ever be
used.  E.g. they will not stop the gdm.service unit on Fedora 26.
2017-09-14 21:43:43 +02:00
..
user build-sys: drop gitignore patterns for in-tree builds 2017-07-18 10:05:06 -04:00
basic.target Merge pull request #2565 from poettering/fix-2315 2016-02-09 19:13:15 -05:00
bluetooth.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
busnames.target units: install busnames.target by default 2013-12-03 01:18:26 +01:00
console-getty.service.m4.in units: order container and console getty units after getty-pre.target 2017-09-05 14:53:25 +02:00
container-getty@.service.m4.in units: don't kill the emergency shell when sysinit.target is triggered (#6765) 2017-09-14 21:43:43 +02:00
cryptsetup-pre.target units: add remote-cryptsetup.target and remote-cryptsetup-pre.target 2017-09-05 12:06:30 +02:00
cryptsetup.target units: add remote-cryptsetup.target and remote-cryptsetup-pre.target 2017-09-05 12:06:30 +02:00
debug-shell.service.in units: properly unset the l10n environment variables where we need to 2017-09-14 15:17:40 +02:00
dev-hugepages.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
dev-mqueue.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
emergency.service.in sulogin-shell: switch from shell implementation to a C implementation (#6698) 2017-09-08 18:21:37 +02:00
emergency.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
exit.target containers: systemd exits with non-zero code 2015-09-21 17:32:45 +02:00
final.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
getty-pre.target units: introduce getty-pre.target (#6667) 2017-08-31 11:20:14 +02:00
getty.target unit: link up getty configuration from man page and unit files 2012-11-20 20:10:30 +01:00
getty@.service.m4 units: don't kill the emergency shell when sysinit.target is triggered (#6765) 2017-09-14 21:43:43 +02:00
graphical.target units: make graphical.target dependencies more complete and similar to those of multi-user.target 2014-12-29 17:00:05 +01:00
halt-local.service.in build-sys: make rc-local support part of SYSV compat 2013-01-04 23:26:20 +01:00
halt.target units: rename halt/hibernate/kexec/poweroff/reboot/suspend to systed-xxx 2012-06-25 14:28:50 +02:00
hibernate.target units: starting suspend.target should not fail when suspend is successful (#6678) 2017-08-30 18:20:23 +02:00
hybrid-sleep.target units: starting suspend.target should not fail when suspend is successful (#6678) 2017-08-30 18:20:23 +02:00
initrd-cleanup.service.in core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable 2013-11-26 02:26:31 +01:00
initrd-fs.target core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable 2013-11-26 02:26:31 +01:00
initrd-parse-etc.service.in initrd-parse-etc.service: ignore return code of daemon-reload 2014-09-03 13:28:31 +02:00
initrd-root-device.target Create initrd-root-device.target synchronization point (#3239) 2016-05-12 18:42:39 +02:00
initrd-root-fs.target core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable 2013-11-26 02:26:31 +01:00
initrd-switch-root.service.in units: drop KillMode= from initrd-switch-root.service 2017-01-31 01:34:40 -05:00
initrd-switch-root.target units: add Wants=initrd-cleanup.service to initrd-switch-root.target (#4345) 2016-10-11 14:36:14 +02:00
initrd-udevadm-cleanup-db.service.in Move udevadm to rootbindir 2013-03-11 07:18:33 +01:00
initrd.target Create initrd-root-device.target synchronization point (#3239) 2016-05-12 18:42:39 +02:00
kexec.target units: rename halt/hibernate/kexec/poweroff/reboot/suspend to systed-xxx 2012-06-25 14:28:50 +02:00
kmod-static-nodes.service.in kmod-static-nodes: don't run if module list is empty 2016-01-11 16:26:17 +01:00
ldconfig.service units: restore ConditionNeesUpdate=/etc in ldconfig.service (#3311) 2016-05-21 17:09:18 -04:00
local-fs-pre.target units: disallow manual starting of passive units 2013-03-26 15:15:39 +01:00
local-fs.target units: local-fs.target - don't pull in default dependencies 2014-06-29 16:20:33 +02:00
machine.slice logind: add infrastructure to keep track of machines, and move to slices 2013-06-20 03:49:59 +02:00
machines.target units: rework systemd-nspawn@.service unit 2014-12-29 17:00:05 +01:00
meson-add-wants.sh meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
meson.build units: add remote-cryptsetup.target and remote-cryptsetup-pre.target 2017-09-05 12:06:30 +02:00
multi-user.target units: drop [Install] section from multi-user.target and graphical.target 2014-01-17 20:27:35 +01:00
network-online.target units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
network-pre.target units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
network.target units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
nss-lookup.target units: disallow manual starting of passive units 2013-03-26 15:15:39 +01:00
nss-user-lookup.target units: disallow manual starting of passive units 2013-03-26 15:15:39 +01:00
paths.target units: introduce new timers.target and paths.target to hook timer/path units into for boot 2013-03-25 21:28:30 +01:00
poweroff.target units: restore job timeouts for poweroff and reboot 2014-11-06 08:17:45 -05:00
printer.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
proc-sys-fs-binfmt_misc.automount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
proc-sys-fs-binfmt_misc.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
quotaon.service.in units: move Before deps for quota services to remote-fs.target (#5627) 2017-03-30 11:21:18 +02:00
rc-local.service.in units: Add "GuessMainPID=no" to compatibility unit for rc-local (#3018) 2016-04-21 19:16:28 +02:00
reboot.target units: restore job timeouts for poweroff and reboot 2014-11-06 08:17:45 -05:00
remote-cryptsetup-pre.target units: add remote-cryptsetup.target and remote-cryptsetup-pre.target 2017-09-05 12:06:30 +02:00
remote-cryptsetup.target units: add remote-cryptsetup.target and remote-cryptsetup-pre.target 2017-09-05 12:06:30 +02:00
remote-fs-pre.target units: disallow manual starting of passive units 2013-03-26 15:15:39 +01:00
remote-fs.target filesystem targets: disable default dependencies 2013-09-11 14:40:58 +02:00
rescue.service.in sulogin-shell: switch from shell implementation to a C implementation (#6698) 2017-09-08 18:21:37 +02:00
rescue.target units: do not install rescue.target for alt-↑ 2017-08-31 16:17:41 +01:00
rpcbind.target units: disallow manual starting of passive units 2013-03-26 15:15:39 +01:00
serial-getty@.service.m4 units: don't kill the emergency shell when sysinit.target is triggered (#6765) 2017-09-14 21:43:43 +02:00
shutdown.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
sigpwr.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
sleep.target units: stop sleep.target when it has done its job 2012-06-25 12:01:09 +02:00
slices.target core: general cgroup rework 2013-06-27 04:17:34 +02:00
smartcard.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
sockets.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
sound.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
suspend.target units: starting suspend.target should not fail when suspend is successful (#6678) 2017-08-30 18:20:23 +02:00
swap.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
sys-fs-fuse-connections.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
sys-kernel-config.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
sys-kernel-debug.mount units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
sysinit.target units: don't kill the emergency shell when sysinit.target is triggered (#6765) 2017-09-14 21:43:43 +02:00
syslog.socket units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
system-update-cleanup.service.in units: add system-update-cleanup.service to guard against offline-update loops 2016-11-29 01:40:34 -05:00
system-update.target units: add system-update-cleanup.service to guard against offline-update loops 2016-11-29 01:40:34 -05:00
system.slice units: remove unnecessary Requires= and After= in system.slice (#6794) 2017-09-11 10:35:51 +02:00
systemd-ask-password-console.path systemd-ask-password: make sure directory watch is started before cryptsetup (#3850) 2016-08-02 08:55:25 -04:00
systemd-ask-password-console.service.in units: set SystemCallArchitectures=native on all our long-running services 2017-02-09 16:12:03 +01:00
systemd-ask-password-wall.path systemd-ask-password: make sure directory watch is started before cryptsetup (#3850) 2016-08-02 08:55:25 -04:00
systemd-ask-password-wall.service.in units: set SystemCallArchitectures=native on all our long-running services 2017-02-09 16:12:03 +01:00
systemd-backlight@.service.in unit: use StateDirectory= instead of RequiresMountsFor= 2017-08-31 18:37:11 +09:00
systemd-binfmt.service.in units: specify timeouts for more oneshot services 2015-04-28 08:52:17 -04:00
systemd-coredump.socket coredump: rework coredumping logic 2016-02-10 16:08:32 +01:00
systemd-coredump@.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-exit.service.in containers: systemd exits with non-zero code 2015-09-21 17:32:45 +02:00
systemd-firstboot.service.in units: run firstboot before sysusers, so that firstboot can initialize the root password 2014-10-23 01:24:59 +02:00
systemd-fsck-root.service.in fsck: remove fsckd again, but keep the door open for external replacement 2015-04-28 17:30:00 +02:00
systemd-fsck@.service.in units: make sure that fsck is executed before quotacheck 2016-05-10 14:10:17 +02:00
systemd-halt.service.in man: document systemd-halt.service and friends 2012-06-26 17:50:29 +02:00
systemd-hibernate-resume@.service.in systemd-hibernate-resume@.service: remove unnecessary ordering 2014-10-09 23:53:15 -04:00
systemd-hibernate.service.in man: document systemd-suspend.service 2012-06-26 17:33:11 +02:00
systemd-hostnamed.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-hwdb-update.service.in Revert "hwdb: actually search /run/udev/hwdb.d" 2015-06-09 11:26:06 +02:00
systemd-hybrid-sleep.service.in logind: support for hybrid sleep (i.e. suspend+hibernate at the same time) 2012-10-28 00:50:35 +02:00
systemd-importd.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-initctl.service.in units: set SystemCallArchitectures=native on all our long-running services 2017-02-09 16:12:03 +01:00
systemd-initctl.socket initctl: move /dev/initctl fifo into /run, replace it by symlink 2014-06-04 16:53:58 +02:00
systemd-journal-catalog-update.service.in units: fix condition for systemd-journal-catalog-update.service (#4990) 2016-12-29 10:38:52 +01:00
systemd-journal-flush.service.in units: so far we defaulted to 90s as default timeout for most things, let's do so for our oneshot services too 2015-02-02 21:34:32 +01:00
systemd-journal-gatewayd.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-journal-gatewayd.socket journal-remote: add documents in the unit files 2015-12-15 10:51:12 +09:00
systemd-journal-remote.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-journal-remote.socket journal-remote: add units and read certs from default locations 2014-07-15 22:23:49 -04:00
systemd-journal-upload.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-journald-audit.socket Revert "units: set ConditionVirtualization=!private-users on journald audit socket" (#6513) 2017-08-02 16:39:54 +02:00
systemd-journald-dev-log.socket journald: also increase the SendBuffer of /dev/log to 8M 2014-08-13 18:53:05 +02:00
systemd-journald.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-journald.socket journald: move /dev/log socket to /run 2014-06-04 16:53:58 +02:00
systemd-kexec.service.in man: document systemd-halt.service and friends 2012-06-26 17:50:29 +02:00
systemd-localed.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-logind.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-machine-id-commit.service.in machine-id-commit: merge machine-id-commit functionality into machine-id-setup 2015-09-29 21:55:51 +02:00
systemd-machined.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-modules-load.service.in units: specify timeouts for more oneshot services 2015-04-28 08:52:17 -04:00
systemd-networkd-wait-online.service.in units: use Requires in systemd-networkd-wait-online.service (#6065) 2017-07-03 17:05:20 +02:00
systemd-networkd.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-networkd.socket networkd: route - track routes 2015-10-30 12:32:48 +01:00
systemd-nspawn@.service.in units: include DM devices in DeviceAllow fpor systemd-nspawn@.service 2017-08-29 16:01:19 +02:00
systemd-poweroff.service.in man: document systemd-halt.service and friends 2012-06-26 17:50:29 +02:00
systemd-quotacheck.service.in units: move Before deps for quota services to remote-fs.target (#5627) 2017-03-30 11:21:18 +02:00
systemd-random-seed.service.in units: do not start load-random-seed in containers (#3941) 2016-08-13 17:15:19 +02:00
systemd-reboot.service.in man: document systemd-halt.service and friends 2012-06-26 17:50:29 +02:00
systemd-remount-fs.service.in units: use https for the freedesktop url (#6227) 2017-06-28 22:54:12 -04:00
systemd-resolved.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-rfkill.service.in unit: use StateDirectory= instead of RequiresMountsFor= 2017-08-31 18:37:11 +09:00
systemd-rfkill.socket rfkill: rework and make it listen on /dev/rfkill 2015-10-01 16:21:09 +02:00
systemd-suspend.service.in man: document systemd-suspend.service 2012-06-26 17:33:11 +02:00
systemd-sysctl.service.in sysctl: run sysctl service if /proc/sys/net is writable (#4425) 2016-10-20 19:36:28 +02:00
systemd-sysusers.service.in units: specify timeouts for more oneshot services 2015-04-28 08:52:17 -04:00
systemd-timedated.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-timesyncd.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-tmpfiles-clean.service.in readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
systemd-tmpfiles-clean.timer man: link systemd-tmpfiles-setup-dev.service 2013-04-23 12:55:44 +02:00
systemd-tmpfiles-setup-dev.service.in units: tmpfiles-setup-dev - allow unsafe file creation to happen in /dev at boot 2014-10-27 17:40:24 +01:00
systemd-tmpfiles-setup.service.in readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
systemd-udev-settle.service.in udev: replace CAP_MKNOD by writable /sys condition 2013-08-17 19:07:42 +02:00
systemd-udev-trigger.service.in units: order service(s) before udevd, not udev-trigger (coldplug) 2017-08-15 14:22:44 +01:00
systemd-udevd-control.socket units: remove udev control socket when systemd stops the socket unit (#4039) 2016-08-26 00:07:58 +02:00
systemd-udevd-kernel.socket units: make ReceiveBuffer= line more readable by using M suffix 2014-11-03 21:51:28 +01:00
systemd-udevd.service.in units: set LockPersonality= for all our long-running services (#6819) 2017-09-14 19:45:40 +02:00
systemd-update-done.service.in readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
systemd-update-utmp-runlevel.service.in utmp: turn systemd-update-utmp-shutdown.service into a normal runtime service 2013-05-16 00:19:03 +02:00
systemd-update-utmp.service.in readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
systemd-user-sessions.service.in units: order systemd-user-sessions.service after network.target 2016-04-22 16:17:00 +02:00
systemd-vconsole-setup.service.in units: restore Before dependencies for systemd-vconsole-setup.service 2017-01-31 01:34:40 -05:00
systemd-volatile-root.service.in fstab-generator: add support for volatile boots 2016-12-21 19:09:29 +01:00
time-sync.target units: time-sync.target probably makes sense, is not just sysv compat 2014-06-11 12:14:55 +02:00
timers.target unit: do not order timers.target before basic.target 2014-11-02 12:33:54 -05:00
tmp.mount units: do not perform m4 if not necessary (#6575) 2017-08-09 09:13:41 -04:00
umount.target units: introduce new Documentation= field and make use of it everywhere 2012-05-21 15:14:51 +02:00
user.slice logind: add infrastructure to keep track of machines, and move to slices 2013-06-20 03:49:59 +02:00
user@.service.in units: do not perform m4 if not necessary (#6575) 2017-08-09 09:13:41 -04:00
var-lib-machines.mount units: add missing unit file 2015-02-24 18:46:49 +01:00