Skip to contentSkip to conversation

package/systemd: fix "Timed out waiting for device /dev/console."

PATCH Superseded Xavier Ruppen 3 participants 8 messages Mar 3, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Buildroot built with systemd fails to open a login prompt on the serial port when /dev/console is specified as BR2_TARGET_GENERIC_GETTY_PORT (which is its default value):

systemd[1]: dev-console.device: Job dev-console.device/start timed out.
systemd[1]: Timed out waiting for device /dev/console.
systemd[1]: Dependency failed for Serial Getty on console.
systemd[1]: serial-getty at console.service: Job serial-getty at console.service/start failed with result 'dependency'. systemd[1]: dev-console.device: Job dev-console.device/start failed with result 'timeout'. systemd[1]: Reached target Login Prompts.
systemd[1]: Reached target Multi-User System.

According to this issue on Github [1], serial-getty at .service should not be instantiated on /dev/console, console-getty at .service should be used instead. This stems from the fact that there should be no dependency on /dev/console.

[1] https://github.com/systemd/systemd/issues/10914

---
 package/systemd/systemd.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/systemd/systemd.mk +4 -0
index 7a46a50ed3..f378203e8d 100644
@@ -397,11 +397,15 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# note that console-getty.service should be used on /dev/console as it should not have dependencies
 # 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]*$$'; \
 	then \
 		SERVICE="getty"; \
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console'; \
+	then \
+		SERVICE="console-getty"; \
 	else \
 		SERVICE="serial-getty"; \
 	fi; \
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Xavier, All,

On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:

Quoted 31 lines

Buildroot built with systemd fails to open a login prompt on the serial port when /dev/console is specified as BR2_TARGET_GENERIC_GETTY_PORT (which is its default value):

systemd[1]: dev-console.device: Job dev-console.device/start timed out.
systemd[1]: Timed out waiting for device /dev/console.
systemd[1]: Dependency failed for Serial Getty on console.
systemd[1]: serial-getty at console.service: Job serial-getty at console.service/start failed with result 'dependency'. systemd[1]: dev-console.device: Job dev-console.device/start failed with result 'timeout'. systemd[1]: Reached target Login Prompts.
systemd[1]: Reached target Multi-User System.

According to this issue on Github [1], serial-getty at .service should not be instantiated on /dev/console, console-getty at .service should be used instead. This stems from the fact that there should be no dependency on /dev/console.

[1] https://github.com/systemd/systemd/issues/10914

---
 package/systemd/systemd.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/systemd/systemd.mk +0 -0
index 7a46a50ed3..f378203e8d 100644
@@ -397,11 +397,15 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)

package/systemd/systemd.mk endef · line 408

Quoted 10 lines
package/systemd/systemd.mk +4 -0
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# note that console-getty.service should be used on /dev/console as it should not have dependencies
 # 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]*$$'; \
 	then \
 		SERVICE="getty"; \
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console'; \
+	then \
+		SERVICE="console-getty"; \

Actually, I think we should check for 'console' first, and since this is a literal, we do not need grep, just a test for equality:

    if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = /dev/console ]; \
    then \
        SERVICE="console-getty"; \
    elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
    then \
        [...]
    fi

Otherwise, I'm OK with this change.

Regards,
Yann E. MORIN.

Quoted 6 lines
package/systemd/systemd.mk +0 -0
 	else \
 		SERVICE="serial-getty"; \
 	fi; \
Signature · 1 line
2.21.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Quoted 49 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Xavier, All,
On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:

Quoted 38 lines

Buildroot built with systemd fails to open a login prompt on the serial port when /dev/console is specified as BR2_TARGET_GENERIC_GETTY_PORT (which is its default value):

systemd[1]: dev-console.device: Job dev-console.device/start timed out.
systemd[1]: Timed out waiting for device /dev/console.
systemd[1]: Dependency failed for Serial Getty on console.
systemd[1]: serial-getty at console.service: Job serial-getty at console.service/start failed with result 'dependency'. systemd[1]: dev-console.device: Job dev-console.device/start failed with result 'timeout'. systemd[1]: Reached target Login Prompts.
systemd[1]: Reached target Multi-User System.

According to this issue on Github [1], serial-getty at .service should not be instantiated on /dev/console, console-getty at .service should be used instead. This stems from the fact that there should be no dependency on /dev/console.

[1] https://github.com/systemd/systemd/issues/10914

---
package/systemd/systemd.mk | 4 ++++

