]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
getty: Pass tty to use by agetty via stdin
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 29 Oct 2021 12:54:31 +0000 (13:54 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 5 Nov 2021 21:32:11 +0000 (21:32 +0000)
If the tty arg is set to "-", agetty uses the stdin fd as the tty.
Let's pass the tty this way so that we keep an fd open to the tty
at all times. If all fd's to a tty are closed, the kernel might
reset the tty which we want to avoid.

units/console-getty.service.in
units/container-getty@.service.in
units/getty@.service.in
units/serial-getty@.service.in

index bb67541dceb1e3b42678e7e19f45629cb1a1b757..73871d6f50a8115c5653e49aab7eeb1d877e0f6a 100644 (file)
@@ -23,10 +23,12 @@ ConditionPathExists=/dev/console
 # 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' --noclear --keep-baud console 115200,38400,9600 $TERM
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud - 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 UtmpIdentifier=cons
+StandardInput=tty
+StandardOutput=tty
 TTYPath=/dev/console
 TTYReset=yes
 TTYVHangup=yes
index ed1eb7bde103daf8daa47321343699d7f9ba3c07..a6e3f94e2a5c21a39409f07f989201586ed0545e 100644 (file)
@@ -28,11 +28,13 @@ Before=rescue.service
 # 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' --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud - 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 RestartSec=0
 UtmpIdentifier=pts/%I
+StandardInput=tty
+StandardOutput=tty
 TTYPath=/dev/pts/%I
 TTYReset=yes
 TTYVHangup=yes
index 78deb7cffed11a54178173fc77d88adfb9d8ae0b..21d66f9367d7e163127fc75ba22faa057979cbc2 100644 (file)
@@ -38,11 +38,13 @@ ConditionPathExists=/dev/tty0
 # 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' --noclear %I $TERM
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM
 Type=idle
 Restart=always
 RestartSec=0
 UtmpIdentifier=%I
+StandardInput=tty
+StandardOutput=tty
 TTYPath=/dev/%I
 TTYReset=yes
 TTYVHangup=yes
index bb7af3105d05e4fe337d9299a69cef8b354ff7b4..2433124c55b98733fbaf1a71d514a644e36133aa 100644 (file)
@@ -33,10 +33,12 @@ Before=rescue.service
 # 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,57600,38400,9600 %I $TERM
+ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 - $TERM
 Type=idle
 Restart=always
 UtmpIdentifier=%I
+StandardInput=tty
+StandardOutput=tty
 TTYPath=/dev/%I
 TTYReset=yes
 TTYVHangup=yes