Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] systemd: fix systemd-udev-hwdb-update service
@ 2015-06-30  5:16 rongqing.li
  2015-07-13  2:12 ` Rongqing Li
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: rongqing.li @ 2015-06-30  5:16 UTC (permalink / raw)
  To: openembedded-core

From: Chen Qi <Qi.Chen@windriver.com>

The new version of systemd has implemented the following feature.
Opointer.de/blog/projects/stateless.html

As a result, the systemd-udev-hwdb-update.service would always run
at first boot. This will cause failure if the target device doesn't
have enough storage space. Besides, as we run `udevadm hwdb --update' as
a postinst of udev-hwdb at rootfs time, there's no need to run this
again at system start-up.

The purpose of this patch is as follows.
If `udev hwdb --update' fails at rootfs time, systemd-udev-hwdb-update.service
is executed at first boot; otherwise, the service is not executed.

This patch achieves the above goal by setting CondistonNeedsUpdate to
"/etc/udev" in the service file, and creating /etc/udev/.updated file if the
postinst succeeds.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-core/systemd/systemd_219.bb | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb
index 6ed4fe0..dc5c7b3 100644
--- a/meta/recipes-core/systemd/systemd_219.bb
+++ b/meta/recipes-core/systemd/systemd_219.bb
@@ -180,6 +180,10 @@ do_install() {
 	if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
 		${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
 	fi
+
+	# Make systemd-udev-hwdb-update to check /etc/udev
+	cp ${D}${systemd_unitdir}/system/systemd-udev-hwdb-update.service ${D}${sysconfdir}/systemd/system
+	sed -i -e 's#ConditionNeedsUpdate=/etc#ConditionNeedsUpdate=/etc/udev#g' ${D}${sysconfdir}/systemd/system/systemd-udev-hwdb-update.service
 }
 
 do_install_ptest () {
@@ -381,10 +385,18 @@ ALTERNATIVE_PRIORITY[runlevel] ?= "300"
 
 pkg_postinst_udev-hwdb () {
 	if test -n "$D"; then
-		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
-			--root $D
+		if ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
+			--root $D; then
+			touch $D/etc/udev/.updated
+		else
+			exit 1
+		fi
 	else
-		udevadm hwdb --update
+		if udevadm hwdb --update; then
+			touch $D/etc/udev/.updated
+		else
+			exit 1
+		fi
 	fi
 }
 
-- 
1.9.1



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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-06-30  5:16 [PATCH] systemd: fix systemd-udev-hwdb-update service rongqing.li
@ 2015-07-13  2:12 ` Rongqing Li
  2015-07-13  5:00 ` Khem Raj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Rongqing Li @ 2015-07-13  2:12 UTC (permalink / raw)
  To: openembedded-core

ping

-Roy

On 2015年06月30日 13:16, rongqing.li@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The new version of systemd has implemented the following feature.
> Opointer.de/blog/projects/stateless.html
>
> As a result, the systemd-udev-hwdb-update.service would always run
> at first boot. This will cause failure if the target device doesn't
> have enough storage space. Besides, as we run `udevadm hwdb --update' as
> a postinst of udev-hwdb at rootfs time, there's no need to run this
> again at system start-up.
>
> The purpose of this patch is as follows.
> If `udev hwdb --update' fails at rootfs time, systemd-udev-hwdb-update.service
> is executed at first boot; otherwise, the service is not executed.
>
> This patch achieves the above goal by setting CondistonNeedsUpdate to
> "/etc/udev" in the service file, and creating /etc/udev/.updated file if the
> postinst succeeds.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>   meta/recipes-core/systemd/systemd_219.bb | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb
> index 6ed4fe0..dc5c7b3 100644
> --- a/meta/recipes-core/systemd/systemd_219.bb
> +++ b/meta/recipes-core/systemd/systemd_219.bb
> @@ -180,6 +180,10 @@ do_install() {
>   	if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
>   		${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
>   	fi
> +
> +	# Make systemd-udev-hwdb-update to check /etc/udev
> +	cp ${D}${systemd_unitdir}/system/systemd-udev-hwdb-update.service ${D}${sysconfdir}/systemd/system
> +	sed -i -e 's#ConditionNeedsUpdate=/etc#ConditionNeedsUpdate=/etc/udev#g' ${D}${sysconfdir}/systemd/system/systemd-udev-hwdb-update.service
>   }
>
>   do_install_ptest () {
> @@ -381,10 +385,18 @@ ALTERNATIVE_PRIORITY[runlevel] ?= "300"
>
>   pkg_postinst_udev-hwdb () {
>   	if test -n "$D"; then
> -		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> -			--root $D
> +		if ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> +			--root $D; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	else
> -		udevadm hwdb --update
> +		if udevadm hwdb --update; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	fi
>   }
>
>

-- 
Best Reagrds,
Roy | RongQing Li


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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-06-30  5:16 [PATCH] systemd: fix systemd-udev-hwdb-update service rongqing.li
  2015-07-13  2:12 ` Rongqing Li
