Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
@ 2019-03-04 19:25 Xavier Ruppen
  2019-03-04 21:09 ` Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xavier Ruppen @ 2019-03-04 19:25 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 v2 -> v3:
  - introduce two separate variables, $TARGET and $LINK_NAME,
    in order to solve various '@' problems.
  - I tested this patch with console and serial-getty. I also
    checked that sed works when changing the baudrate:

    $ ls -al output/target/etc/systemd/system/getty.target.wants/
    total 8
    drwxr-xr-x 2 user user 4096 Mar  4 20:09 .
    drwxr-xr-x 8 user user 4096 Mar  4 20:09 ..
    lrwxrwxrwx 1 user user   52 Mar  4 20:09 console-getty.service -> ../../../../lib/systemd/system/console-getty.service
    
    $ ls -al output/target/etc/systemd/system/getty.target.wants/
    total 8
    drwxr-xr-x 2 user user 4096 Mar  4 20:12 .
    drwxr-xr-x 8 user user 4096 Mar  4 20:12 ..
    lrwxrwxrwx 1 user user   45 Mar  4 20:12 getty at serial-getty.service -> ../../../../lib/systemd/system/getty at .service

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

 package/systemd/systemd.mk | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 7a46a50ed3..1d0141f20b 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -397,19 +397,29 @@ 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"; \
+		TARGET=$${SERVICE}.service; \
+		LINK_NAME=$${SERVICE}.service; \
+	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
 	then \
 		SERVICE="getty"; \
+		TARGET=$${SERVICE}@.service; \
+		LINK_NAME=$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
 	else \
 		SERVICE="serial-getty"; \
+		TARGET=$${SERVICE}@.service; \
+		LINK_NAME=$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
 	fi; \
-	ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
-		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+	ln -fs ../../../../lib/systemd/system/$${TARGET} \
+		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${LINK_NAME}; \
 	if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \
 	then \
-		$(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${SERVICE}@.service; \
+		$(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${TARGET}; \
 	fi
 endef
 endif
-- 
2.21.0

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

* [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-04 19:25 [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
@ 2019-03-04 21:09 ` Yann E. MORIN
  2019-03-04 21:32 ` Peter Korsgaard
  2019-03-17 22:14 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2019-03-04 21:09 UTC (permalink / raw)
  To: buildroot

Xavier, All,

On 2019-03-04 20:25 +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>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

However, a slight improvement that can be done when applying, see
below...

[--SNIP--]
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 7a46a50ed3..1d0141f20b 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -397,19 +397,29 @@ 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"; \
> +		TARGET=$${SERVICE}.service; \
> +		LINK_NAME=$${SERVICE}.service; \

There is now no real need for the SERVICE variable anymore, since we can
simply write:

    TARGET='console-getty.service'; \
    LINK_NAME='console-getty.service'

or:

    TARGET='getty at .service'; \
    LINK_NAME='getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service'

Note also that $(BR2_TARGET_GENERIC_GETTY_PORT) whould probably be
qstrip-ed now.

Peter, can you handle that when applying?

Regards,
Yann E. MORIN.

> +	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
>  	then \
>  		SERVICE="getty"; \
> +		TARGET=$${SERVICE}@.service; \
> +		LINK_NAME=$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
>  	else \
>  		SERVICE="serial-getty"; \
> +		TARGET=$${SERVICE}@.service; \
> +		LINK_NAME=$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
>  	fi; \
> -	ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
> -		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
> +	ln -fs ../../../../lib/systemd/system/$${TARGET} \
> +		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${LINK_NAME}; \
>  	if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \
>  	then \
> -		$(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${SERVICE}@.service; \
> +		$(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${TARGET}; \
>  	fi
>  endef
>  endif
> -- 
> 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] 4+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-04 19:25 [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
  2019-03-04 21:09 ` Yann E. MORIN
@ 2019-03-04 21:32 ` Peter Korsgaard
  2019-03-17 22:14 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2019-03-04 21:32 UTC (permalink / raw)
  To: buildroot

>>>>> "Xavier" == Xavier Ruppen <xruppen@gmail.com> writes:

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

Committed after adding the cleanups as suggested by Yann, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console."
  2019-03-04 19:25 [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
  2019-03-04 21:09 ` Yann E. MORIN
  2019-03-04 21:32 ` Peter Korsgaard
@ 2019-03-17 22:14 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2019-03-17 22:14 UTC (permalink / raw)
  To: buildroot

>>>>> "Xavier" == Xavier Ruppen <xruppen@gmail.com> writes:

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

Committed to 2018.02.x and 2018.11.x, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2019-03-17 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04 19:25 [Buildroot] [PATCH v3 1/1] package/systemd: fix "Timed out waiting for device /dev/console." Xavier Ruppen
2019-03-04 21:09 ` Yann E. MORIN
2019-03-04 21:32 ` Peter Korsgaard
2019-03-17 22:14 ` Peter Korsgaard

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