Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
@ 2019-03-03 11:30 Xavier Ruppen
  2019-03-03 11:54 ` Yann E. MORIN
  2019-03-03 20:04 ` [Buildroot] [PATCH v2 " Xavier Ruppen
  0 siblings, 2 replies; 8+ messages in thread
From: Xavier Ruppen @ 2019-03-03 11:30 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
---
 package/systemd/systemd.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 7a46a50ed3..f378203e8d 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -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; \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 11:30 [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
@ 2019-03-03 11:54 ` Yann E. MORIN
  2019-03-03 20:26   ` Peter Korsgaard
  2019-03-03 20:04 ` [Buildroot] [PATCH v2 " Xavier Ruppen
  1 sibling, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2019-03-03 11:54 UTC (permalink / raw)
  To: buildroot

Xavier, All,

On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:
> 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
> 
> Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
> ---
>  package/systemd/systemd.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 7a46a50ed3..f378203e8d 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -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"; \

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.

>  	else \
>  		SERVICE="serial-getty"; \
>  	fi; \
> -- 
> 2.21.0
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 11:30 [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
  2019-03-03 11:54 ` Yann E. MORIN
@ 2019-03-03 20:04 ` Xavier Ruppen
  1 sibling, 0 replies; 8+ messages in thread
From: Xavier Ruppen @ 2019-03-03 20:04 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
---
 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(-)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 7a46a50ed3..3c75931527 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -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 \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 11:54 ` Yann E. MORIN
@ 2019-03-03 20:26   ` Peter Korsgaard
  2019-03-03 20:48     ` Yann E. MORIN
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2019-03-03 20:26 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Xavier, All,
 > On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:
 >> 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
 >> 
 >> Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
 >> ---
 >> package/systemd/systemd.mk | 4 ++++
 >> 1 file changed, 4 insertions(+)
 >> 
 >> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
 >> index 7a46a50ed3..f378203e8d 100644
 >> --- a/package/systemd/systemd.mk
 >> +++ b/package/systemd/systemd.mk
 >> @@ -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"; \

 > 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'.

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?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 20:26   ` Peter Korsgaard
@ 2019-03-03 20:48     ` Yann E. MORIN
  2019-03-03 21:21       ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2019-03-03 20:48 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2019-03-03 21:26 +0100, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>  > On 2019-03-03 12:30 +0100, Xavier Ruppen spake thusly:
>  >> 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--]
>  >> +	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.

> 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.

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.

> Xavier, will you send an updated patch please?
> 
> -- 
> Bye, Peter Korsgaard

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 20:48     ` Yann E. MORIN
@ 2019-03-03 21:21       ` Peter Korsgaard
  2019-03-03 21:37         ` Yann E. MORIN
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2019-03-03 21:21 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 >> 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.

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

 >     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.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 21:21       ` Peter Korsgaard
@ 2019-03-03 21:37         ` Yann E. MORIN
  2019-03-03 21:55           ` Xavier Ruppen
  0 siblings, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2019-03-03 21:37 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2019-03-03 22:21 +0100, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>  > Well, wecould make it simple, and use (pseudoc-ode):
>  >     if console:
>  >         SERVICE='console-getty'
>  >     elif vt:
>  >         SERVICE='getty@'
>  >     else:
>  >         SERVICE='serial-getty@'
> 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.

> 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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-03 21:37         ` Yann E. MORIN
@ 2019-03-03 21:55           ` Xavier Ruppen
  0 siblings, 0 replies; 8+ messages in thread
From: Xavier Ruppen @ 2019-03-03 21:55 UTC (permalink / raw)
  To: buildroot

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.

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-03-03 21:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-03 11:30 [Buildroot] [PATCH 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
2019-03-03 11:54 ` Yann E. MORIN
2019-03-03 20:26   ` Peter Korsgaard
2019-03-03 20:48     ` Yann E. MORIN
2019-03-03 21:21       ` Peter Korsgaard
2019-03-03 21:37         ` Yann E. MORIN
2019-03-03 21:55           ` Xavier Ruppen
2019-03-03 20:04 ` [Buildroot] [PATCH v2 " Xavier Ruppen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox