[PATCH] systemd-serialgetty: disable on genericarm64

Mikko Rapeli <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <[email protected]>
Upstream systemd setup with udev starts agetty on detected
tty's so there is no need to use the build time SERIAL_CONSOLES
variable.

Trying to start agetty on non-existing tty's from SERIAL_CONSOLES
more than doubles the boot time to systemd "running" or "degraded"
state. Boot time before this change (core-image-base with systemd-analyze,
qemu, aarch64 build host):

root@genericarm64:~# systemd-analyze
Startup finished in 2.409s (firmware) + 5.116s (loader) + 10.274s (kernel) + 1min 33.887s (userspace) = 1min 51.687s
multi-user.target reached after 1min 33.876s in userspace.
root@genericarm64:~# journalctl -b -a|grep tty|tail -15
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS1.device: Job dev-ttyS1.device/start timed out.
Apr 24 08:51:01 genericarm64 systemd[1]: Timed out waiting for device /dev/ttyS1.
Apr 24 08:51:01 genericarm64 systemd[1]: Dependency failed for Serial Getty on ttyS1.
Apr 24 08:51:01 genericarm64 systemd[1]: [email protected]: Job [email protected]/start failed with result 'dependency'.
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS1.device: Job dev-ttyS1.device/start failed with result 'timeout'.
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS2.device: Job dev-ttyS2.device/start timed out.
Apr 24 08:51:01 genericarm64 systemd[1]: Timed out waiting for device /dev/ttyS2.
Apr 24 08:51:01 genericarm64 systemd[1]: Dependency failed for Serial Getty on ttyS2.
Apr 24 08:51:01 genericarm64 systemd[1]: [email protected]: Job [email protected]/start failed with result 'dependency'.
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS2.device: Job dev-ttyS2.device/start failed with result 'timeout'.
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS0.device: Job dev-ttyS0.device/start timed out.
Apr 24 08:51:01 genericarm64 systemd[1]: Timed out waiting for device /dev/ttyS0.
Apr 24 08:51:01 genericarm64 systemd[1]: Dependency failed for Serial Getty on ttyS0.
Apr 24 08:51:01 genericarm64 systemd[1]: [email protected]: Job [email protected]/start failed with result 'dependency'.
Apr 24 08:51:01 genericarm64 systemd[1]: dev-ttyS0.device: Job dev-ttyS0.device/start failed with result 'timeout'.

Boot time with this change:

root@genericarm64:~# systemd-analyze
Startup finished in 2.411s (firmware) + 5.109s (loader) + 10.208s (kernel) + 24.868s (userspace) = 42.598s
multi-user.target reached after 24.848s in userspace.
root@genericarm64:~# journalctl -b -a |grep tty|tail -15
Apr 03 20:34:34 genericarm64 kernel: printk: legacy console [ttyAMA0] enabled
Apr 03 20:34:34 genericarm64 kernel: 9040000.pl011: ttyAMA1 at MMIO 0x9040000 (irq = 14, base_baud = 0) is a PL011 rev1
Apr 03 20:34:35 genericarm64 systemd[1]: Created slice Slice /system/getty.
Apr 03 20:34:35 genericarm64 systemd[1]: Created slice Slice /system/serial-getty.
Apr 03 20:34:35 genericarm64 systemd[1]: Expecting device /dev/ttyAMA0...
Apr 03 20:34:44 genericarm64 systemd[1]: Found device /dev/ttyAMA0.
Apr 03 20:34:51 genericarm64 kernel[349]: printk: legacy console [tty0] enabled
Apr 03 20:34:51 genericarm64 kernel[349]: 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 13, base_baud = 0) is a PL011 rev1
Apr 03 20:34:51 genericarm64 kernel[349]: printk: legacy console [ttyAMA0] enabled
Apr 03 20:34:51 genericarm64 kernel[349]: 9040000.pl011: ttyAMA1 at MMIO 0x9040000 (irq = 14, base_baud = 0) is a PL011 rev1
Apr 03 20:34:52 genericarm64 systemd[1]: Started Getty on tty1.
Apr 03 20:34:52 genericarm64 kernel[349]: systemd[1]: Created slice Slice /system/getty.
Apr 03 20:34:52 genericarm64 kernel[349]: systemd[1]: Created slice Slice /system/serial-getty.
Apr 03 20:34:52 genericarm64 kernel[349]: systemd[1]: Expecting device /dev/ttyAMA0...
Apr 03 20:34:52 genericarm64 systemd[1]: Started Serial Getty on ttyAMA0.

Changing the SERIAL_CONSOLES variable with systemd init
("systemd" in DISTRO_FEATURES for example)
is not possible so changing systemd-serialgetty directly.
systemd-serialgetty is now always installed with systemd.

Signed-off-by: Mikko Rapeli <[email protected]>
---
 .../recipes-core/systemd/systemd-serialgetty.bbappend         | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd-serialgetty.bbappend

diff --git a/meta-yocto-bsp/recipes-core/systemd/systemd-serialgetty.bbappend b/meta-yocto-bsp/recipes-core/systemd/systemd-serialgetty.bbappend
new file mode 100644
index 0000000000..9fd43259db
--- /dev/null
+++ b/meta-yocto-bsp/recipes-core/systemd/systemd-serialgetty.bbappend
@@ -0,0 +1,4 @@
+do_install:prepend:genericarm64() {
+    # use systemd defaults to reduce boot delay from non-existing tty's
+    exit 0
+}
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.