Skip to contentSkip to conversation

systemd: let getty instead of serial-getty handle /dev/console

PATCH New Floris Bos 5 participants 9 messages Sep 9, 2016 – Sep 25, 2016

lore
Share & tools
lore

Floris Bos

author
#0 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

---
 package/systemd/systemd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/systemd/systemd.mk +1 -1
index fb07819..975bfb6 100644
@@ -357,7 +357,7 @@ ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
 # also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that
 define SYSTEMD_INSTALL_SERVICE_TTY
-	if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
+	if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console|tty[0-9]*$$'; \
 	then \
 		SERVICE="getty"; \
 	else \
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Hello,

Quoted 6 lines · Floris Bos

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Yann, Maxime, could you please review this patch?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

In reply to Floris Bos

Floris, All,

On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 6 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Regards,
Yann E. MORIN.

Quoted 24 lines
---
 package/systemd/systemd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/systemd/systemd.mk +1 -1
index fb07819..975bfb6 100644
@@ -357,7 +357,7 @@ ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
 # also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that
 define SYSTEMD_INSTALL_SERVICE_TTY
-	if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
+	if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console|tty[0-9]*$$'; \
 	then \
 		SERVICE="getty"; \
 	else \
Signature · 6 lines
2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 5 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Quoted 6 lines
Quoted 1 line

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Hello *,

Quoted 11 lines · Peter Korsgaard
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 6 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Quoted 8 lines
Quoted 4 lines

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Tested for the rpi3/glibc/systemd case and failed: I get a doubled (and unusable) ' Welcome to Buildroot/buildroot login:' on serial and no login on hdmi...

Regards,
Peter

author
#5 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Quoted 19 lines · Peter Seiderer

Hello *,

Quoted 15 lines · Peter Korsgaard
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 6 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Quoted 6 lines
Quoted 3 lines

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Tested for the rpi3/glibc/systemd case and failed: I get a doubled (and unusable) ' Welcome to Buildroot/buildroot login:' on serial and no login on hdmi...

Empty cmdline.txt will give hdmi.

Recall you need "console=serial0,115200 console=tty1" with tty1 last in cmdline.txt if you want them simultaneous.
So that tty1 becomes /dev/console and serial is handled by systemd's automatic getty generator.

Perhaps there is an issue if you have the order swapped, and both systemd's automatic stuff and the manual symlink try to display a getty on serial.
Not sure how to disable systemd's automatic behavior.

Yours sincerely,

Floris Bos

#6 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Hello Floris,

Quoted 23 lines · Floris Bos
Quoted 22 lines · Peter Seiderer

Hello *,

Quoted 18 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 5 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Quoted 6 lines
Quoted 1 line

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Quoted 8 lines
Quoted 3 lines

Tested for the rpi3/glibc/systemd case and failed: I get a doubled (and unusable) ' Welcome to Buildroot/buildroot login:' on serial and no login on hdmi...

Empty cmdline.txt will give hdmi.

Recall you need "console=serial0,115200 console=tty1" with tty1 last in cmdline.txt if you want them simultaneous.

Changed cmdline.txt to:

root=/dev/mmcblk0p2 rootwait console=ttyAMA0,115200 console=tty1

Which gives me two (functional) logins on serial and hdmi.