1 file changed, 4 insertions(+)
package/systemd/systemd.mk +1 -0
index 7a46a50ed3..f378203e8d 100644
@@ -397,11 +397,15 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# note that console-getty.service should be used on /dev/console as it should not have dependencies
 # 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]*$$'; \
then \
SERVICE="getty"; \

package/systemd/systemd.mk endef · line 408

Quoted 3 lines
package/systemd/systemd.mk +3 -0
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console'; \
+	then \
+		SERVICE="console-getty"; \

Actually, I think we should check for 'console' first, and since this is a literal, we do not need grep, just a test for equality:

Quoted 1 line
    if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = /dev/console ]; \

We don't specify the /dev/ part, so this should be just '= console'.

I was going to commit this, but then I noticed that there isn't a console-getty at .service file, so this doesn't seem right:

ls -lah ../../../../lib/systemd/system/|grep getty

lrwxrwxrwx  1 peko peko   49 Mar  3 21:13 autovt at .service -> ../../../../usr/lib/systemd/system/getty at .service
-rw-r--r--  1 peko peko 1.1K Mar  3 21:13 console-getty.service
-rw-r--r--  1 peko peko 1.2K Mar  3 21:13 container-getty at .service
-rw-r--r--  1 peko peko  506 Dec 21 19:53 getty-pre.target
-rw-r--r--  1 peko peko 1.8K Mar  3 21:13 getty at .service
-rw-r--r--  1 peko peko  500 Dec 21 19:53 getty.target
-rw-r--r--  1 peko peko 1.5K Mar  3 21:13 serial-getty at .service

I guess we need to introduce a TARGET variable that is $${SERVICE}.service for console-getty, and $${SERVICE}@.service for everything else, but I know next to nothing about systemd, so I will let someone who can actually test this send a patch.

Xavier, will you send an updated patch please?

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

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Peter, All,

On 2019-03-03 21:26 +0100, Peter Korsgaard spake thusly:

Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:

Quoted 2 lines

Buildroot built with systemd fails to open a login prompt on the serial port when /dev/console is specified as BR2_TARGET_GENERIC_GETTY_PORT

[--SNIP--]

Quoted 10 lines
Quoted 8 lines

package/systemd/systemd.mk endef · line 408

Quoted 3 lines
package/systemd/systemd.mk +3 -0
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'console'; \
+	then \
+		SERVICE="console-getty"; \

Actually, I think we should check for 'console' first, and since this is a literal, we do not need grep, just a test for equality:

    if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = /dev/console ]; \

We don't specify the /dev/ part, so this should be just '= console'.

Yes, I just wrote it to hint at Xavier.

Quoted 13 lines

I was going to commit this, but then I noticed that there isn't a console-getty at .service file, so this doesn't seem right:

ls -lah ../../../../lib/systemd/system/|grep getty
lrwxrwxrwx 1 peko peko 49 Mar 3 21:13 autovt at .service -> ../../../../usr/lib/systemd/system/getty at .service

(quoted diff) +0 -6
-rw-r--r--  1 peko peko 1.1K Mar  3 21:13 console-getty.service
 
-rw-r--r--  1 peko peko 1.2K Mar  3 21:13 container-getty at .service
-rw-r--r--  1 peko peko  506 Dec 21 19:53 getty-pre.target
-rw-r--r--  1 peko peko 1.8K Mar  3 21:13 getty at .service
-rw-r--r--  1 peko peko  500 Dec 21 19:53 getty.target
-rw-r--r--  1 peko peko 1.5K Mar  3 21:13 serial-getty at .service
Quoted 4 lines

I guess we need to introduce a TARGET variable that is $${SERVICE}.service for console-getty, and $${SERVICE}@.service for everything else, but I know next to nothing about systemd, so I will let someone who can actually test this send a patch.

Well, wecould make it simple, and use (pseudoc-ode):

if console:
SERVICE='console-getty'
elif vt:
SERVICE='getty@'
else:
SERVICE='serial-getty@'

No?

Regards,
Yann E. MORIN.

Quoted 4 lines

Xavier, will you send an updated patch please?

Signature · 1 line
Bye, Peter Korsgaard
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Hi,

Quoted 21 lines
Quoted 14 lines

I was going to commit this, but then I noticed that there isn't a console-getty at .service file, so this doesn't seem right:

ls -lah ../../../../lib/systemd/system/|grep getty lrwxrwxrwx 1 peko peko 49 Mar 3 21:13 autovt at .service -> ../../../../usr/lib/systemd/system/getty at .service

