1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
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
basic.target
bluetooth.target
busnames.target
console-getty.service.m4.in
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
cryptsetup.target
debug-shell.service.in
dev-hugepages.mount
dev-mqueue.mount
emergency.service.in
emergency.target
exit.target
final.target
getty-pre.target
getty.target
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
halt-local.service.in
halt.target
hibernate.target
hybrid-sleep.target
initrd-cleanup.service.in
initrd-fs.target
initrd-parse-etc.service.in
initrd-root-device.target
initrd-root-fs.target
initrd-switch-root.service.in
initrd-switch-root.target
initrd-udevadm-cleanup-db.service.in
initrd.target
kexec.target
kmod-static-nodes.service.in
ldconfig.service
local-fs-pre.target
local-fs.target
machine.slice
machines.target
meson-add-wants.sh
meson.build
multi-user.target
network-online.target
network-pre.target
network.target
nss-lookup.target
nss-user-lookup.target
paths.target
poweroff.target
printer.target
proc-sys-fs-binfmt_misc.automount
proc-sys-fs-binfmt_misc.mount
quotaon.service.in
rc-local.service.in
reboot.target
remote-cryptsetup-pre.target
remote-cryptsetup.target
remote-fs-pre.target
remote-fs.target
rescue.service.in
rescue.target
rpcbind.target
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
sigpwr.target
sleep.target
slices.target
smartcard.target
sockets.target
sound.target
suspend.target
swap.target
sys-fs-fuse-connections.mount
sys-kernel-config.mount
sys-kernel-debug.mount
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
system-update-cleanup.service.in
system-update.target
system.slice
systemd-ask-password-console.path
systemd-ask-password-console.service.in
systemd-ask-password-wall.path
systemd-ask-password-wall.service.in
systemd-backlight@.service.in
systemd-binfmt.service.in
systemd-coredump.socket
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
systemd-firstboot.service.in
systemd-fsck-root.service.in
systemd-fsck@.service.in
systemd-halt.service.in
systemd-hibernate-resume@.service.in
systemd-hibernate.service.in
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
systemd-hybrid-sleep.service.in
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
systemd-initctl.socket
systemd-journal-catalog-update.service.in
systemd-journal-flush.service.in
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
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
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
systemd-journald-dev-log.socket
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
systemd-kexec.service.in
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
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
systemd-networkd-wait-online.service.in
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
systemd-nspawn@.service.in
systemd-poweroff.service.in
systemd-quotacheck.service.in
systemd-random-seed.service.in
systemd-reboot.service.in
systemd-remount-fs.service.in
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
systemd-rfkill.socket
systemd-suspend.service.in
systemd-sysctl.service.in
systemd-sysusers.service.in
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
systemd-tmpfiles-clean.timer
systemd-tmpfiles-setup-dev.service.in
systemd-tmpfiles-setup.service.in
systemd-udev-settle.service.in
systemd-udev-trigger.service.in
systemd-udevd-control.socket
systemd-udevd-kernel.socket
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
systemd-update-utmp-runlevel.service.in
systemd-update-utmp.service.in
systemd-user-sessions.service.in
systemd-vconsole-setup.service.in
systemd-volatile-root.service.in
time-sync.target
timers.target
tmp.mount
umount.target
user.slice
user@.service.in
var-lib-machines.mount