But I think changing package/rpi-firmware/cmdline.txt unconditional will break the other Init systems, see commit log from last patch touching cmdline.txt ([1):

...change BR2_TARGET_GENERIC_GETTY_PORT to "console", so it starts a getty on the last console= passed to the kernel, ttyAMA0...

Regards,
Peter

[1] https://git.buildroot.net/buildroot/commit/?id=20878a1017e2bf7eb8c5f870dc6d2641493cb0f9

Quoted 18 lines

So that tty1 becomes /dev/console and serial is handled by systemd's automatic getty generator.

Perhaps there is an issue if you have the order swapped, and both systemd's automatic stuff and the manual symlink try to display a getty on serial.
Not sure how to disable systemd's automatic behavior.

Yours sincerely,

Floris Bos

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

author
#7 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Quoted 38 lines · Peter Seiderer

Hello Floris,

Quoted 23 lines · Floris Bos
Quoted 22 lines · Peter Seiderer

Hello *,

Quoted 18 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 5 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Quoted 6 lines
Quoted 1 line

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Quoted 7 lines
Quoted 3 lines

Tested for the rpi3/glibc/systemd case and failed: I get a doubled (and unusable) ' Welcome to Buildroot/buildroot login:' on serial and no login on hdmi...

Empty cmdline.txt will give hdmi.

Recall you need "console=serial0,115200 console=tty1" with tty1 last in cmdline.txt if you want them simultaneous.

Changed cmdline.txt to:

root=/dev/mmcblk0p2 rootwait console=ttyAMA0,115200 console=tty1

Quoted 8 lines

Which gives me two (functional) logins on serial and hdmi.

But I think changing package/rpi-firmware/cmdline.txt unconditional will break the other Init systems, see commit log from last patch touching cmdline.txt ([1):

...change BR2_TARGET_GENERIC_GETTY_PORT to "console", so it starts a getty on the last console= passed to the kernel, ttyAMA0...

Will withdraw my patch then, and wait for someone else to come up with a better solution.

I think the one-size-fits all cmdline.txt that listens to both on HDMI and serial console by default makes things too complicated anyway.

Yours sincerely,

Floris Bos

#8 lore raw

PATCH 1/1 systemd: let getty instead of serial-getty handle /dev/console

Hello Floris,

Quoted 45 lines · Floris Bos
Quoted 44 lines · Peter Seiderer

Hello Floris,

Quoted 23 lines · Floris Bos
Quoted 22 lines · Peter Seiderer

Hello *,

Quoted 18 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Floris, All,
On 2016-09-09 18:10 +0200, Floris Bos spake thusly:

Quoted 5 lines

The serial-getty unit depends on dev-%i.device which does not seem to be created for /dev/console
Workaround this by letting normal getty unit handle things if BR2_TARGET_GENERIC_GETTY_PORT is set to 'console'

Quoted 6 lines
Quoted 1 line

I haven't tested that, but I think this is OK just on principle.

I just wonder if that behaves correctly when console is a serial line or anything else (e.g. a VT on HDMI, or through a debug channel...)

Yeah, me too. Does anybody know what the difference exactly is between getty/serial-getty, and when one should be used over the other?

Quoted 7 lines
Quoted 3 lines

Tested for the rpi3/glibc/systemd case and failed: I get a doubled (and unusable) ' Welcome to Buildroot/buildroot login:' on serial and no login on hdmi...

Empty cmdline.txt will give hdmi.

Recall you need "console=serial0,115200 console=tty1" with tty1 last in cmdline.txt if you want them simultaneous.

Changed cmdline.txt to:

root=/dev/mmcblk0p2 rootwait console=ttyAMA0,115200 console=tty1

Which gives me two (functional) logins on serial and hdmi.

But I think changing package/rpi-firmware/cmdline.txt unconditional will break the other Init systems, see commit log from last patch touching cmdline.txt ([1):

Quoted 6 lines
Quoted 2 lines

...change BR2_TARGET_GENERIC_GETTY_PORT to "console", so it starts a getty on the last console= passed to the kernel, ttyAMA0...

Will withdraw my patch then, and wait for someone else to come up with a better solution.

Ups, sorry, did not want to discourage you...

Quoted 3 lines

I think the one-size-fits all cmdline.txt that listens to both on HDMI and serial console by default makes things too complicated anyway.

Maybe its feasible to list all wanted login ports in BR2_TARGET_GENERIC_GETTY_PORT and only add the specified named systemd service links (an no generator ones)?

Regards,
Peter

Quoted 9 lines

Yours sincerely,

Floris Bos

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot