diff --git a/man/systemd-getty-generator.xml b/man/systemd-getty-generator.xml index 8bff3bb7f4..3058444467 100644 --- a/man/systemd-getty-generator.xml +++ b/man/systemd-getty-generator.xml @@ -55,12 +55,14 @@ systemd-getty-generator is a generator that automatically instantiates - serial-getty@.service on the kernel console - /dev/console if that is not directed to the - virtual console subsystem. It will also instantiate + serial-getty@.service on the kernel + console(s), if they can function as ttys and are not provided by + the virtual console subsystem. It will also instantiate serial-getty@.service instances for virtualizer consoles, if execution in a virtualized environment is - detected. Finally, it will instantiate + detected. If execution in a container environment is detected, it + will instead enable console-getty.service for + /dev/console, and container-getty@.service instances for additional container pseudo TTYs as requested by the container manager (see systemd-getty-generator implements systemd.generator7. - Further information about configuration of gettys you may - find in + Further information about configuration of gettys can be + found in systemd for Administrators, Part XVI: Gettys on Serial Consoles (and Elsewhere). diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index b15c76b5b8..a143b5413b 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -201,16 +201,16 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + /* We assume that gettys on virtual terminals are + * started via manual configuration and do this magic + * only for non-VC terminals. */ + if (isempty(tty) || tty_is_vc(tty)) continue; if (verify_tty(tty) < 0) continue; - /* We assume that gettys on virtual terminals are - * started via manual configuration and do this magic - * only for non-VC terminals. */ - if (add_serial_getty(tty) < 0) return EXIT_FAILURE; } diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in index d9d0cba4d9..4b9165b70d 100644 --- a/units/console-getty.service.m4.in +++ b/units/console-getty.service.m4.in @@ -7,14 +7,16 @@ [Unit] Description=Console Getty -Documentation=man:agetty(8) +Documentation=man:agetty(8) man:systemd-getty-generator(8) After=systemd-user-sessions.service plymouth-quit-wait.service -ConditionPathExists=/dev/console m4_ifdef(`HAVE_SYSV_COMPAT', After=rc-local.service )m4_dnl Before=getty.target +# OCI containers may be run without a console +ConditionPathExists=/dev/console + [Service] # The '-o' option value tells agetty to replace 'login' arguments with an # option to preserve environment (-p), followed by '--' for safety, and then @@ -22,7 +24,6 @@ Before=getty.target ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud console 115200,38400,9600 $TERM Type=idle Restart=always -RestartSec=0 UtmpIdentifier=cons TTYPath=/dev/console TTYReset=yes diff --git a/units/container-getty@.service.m4.in b/units/container-getty@.service.m4.in index fd0be86ba7..005d9e5c24 100644 --- a/units/container-getty@.service.m4.in +++ b/units/container-getty@.service.m4.in @@ -7,7 +7,8 @@ [Unit] Description=Container Getty on /dev/pts/%I -Documentation=man:agetty(8) man:machinectl(1) +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=man:machinectl(1) After=systemd-user-sessions.service plymouth-quit-wait.service m4_ifdef(`HAVE_SYSV_COMPAT', After=rc-local.service @@ -16,6 +17,11 @@ Before=getty.target IgnoreOnIsolate=yes ConditionPathExists=/dev/pts/%I +# IgnoreOnIsolate is an issue: when someone isolates rescue.target, +# tradition expects that we shut down all but the main console. +Conflicts=rescue.service +Before=rescue.service + [Service] # The '-o' option value tells agetty to replace 'login' arguments with an # option to preserve environment (-p), followed by '--' for safety, and then