1
0
Fork 0
mirror of https://github.com/pikvm/pikvm.git synced 2026-03-02 18:16:56 -05:00

[docs] Switch PiKVM V2 serial console setup to use serial-getty@ttyGS0 instead of getty@ #1095

Open
opened 2026-02-20 14:11:01 -05:00 by deekerman · 1 comment
Owner

Originally created by @henryptung on GitHub (Dec 21, 2025).

Instead of getty@ttyGS0.service, which hangs and necessitates service overrides, serial-getty@ doesn't have the same problem.

Tested manually, systemctl enable serial-getty@ttyGS0.service works fine with no systemd overrides, and based on the thread, it seems made for serial consoles while getty@ is not.

Originally created by @henryptung on GitHub (Dec 21, 2025). Instead of `getty@ttyGS0.service`, which [hangs and necessitates service overrides](https://github.com/raspberrypi/linux/issues/1929#issuecomment-295896446), [`serial-getty@`](https://github.com/raspberrypi/linux/issues/1929#issuecomment-595715049) doesn't have the same problem. Tested manually, `systemctl enable serial-getty@ttyGS0.service` works fine with no systemd overrides, and based on the thread, it seems made for serial consoles while `getty@` is not.
Author
Owner

@mdevaev commented on GitHub (Jan 7, 2026):

Hello. So, you tested it with disconnected USB cable?

I've briefly viewed the systemd sources and it looks like it performs quite a lot of actions with the rest of the TTY* options.

I would probably prefer to switch to serial-getty and additionally use override to disable the reset options.

[root@pikvm ~]# d /usr/lib/systemd/system/getty\@.service /usr/lib/systemd/system/serial-getty\@.service
--- /usr/lib/systemd/system/getty@.service      2025-12-19 16:08:09.000000000 +0000
+++ /usr/lib/systemd/system/serial-getty@.service       2025-12-19 16:08:09.000000000 +0000
@@ -8,10 +8,11 @@
 #  (at your option) any later version.

 [Unit]
-Description=Getty on %I
+Description=Serial Getty on %I
 Documentation=man:agetty(8) man:systemd-getty-generator(8)
 Documentation=https://0pointer.de/blog/projects/serial-console.html
-After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
+BindsTo=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target

 # If additional gettys are spawned during boot then we should make
 # sure that this is synchronized before getty.target, even though
@@ -25,35 +26,23 @@
 Conflicts=rescue.service
 Before=rescue.service

-# On systems without virtual consoles, don't start any getty. Note
-# that serial gettys are covered by serial-getty@.service, not this
-# unit.
-ConditionPathExists=/dev/tty0
-
 [Service]
-ExecStart=-/usr/bin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM}
+ExecStart=-/usr/bin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM}
 Type=idle
 Restart=always
-RestartSec=0
 UtmpIdentifier=%I
 StandardInput=tty
 StandardOutput=tty
 TTYPath=/dev/%I
 TTYReset=yes
 TTYVHangup=yes
-TTYVTDisallocate=yes
 IgnoreSIGPIPE=no
 SendSIGHUP=yes
-ImportCredential=tty.virtual.%I.agetty.*:agetty.
-ImportCredential=tty.virtual.%I.login.*:login.
+ImportCredential=tty.serial.%I.agetty.*:agetty.
+ImportCredential=tty.serial.%I.login.*:login.
 ImportCredential=agetty.*
 ImportCredential=login.*
 ImportCredential=shell.*

-# Unset locale for the console getty since the console has problems
-# displaying some internationalized messages.
-UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
-
 [Install]
 WantedBy=getty.target
-DefaultInstance=tty1
@mdevaev commented on GitHub (Jan 7, 2026): Hello. So, you tested it with disconnected USB cable? I've briefly viewed the [systemd sources](https://github.com/systemd/systemd/blob/3ff23e8c4bad409f9df50cd225093fcf96716c5d/src/core/execute.c#L124) and it looks like it performs quite a lot of actions with the rest of the TTY* options. I would probably prefer to switch to serial-getty and additionally use override to disable the reset options. ```diff [root@pikvm ~]# d /usr/lib/systemd/system/getty\@.service /usr/lib/systemd/system/serial-getty\@.service --- /usr/lib/systemd/system/getty@.service 2025-12-19 16:08:09.000000000 +0000 +++ /usr/lib/systemd/system/serial-getty@.service 2025-12-19 16:08:09.000000000 +0000 @@ -8,10 +8,11 @@ # (at your option) any later version. [Unit] -Description=Getty on %I +Description=Serial Getty on %I Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=https://0pointer.de/blog/projects/serial-console.html -After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target +BindsTo=dev-%i.device +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target # If additional gettys are spawned during boot then we should make # sure that this is synchronized before getty.target, even though @@ -25,35 +26,23 @@ Conflicts=rescue.service Before=rescue.service -# On systems without virtual consoles, don't start any getty. Note -# that serial gettys are covered by serial-getty@.service, not this -# unit. -ConditionPathExists=/dev/tty0 - [Service] -ExecStart=-/usr/bin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM} +ExecStart=-/usr/bin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM} Type=idle Restart=always -RestartSec=0 UtmpIdentifier=%I StandardInput=tty StandardOutput=tty TTYPath=/dev/%I TTYReset=yes TTYVHangup=yes -TTYVTDisallocate=yes IgnoreSIGPIPE=no SendSIGHUP=yes -ImportCredential=tty.virtual.%I.agetty.*:agetty. -ImportCredential=tty.virtual.%I.login.*:login. +ImportCredential=tty.serial.%I.agetty.*:agetty. +ImportCredential=tty.serial.%I.login.*:login. ImportCredential=agetty.* ImportCredential=login.* ImportCredential=shell.* -# Unset locale for the console getty since the console has problems -# displaying some internationalized messages. -UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION - [Install] WantedBy=getty.target -DefaultInstance=tty1 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pikvm-pikvm#1095
No description provided.