summaryrefslogtreecommitdiff
path: root/units
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2021-10-29 13:54:31 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2021-11-05 21:32:11 +0000
commitb4bf9007cbee7dc0b1356897344ae2a7890df84c (patch)
tree0d9094df26ce2de90348393456a6c972ba0968e5 /units
parent8389fd19d20370077f2d5601af0a089ec92ece05 (diff)
downloadsystemd-b4bf9007cbee7dc0b1356897344ae2a7890df84c.tar.gz
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.
Diffstat (limited to 'units')
-rw-r--r--units/console-getty.service.in4
-rw-r--r--units/container-getty@.service.in4
-rw-r--r--units/getty@.service.in4
-rw-r--r--units/serial-getty@.service.in4
4 files changed, 12 insertions, 4 deletions
diff --git a/units/console-getty.service.in b/units/console-getty.service.in
index bb67541dce..73871d6f50 100644
--- a/units/console-getty.service.in
+++ b/units/console-getty.service.in
@@ -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
diff --git a/units/container-getty@.service.in b/units/container-getty@.service.in
index ed1eb7bde1..a6e3f94e2a 100644
--- a/units/container-getty@.service.in
+++ b/units/container-getty@.service.in
@@ -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
diff --git a/units/getty@.service.in b/units/getty@.service.in
index 78deb7cffe..21d66f9367 100644
--- a/units/getty@.service.in
+++ b/units/getty@.service.in
@@ -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
diff --git a/units/serial-getty@.service.in b/units/serial-getty@.service.in
index bb7af3105d..2433124c55 100644
--- a/units/serial-getty@.service.in
+++ b/units/serial-getty@.service.in
@@ -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