@ 2015-07-13  5:00 ` Khem Raj
  2015-07-13  6:54   ` ChenQi
  2015-07-24  6:18 ` ChenQi
  2015-08-19  1:48 ` ChenQi
  3 siblings, 1 reply; 7+ messages in thread
From: Khem Raj @ 2015-07-13  5:00 UTC (permalink / raw)
  To: rongqing.li@windriver.com; +Cc: Patches and discussions about the oe-core layer

On Mon, Jun 29, 2015 at 10:16 PM,  <rongqing.li@windriver.com> wrote:
> This patch achieves the above goal by setting CondistonNeedsUpdate to
> "/etc/udev" in the service file, and creating /etc/udev/.updated file if the
> postinst succeeds.

will  /etc/udev/.updated get packaged automatically in case of r/o rootfs ?


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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-07-13  5:00 ` Khem Raj
@ 2015-07-13  6:54   ` ChenQi
  0 siblings, 0 replies; 7+ messages in thread
From: ChenQi @ 2015-07-13  6:54 UTC (permalink / raw)
  To: Khem Raj, rongqing.li@windriver.com
  Cc: Patches and discussions about the oe-core layer

On 07/13/2015 01:00 PM, Khem Raj wrote:
> On Mon, Jun 29, 2015 at 10:16 PM,  <rongqing.li@windriver.com> wrote:
>> This patch achieves the above goal by setting CondistonNeedsUpdate to
>> "/etc/udev" in the service file, and creating /etc/udev/.updated file if the
>> postinst succeeds.
> will  /etc/udev/.updated get packaged automatically in case of r/o rootfs ?

No. It will not get packaged because it's created at rootfs time in 
pkg_postinst of udev-hwdb.

Best Regards,
Chen Qi


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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-06-30  5:16 [PATCH] systemd: fix systemd-udev-hwdb-update service rongqing.li
  2015-07-13  2:12 ` Rongqing Li
  2015-07-13  5:00 ` Khem Raj
