* [PATCH] systemd-serialgetty: Fix do_install for mixed baud rates
@ 2026-11-20 16:33 Niko Mauno
2026-11-26 15:09 ` Paul Barker
0 siblings, 1 reply; 3+ messages in thread
From: Niko Mauno @ 2026-11-20 16:33 UTC (permalink / raw)
To: openembedded-core; +Cc: Niko Mauno
Since commit b6a7617145c3 ("systemd-serialgetty: use existing unit
files in systemd") removed the recipe's own serial-getty@.service, any
SERIAL_CONSOLES entry whose baud rate differs from the first one fails
do_install, as the unit template it copies no longer exists:
install: cannot stat '.../serial-getty@.service': No such file or directory
Enable systemd's serial-getty@.service for every console instead, as is
already done for the first one. That unit runs agetty with --keep-baud,
so a console's configured rate takes effect only where the kernel has
set it up, i.e. on a kernel console. Since b6a7617145c3 this has been
true of the first entry as well; say so in the recipe.
Tested on master and wrynose with mixed-rate SERIAL_CONSOLES: both
consoles get a getty, and on a qemux86-64 boot with "115200;ttyS0
38400;ttyS1", ttyS1, not a kernel console, runs at the 9600 default.
Fixes: b6a7617145c3 ("systemd-serialgetty: use existing unit files in systemd")
AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
.../recipes-core/systemd/systemd-serialgetty.bb | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index c3fe9d5b6d..807dd8bb9f 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;m
# will probe at boot and generate getty instances for any active consoles as
# required. This recipe (enabled via disabling serial-getty-generator in systemd)
# should only be used if the generator is not appropriate.
+# Its gettys ignore SERIAL_CONSOLES baud rates and keep the rate the kernel set.
# As this package is tied to systemd, only build it when we're also building systemd.
inherit features_check
@@ -16,25 +17,13 @@ REQUIRED_DISTRO_FEATURES += "usrmerge"
do_install() {
if [ ! -z "${SERIAL_CONSOLES}" ] ; then
- default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
tmp="${SERIAL_CONSOLES}"
for entry in $tmp ; do
- baudrate=`echo $entry | sed 's/\;.*//'`
ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
- if [ "$baudrate" = "$default_baudrate" ] ; then
- # enable the service
- ln -sf ${systemd_system_unitdir}/serial-getty@.service \
- ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
- else
- # install custom service file for the non-default baudrate
- install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
- sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
- # enable the service
- ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \
- ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
- fi
+ ln -sf ${systemd_system_unitdir}/serial-getty@.service \
+ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
done
fi
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] systemd-serialgetty: Fix do_install for mixed baud rates
2026-11-20 16:33 [PATCH] systemd-serialgetty: Fix do_install for mixed baud rates Niko Mauno
@ 2026-11-26 15:09 ` Paul Barker
2026-11-27 11:19 ` [PATCH v2] systemd-serialgetty: Fix console " Niko Mauno
0 siblings, 1 reply; 3+ messages in thread
From: Paul Barker @ 2026-11-26 15:09 UTC (permalink / raw)
To: Niko Mauno, openembedded-core
On Fri Nov 20, 2026 at 4:33 PM GMT, Niko Mauno wrote:
> Since commit b6a7617145c3 ("systemd-serialgetty: use existing unit
> files in systemd") removed the recipe's own serial-getty@.service, any
> SERIAL_CONSOLES entry whose baud rate differs from the first one fails
> do_install, as the unit template it copies no longer exists:
>
> install: cannot stat '.../serial-getty@.service': No such file or directory
>
> Enable systemd's serial-getty@.service for every console instead, as is
> already done for the first one. That unit runs agetty with --keep-baud,
> so a console's configured rate takes effect only where the kernel has
> set it up, i.e. on a kernel console. Since b6a7617145c3 this has been
> true of the first entry as well; say so in the recipe.
>
> Tested on master and wrynose with mixed-rate SERIAL_CONSOLES: both
> consoles get a getty, and on a qemux86-64 boot with "115200;ttyS0
> 38400;ttyS1", ttyS1, not a kernel console, runs at the 9600 default.
>
> Fixes: b6a7617145c3 ("systemd-serialgetty: use existing unit files in systemd")
> AI-Generated: Uses Claude Code (Claude Opus 5.5)
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Hi,
This seems like a step backwards as we're dropping support for
non-default baud rates. Can we fix this support instead of removing it?
Best regards,
--
Paul Barker
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2] systemd-serialgetty: Fix console baud rates
2026-11-26 15:09 ` Paul Barker
@ 2026-11-27 11:19 ` Niko Mauno
0 siblings, 0 replies; 3+ messages in thread
From: Niko Mauno @ 2026-11-27 11:19 UTC (permalink / raw)
To: openembedded-core; +Cc: ross.burton, paul, Niko Mauno
Since commit b6a7617145c3 ("systemd-serialgetty: use existing unit
files in systemd") removed the recipe's own serial-getty@.service, the
baud rates in SERIAL_CONSOLES are no longer applied, and any entry
whose rate differs from the first one fails do_install, as the unit
template it copies no longer exists:
install: cannot stat '.../serial-getty@.service': No such file or directory
Enable systemd's serial-getty@.service for every console, and give each
one with a numeric rate a drop-in that sets it with stty before agetty
starts. That unit runs agetty with --keep-baud, so agetty keeps the
rate, while the unit itself stays as systemd ships it.
stty comes from busybox or coreutils; without it, the getty still
starts, at the rate the line already has. With nothing answering on
the line, systemd's terminal setup for stty adds about a second before
the login prompt, on top of a similar wait for agetty itself.
Tested on master with qemux86-64 core-image-minimal and
"115200;ttyS0 38400;ttyS1", also reversed: both consoles get a getty
at their configured rate, whether or not the kernel command line sets
one.
Fixes: b6a7617145c3 ("systemd-serialgetty: use existing unit files in systemd")
AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
v2:
- Apply the SERIAL_CONSOLES baud rates with a per-tty stty drop-in
instead of documenting them as ignored. v1 was "systemd-serialgetty:
Fix do_install for mixed baud rates".
- After a BREAK, agetty switches to the first rate in systemd's
115200,57600,38400,9600 list until the getty restarts; the old unit
ran agetty at one fixed rate.
- Applies to wrynose as-is.
- The code was generated with Claude Code (see the AI-Generated: tag).
---
.../systemd/systemd-serialgetty.bb | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index c3fe9d5b6d..1c109536e1 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -16,25 +16,24 @@ REQUIRED_DISTRO_FEATURES += "usrmerge"
do_install() {
if [ ! -z "${SERIAL_CONSOLES}" ] ; then
- default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
tmp="${SERIAL_CONSOLES}"
for entry in $tmp ; do
baudrate=`echo $entry | sed 's/\;.*//'`
ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
- if [ "$baudrate" = "$default_baudrate" ] ; then
- # enable the service
- ln -sf ${systemd_system_unitdir}/serial-getty@.service \
- ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
- else
- # install custom service file for the non-default baudrate
- install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
- sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
- # enable the service
- ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \
- ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
- fi
+ ln -sf ${systemd_system_unitdir}/serial-getty@.service \
+ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
+ # agetty runs with --keep-baud, so set the rate it keeps
+ case "$baudrate" in
+ ''|*[!0-9]*)
+ ;;
+ *)
+ install -d ${D}${sysconfdir}/systemd/system/serial-getty@$ttydev.service.d
+ printf '[Service]\nExecStartPre=-${base_bindir}/stty -F /dev/%%I %s\n' $baudrate \
+ > ${D}${sysconfdir}/systemd/system/serial-getty@$ttydev.service.d/baudrate.conf
+ ;;
+ esac
done
fi
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-27 11:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 16:33 [PATCH] systemd-serialgetty: Fix do_install for mixed baud rates Niko Mauno
2026-11-26 15:09 ` Paul Barker
2026-11-27 11:19 ` [PATCH v2] systemd-serialgetty: Fix console " Niko Mauno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox