1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

getty: Pass tty to use by agetty via stdin

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.
This commit is contained in:
Daan De Meyer 2021-10-29 13:54:31 +01:00
parent 8389fd19d2
commit b4bf9007cb
4 changed files with 12 additions and 4 deletions

View File

@ -23,10 +23,12 @@ ConditionPathExists=/dev/console
# The '-o' option value tells agetty to replace 'login' arguments with an # The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then # option to preserve environment (-p), followed by '--' for safety, and then
# the entered username. # 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 Type=idle
Restart=always Restart=always
UtmpIdentifier=cons UtmpIdentifier=cons
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/console TTYPath=/dev/console
TTYReset=yes TTYReset=yes
TTYVHangup=yes TTYVHangup=yes

View File

@ -28,11 +28,13 @@ Before=rescue.service
# The '-o' option value tells agetty to replace 'login' arguments with an # The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then # option to preserve environment (-p), followed by '--' for safety, and then
# the entered username. # 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 Type=idle
Restart=always Restart=always
RestartSec=0 RestartSec=0
UtmpIdentifier=pts/%I UtmpIdentifier=pts/%I
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/pts/%I TTYPath=/dev/pts/%I
TTYReset=yes TTYReset=yes
TTYVHangup=yes TTYVHangup=yes

View File

@ -38,11 +38,13 @@ ConditionPathExists=/dev/tty0
# The '-o' option value tells agetty to replace 'login' arguments with an # The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then # option to preserve environment (-p), followed by '--' for safety, and then
# the entered username. # the entered username.
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM
Type=idle Type=idle
Restart=always Restart=always
RestartSec=0 RestartSec=0
UtmpIdentifier=%I UtmpIdentifier=%I
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/%I TTYPath=/dev/%I
TTYReset=yes TTYReset=yes
TTYVHangup=yes TTYVHangup=yes

View File

@ -33,10 +33,12 @@ Before=rescue.service
# The '-o' option value tells agetty to replace 'login' arguments with an # The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then # option to preserve environment (-p), followed by '--' for safety, and then
# the entered username. # 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 Type=idle
Restart=always Restart=always
UtmpIdentifier=%I UtmpIdentifier=%I
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/%I TTYPath=/dev/%I
TTYReset=yes TTYReset=yes
TTYVHangup=yes TTYVHangup=yes