@ 2015-07-24  6:18 ` ChenQi
  2015-08-10  2:07   ` Rongqing Li
  2015-08-19  1:48 ` ChenQi
  3 siblings, 1 reply; 7+ messages in thread
From: ChenQi @ 2015-07-24  6:18 UTC (permalink / raw)
  To: openembedded-core

ping

Anybody has objection for this one?

Best Regards,
Chen Qi

On 06/30/2015 01:16 PM, rongqing.li@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The new version of systemd has implemented the following feature.
> Opointer.de/blog/projects/stateless.html
>
> As a result, the systemd-udev-hwdb-update.service would always run
> at first boot. This will cause failure if the target device doesn't
> have enough storage space. Besides, as we run `udevadm hwdb --update' as
> a postinst of udev-hwdb at rootfs time, there's no need to run this
> again at system start-up.
>
> The purpose of this patch is as follows.
> If `udev hwdb --update' fails at rootfs time, systemd-udev-hwdb-update.service
> is executed at first boot; otherwise, the service is not executed.
>
> This patch achieves the above goal by setting CondistonNeedsUpdate to
> "/etc/udev" in the service file, and creating /etc/udev/.updated file if the
> postinst succeeds.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>   meta/recipes-core/systemd/systemd_219.bb | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb
> index 6ed4fe0..dc5c7b3 100644
> --- a/meta/recipes-core/systemd/systemd_219.bb
> +++ b/meta/recipes-core/systemd/systemd_219.bb
> @@ -180,6 +180,10 @@ do_install() {
>   	if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
>   		${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
>   	fi
> +
> +	# Make systemd-udev-hwdb-update to check /etc/udev
> +	cp ${D}${systemd_unitdir}/system/systemd-udev-hwdb-update.service ${D}${sysconfdir}/systemd/system
> +	sed -i -e 's#ConditionNeedsUpdate=/etc#ConditionNeedsUpdate=/etc/udev#g' ${D}${sysconfdir}/systemd/system/systemd-udev-hwdb-update.service
>   }
>   
>   do_install_ptest () {
> @@ -381,10 +385,18 @@ ALTERNATIVE_PRIORITY[runlevel] ?= "300"
>   
>   pkg_postinst_udev-hwdb () {
>   	if test -n "$D"; then
> -		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> -			--root $D
> +		if ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> +			--root $D; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	else
> -		udevadm hwdb --update
> +		if udevadm hwdb --update; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	fi
>   }
>   



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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-07-24  6:18 ` ChenQi
@ 2015-08-10  2:07   ` Rongqing Li
  0 siblings, 0 replies; 7+ messages in thread
From: Rongqing Li @ 2015-08-10  2:07 UTC (permalink / raw)
  To: ChenQi, openembedded-core



On 2015年07月24日 14:18, ChenQi wrote:
> ping
>
> Anybody has objection for this one?
>
> Best Regards,
> Chen Qi

ping

-R

>
> On 06/30/2015 01:16 PM, rongqing.li@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> The new version of systemd has implemented the following feature.
>> Opointer.de/blog/projects/stateless.html
>>
>> As a result, the systemd-udev-hwdb-update.service would always run
>> at first boot. This will cause failure if the target device doesn't
>> have enough storage space. Besides, as we run `udevadm hwdb --update' as
>> a postinst of udev-hwdb at rootfs time, there's no need to run this
>> again at system start-up.
>>
>> The purpose of this patch is as follows.
>> If `udev hwdb --update' fails at rootfs time,
>> systemd-udev-hwdb-update.service
>> is executed at first boot; otherwise, the service is not executed.
>>
>> This patch achieves the above goal by setting CondistonNeedsUpdate to
>> "/etc/udev" in the service file, and creating /etc/udev/.updated file
>> if the
>> postinst succeeds.
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/recipes-core/systemd/systemd_219.bb | 18 +++++++++++++++---
>>   1 file changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-core/systemd/systemd_219.bb
>> b/meta/recipes-core/systemd/systemd_219.bb
>> index 6ed4fe0..dc5c7b3 100644
>> --- a/meta/recipes-core/systemd/systemd_219.bb
>> +++ b/meta/recipes-core/systemd/systemd_219.bb
>> @@ -180,6 +180,10 @@ do_install() {
>>       if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
>>           ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed
>> -i -e "\$ad /run/systemd/netif/links 0755 root root -"
>> ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
>>       fi
>> +
>> +    # Make systemd-udev-hwdb-update to check /etc/udev
>> +    cp ${D}${systemd_unitdir}/system/systemd-udev-hwdb-update.service
>> ${D}${sysconfdir}/systemd/system
>> +    sed -i -e
>> 's#ConditionNeedsUpdate=/etc#ConditionNeedsUpdate=/etc/udev#g'
>> ${D}${sysconfdir}/systemd/system/systemd-udev-hwdb-update.service
>>   }
>>   do_install_ptest () {
>> @@ -381,10 +385,18 @@ ALTERNATIVE_PRIORITY[runlevel] ?= "300"
>>   pkg_postinst_udev-hwdb () {
>>       if test -n "$D"; then
>> -        ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb
>> --update \
>> -            --root $D
>> +        if ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')}
>> hwdb --update \
>> +            --root $D; then
>> +            touch $D/etc/udev/.updated
>> +        else
>> +            exit 1
>> +        fi
>>       else
>> -        udevadm hwdb --update
>> +        if udevadm hwdb --update; then
>> +            touch $D/etc/udev/.updated
>> +        else
>> +            exit 1
>> +        fi
>>       fi
>>   }
>

-- 
Best Reagrds,
Roy | RongQing Li


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

* Re: [PATCH] systemd: fix systemd-udev-hwdb-update service
  2015-06-30  5:16 [PATCH] systemd: fix systemd-udev-hwdb-update service rongqing.li
                   ` (2 preceding siblings ...)
  2015-07-24  6:18 ` ChenQi
@ 2015-08-19  1:48 ` ChenQi
  3 siblings, 0 replies; 7+ messages in thread
