2010-08-25 09:09:57 +08:00
|
|
|
# This file is part of systemd.
|
|
|
|
#
|
|
|
|
# systemd is free software; you can redistribute it and/or modify it
|
2012-04-12 06:20:58 +08:00
|
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
2010-08-25 09:09:57 +08:00
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
[Unit]
|
|
|
|
Description=Serial Getty on %I
|
2012-06-27 21:12:29 +08:00
|
|
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
2012-11-21 03:09:38 +08:00
|
|
|
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
2012-07-14 05:34:40 +08:00
|
|
|
BindsTo=dev-%i.device
|
2017-08-31 17:20:14 +08:00
|
|
|
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
2013-01-05 05:36:48 +08:00
|
|
|
m4_ifdef(`HAVE_SYSV_COMPAT',
|
2011-10-29 01:16:33 +08:00
|
|
|
After=rc-local.service
|
|
|
|
)m4_dnl
|
2010-08-25 09:09:57 +08:00
|
|
|
|
2010-10-09 00:22:44 +08:00
|
|
|
# If additional gettys are spawned during boot then we should make
|
|
|
|
# sure that this is synchronized before getty.target, even though
|
|
|
|
# getty.target didn't actually pull it in.
|
2010-08-25 09:09:57 +08:00
|
|
|
Before=getty.target
|
2012-04-12 03:58:33 +08:00
|
|
|
IgnoreOnIsolate=yes
|
2010-08-25 09:09:57 +08:00
|
|
|
|
2017-03-30 16:39:16 +08:00
|
|
|
# IgnoreOnIsolate causes issues with sulogin, if someone isolates
|
|
|
|
# rescue.target or starts rescue.service from multi-user.target or
|
|
|
|
# graphical.target.
|
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-15 03:43:43 +08:00
|
|
|
Conflicts=rescue.service emergency.service
|
|
|
|
Before=rescue.service emergency.service
|
2017-03-30 16:39:16 +08:00
|
|
|
|
2010-08-25 09:09:57 +08:00
|
|
|
[Service]
|
2017-05-24 19:58:01 +08:00
|
|
|
# The '-o' option value tells agetty to replace 'login' arguments with an
|
|
|
|
# option to preserve environment (-p), followed by '--' for safety, and then
|
|
|
|
# the entered username.
|
|
|
|
ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
|
2012-04-24 20:28:00 +08:00
|
|
|
Type=idle
|
2010-10-06 02:30:44 +08:00
|
|
|
Restart=always
|
2010-10-09 00:22:44 +08:00
|
|
|
UtmpIdentifier=%I
|
2011-05-18 07:07:31 +08:00
|
|
|
TTYPath=/dev/%I
|
|
|
|
TTYReset=yes
|
|
|
|
TTYVHangup=yes
|
2011-03-30 05:31:38 +08:00
|
|
|
KillMode=process
|
2012-02-09 10:18:04 +08:00
|
|
|
IgnoreSIGPIPE=no
|
2013-07-30 07:54:59 +08:00
|
|
|
SendSIGHUP=yes
|
2014-02-24 21:02:28 +08:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=getty.target
|