(quoted diff) +0 -6
-rw-r--r--  1 peko peko 1.1K Mar  3 21:13 console-getty.service
 
-rw-r--r--  1 peko peko 1.2K Mar  3 21:13 container-getty at .service
-rw-r--r--  1 peko peko  506 Dec 21 19:53 getty-pre.target
-rw-r--r--  1 peko peko 1.8K Mar  3 21:13 getty at .service
-rw-r--r--  1 peko peko  500 Dec 21 19:53 getty.target
-rw-r--r--  1 peko peko 1.5K Mar  3 21:13 serial-getty at .service
Quoted 4 lines

I guess we need to introduce a TARGET variable that is $${SERVICE}.service for console-getty, and $${SERVICE}@.service for everything else, but I know next to nothing about systemd, so I will let someone who can actually test this send a patch.

Well, wecould make it simple, and use (pseudoc-ode):

Quoted 8 lines

if console:
SERVICE='console-getty'
elif vt:
SERVICE='getty@'
else:
SERVICE='serial-getty@'

No?

I don't think so, as we need both <name>@<target> and <target>:

	ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service

So we either end up with no @ in the symlink name, or a double @@.

I don't know if that is problem or not for systemd.

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

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Peter, All,

On 2019-03-03 22:21 +0100, Peter Korsgaard spake thusly:

Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Well, wecould make it simple, and use (pseudoc-ode):
if console:
SERVICE='console-getty'
elif vt:
SERVICE='getty@'
else:
SERVICE='serial-getty@'

Quoted 6 lines

I don't think so, as we need both <name>@<target> and <target>:

	ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service

So we either end up with no @ in the symlink name, or a double @@.

Arg, I ndeed I missed that. Nice point.

Quoted 1 line

I don't know if that is problem or not for systemd.

Neither do I , but I would not wagger it isn't... ;-)

However, from what I understand, the part between the '@' and the '.service' is used to fill in the %I placeholder in the service file. Since the console-getty.service does not have a placeholder, it is hopefully not a problem that we create the console-getty at console.service file...

Xavier, if this is the case, please say so in the commit log. If I wrote bullsh!t, then please also say so, and then explain how your patch makes it work.

In either case, I think it would make sense to indeed do as Peter suggested, because even if your patch works, it's probably a trick and could break in a future systemd release...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

Hi Yann, hi Peter,

Indeed, I didn't catch this as it works nonetheless, sorry about that.

The "console-getty at console.service" doesn't worry me too much, even though I agree we should have "console-getty.service" instead. On the other hand, the broken symlink to "lib/systemd/system/console-getty at .service" must be fixed.

Quoted 3 lines

Xavier, if this is the case, please say so in the commit log. If I wrote bullsh!t, then please also say so, and then explain how your patch makes it work.

I am no expert in systemd either but I think you're right. I will have a look during
the week and post a v3.

Best regards,

Xavier

#7 lore raw

PATCH v2 1/1 package/systemd: fix "Timed out waiting for device /dev/console."

In reply to Xavier Ruppen

Buildroot built with systemd fails to open a login prompt on the serial port when /dev/console is specified as BR2_TARGET_GENERIC_GETTY_PORT (which is its default value):

systemd[1]: dev-console.device: Job dev-console.device/start timed out.
systemd[1]: Timed out waiting for device /dev/console.
systemd[1]: Dependency failed for Serial Getty on console.
systemd[1]: serial-getty at console.service: Job serial-getty at console.service/start failed with result 'dependency'. systemd[1]: dev-console.device: Job dev-console.device/start failed with result 'timeout'. systemd[1]: Reached target Login Prompts.
systemd[1]: Reached target Multi-User System.

According to this issue on Github [1], serial-getty at .service should not be instantiated on /dev/console, console-getty at .service should be used instead. This stems from the fact that there should be no dependency on /dev/console.

[1] https://github.com/systemd/systemd/issues/10914

---
Changes v1 -> v2:
- swap tty and console if statements
- use equality operator instead of grep for "console"

 package/systemd/systemd.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +5 -1
index 7a46a50ed3..3c75931527 100644
@@ -397,9 +397,13 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# note that console-getty.service should be used on /dev/console as it should not have dependencies
 # 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 [ $(BR2_TARGET_GENERIC_GETTY_PORT) = "console" ]; \
+	then \
+		SERVICE="console-getty"; \
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
 	then \
 		SERVICE="getty"; \
 	else \
Signature · 1 line
2.21.0