From: ChenQi @ 2015-08-19  1:48 UTC (permalink / raw)
  To: openembedded-core

ping

If we build core-image-minimal for qemux86-64 and start it with qemu, 
we'll see failure of this service without this patch.
Please consider merging this patch.

Regards,
Chen Qi

On 06/30/2015 01:16 PM, rongqing.li@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The new version of systemd has implemented the following feature.
> Opointer.de/blog/projects/stateless.html
>
> As a result, the systemd-udev-hwdb-update.service would always run
> at first boot. This will cause failure if the target device doesn't
> have enough storage space. Besides, as we run `udevadm hwdb --update' as
> a postinst of udev-hwdb at rootfs time, there's no need to run this
> again at system start-up.
>
> The purpose of this patch is as follows.
> If `udev hwdb --update' fails at rootfs time, systemd-udev-hwdb-update.service
> is executed at first boot; otherwise, the service is not executed.
>
> This patch achieves the above goal by setting CondistonNeedsUpdate to
> "/etc/udev" in the service file, and creating /etc/udev/.updated file if the
> postinst succeeds.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>   meta/recipes-core/systemd/systemd_219.bb | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb
> index 6ed4fe0..dc5c7b3 100644
> --- a/meta/recipes-core/systemd/systemd_219.bb
> +++ b/meta/recipes-core/systemd/systemd_219.bb
> @@ -180,6 +180,10 @@ do_install() {
>   	if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
>   		${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
>   	fi
> +
> +	# Make systemd-udev-hwdb-update to check /etc/udev
> +	cp ${D}${systemd_unitdir}/system/systemd-udev-hwdb-update.service ${D}${sysconfdir}/systemd/system
> +	sed -i -e 's#ConditionNeedsUpdate=/etc#ConditionNeedsUpdate=/etc/udev#g' ${D}${sysconfdir}/systemd/system/systemd-udev-hwdb-update.service
>   }
>   
>   do_install_ptest () {
> @@ -381,10 +385,18 @@ ALTERNATIVE_PRIORITY[runlevel] ?= "300"
>   
>   pkg_postinst_udev-hwdb () {
>   	if test -n "$D"; then
> -		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> -			--root $D
> +		if ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> +			--root $D; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	else
> -		udevadm hwdb --update
> +		if udevadm hwdb --update; then
> +			touch $D/etc/udev/.updated
> +		else
> +			exit 1
> +		fi
>   	fi
>   }
>   



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

end of thread, other threads:[~2015-08-19  1:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30  5:16 [PATCH] systemd: fix systemd-udev-hwdb-update service rongqing.li
2015-07-13  2:12 ` Rongqing Li
2015-07-13  5:00 ` Khem Raj
2015-07-13  6:54   ` ChenQi
2015-07-24  6:18 ` ChenQi
2015-08-10  2:07   ` Rongqing Li
2015-08-19  1:48 ` ChenQi

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