Skip to contentSkip to conversation

package/systemd: fix dbus activation

PATCH Superseded Gabe Evans 3 participants 6 messages Feb 8, 2016 – Feb 14, 2016

lore
Share & tools
lore

Gabe Evans

author
#0 lore raw

PATCH 1/1 package/systemd: fix dbus activation

Various DBus activated services fail to start with errors similar to:

Unit dbus-org.freedesktop.hostname1.service failed to load: File exists.

The message itself is rather vague and can be seen as a warning in systemd-networkd logs. Meanwhile, tools like hostnamectl don't work at all.

The post-install target hook SYSTEMD_SANITIZE_PATH_IN_UNITS was replacing symlinks with duplicate files. The sed command could have used --follow-symlinks to avoid this but I instead chose to remove the hook since this fix doesn't seem to be needed anymore.

Some configure options are also removed:

* --with-dbuspolicydir, --with-dbussessionservicedir, and --with-dbussystemservicedir are no longer needed since these are defaults in recent releases.

* --disable-dbus has no effect when combined with --disable-tests. The option itself only applies to tests, not the runtime.

---
 package/systemd/systemd.mk | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
package/systemd/systemd.mk +1 -11
index e432069..05121cf 100644
@@ -32,14 +32,10 @@ SYSTEMD_CONF_OPTS += \
 	--disable-selinux \
 	--disable-pam \
 	--disable-libcryptsetup \
-	--with-dbuspolicydir=/etc/dbus-1/system.d \
-	--with-dbussessionservicedir=/usr/share/dbus-1/services \
-	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
 	--disable-efi \
 	--disable-gnuefi \
 	--disable-ldconfig \
 	--disable-tests \
-	--disable-dbus \
 	--without-python
 
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
@@ -150,16 +146,10 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
 	touch $(TARGET_DIR)/etc/machine-id
 endef
 
-define SYSTEMD_SANITIZE_PATH_IN_UNITS
-	find $(TARGET_DIR)/lib/systemd/system -name '*.service' \
-		-exec $(SED) 's,$(HOST_DIR),,g' {} \;
-endef
-
 SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
 	SYSTEMD_INSTALL_INIT_HOOK \
 	SYSTEMD_INSTALL_MACHINEID_HOOK \
-	SYSTEMD_INSTALL_RESOLVCONF_HOOK \
-	SYSTEMD_SANITIZE_PATH_IN_UNITS
+	SYSTEMD_INSTALL_RESOLVCONF_HOOK
 
 define SYSTEMD_USERS
 	systemd-journal -1 systemd-journal -1 * /var/log/journal - - Journal
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 package/systemd: fix dbus activation

Quoted 11 lines · Gabe Evans

Various DBus activated services fail to start with errors similar to:

Unit dbus-org.freedesktop.hostname1.service failed to load: File exists.

The message itself is rather vague and can be seen as a warning in systemd-networkd logs. Meanwhile, tools like hostnamectl don't work at all.

The post-install target hook SYSTEMD_SANITIZE_PATH_IN_UNITS was replacing symlinks with duplicate files. The sed command could have used --follow-symlinks to avoid this

Or better yet, add -type f to the find command.

Quoted 11 lines

but I instead chose to remove the hook
since this fix doesn't seem to be needed anymore.

Some configure options are also removed:

* --with-dbuspolicydir, --with-dbussessionservicedir, and --with-dbussystemservicedir are no longer needed since these are defaults in recent releases.

* --disable-dbus has no effect when combined with --disable-tests. The option itself only applies to tests, not the runtime.

This part really should have been in a separate patch, with as subject
"systemd: remove redundant configure options".

Still, this patch gets my

(checked that there is not HOST_DIR reference and that the dbus paths are still
correct).

If you repost as two patches, you can carry my acked/tested tags.

Regards,
Arnout

Quoted 44 lines
---
 package/systemd/systemd.mk | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
package/systemd/systemd.mk +1 -11
index e432069..05121cf 100644
@@ -32,14 +32,10 @@ SYSTEMD_CONF_OPTS += \
 	--disable-selinux \
 	--disable-pam \
 	--disable-libcryptsetup \
-	--with-dbuspolicydir=/etc/dbus-1/system.d \
-	--with-dbussessionservicedir=/usr/share/dbus-1/services \
-	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
 	--disable-efi \
 	--disable-gnuefi \
 	--disable-ldconfig \
 	--disable-tests \
-	--disable-dbus \
 	--without-python
 
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
@@ -150,16 +146,10 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
 	touch $(TARGET_DIR)/etc/machine-id
 endef
 
-define SYSTEMD_SANITIZE_PATH_IN_UNITS
-	find $(TARGET_DIR)/lib/systemd/system -name '*.service' \
-		-exec $(SED) 's,$(HOST_DIR),,g' {} \;
-endef
-
 SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
 	SYSTEMD_INSTALL_INIT_HOOK \
 	SYSTEMD_INSTALL_MACHINEID_HOOK \
-	SYSTEMD_INSTALL_RESOLVCONF_HOOK \
-	SYSTEMD_SANITIZE_PATH_IN_UNITS
+	SYSTEMD_INSTALL_RESOLVCONF_HOOK
 
 define SYSTEMD_USERS
 	systemd-journal -1 systemd-journal -1 * /var/log/journal - - Journal
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
author
#2 lore raw

PATCH 1/1 package/systemd: fix dbus activation

Hi Arnout,

Quoted 10 lines · Arnout Vandecappelle
Quoted 3 lines · Gabe Evans

Various DBus activated services fail to start with errors similar to:

Unit dbus-org.freedesktop.hostname1.service failed to load: File

exists.

Quoted 5 lines

The message itself is rather vague and can be seen as a warning in systemd-networkd logs. Meanwhile, tools like hostnamectl don't work at all.

Quoted 6 lines
Quoted 3 lines

The post-install target hook SYSTEMD_SANITIZE_PATH_IN_UNITS was replacing symlinks with duplicate files. The sed command could have used --follow-symlinks to avoid this

Or better yet, add -type f to the find command.

Right! I might have been suffering from some tunnel vision while figuring this out.

Quoted 19 lines
Quoted 4 lines

but I instead chose to remove the hook
since this fix doesn't seem to be needed anymore.

Quoted 8 lines

Some configure options are also removed:

* --with-dbuspolicydir, --with-dbussessionservicedir, and --with-dbussystemservicedir are no longer needed since these are defaults in recent releases.

* --disable-dbus has no effect when combined with --disable-tests. The option itself only applies to tests, not the runtime.

This part really should have been in a separate patch, with as subject
"systemd: remove redundant configure options".

Still, this patch gets my

Quoted 9 lines

(checked that there is not HOST_DIR reference and that the dbus paths are
still
correct).

If you repost as two patches, you can carry my acked/tested tags.

Thanks for your feedback. I'll split this up and send v2 when I have some free time.

Thanks,
Gabe

Quoted 59 lines

Regards,
Arnout

Quoted 33 lines
---
 package/systemd/systemd.mk | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
package/systemd/systemd.mk +0 -8
index e432069..05121cf 100644
@@ -32,14 +32,10 @@ SYSTEMD_CONF_OPTS += \
      --disable-selinux \
      --disable-pam \
      --disable-libcryptsetup \
-     --with-dbuspolicydir=/etc/dbus-1/system.d \
-     --with-dbussessionservicedir=/usr/share/dbus-1/services \
-     --with-dbussystemservicedir=/usr/share/dbus-1/system-services \
      --disable-efi \
      --disable-gnuefi \
      --disable-ldconfig \
      --disable-tests \
-     --disable-dbus \
      --without-python
 
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
@@ -150,16 +146,10 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
      touch $(TARGET_DIR)/etc/machine-id
 endef
 
-define SYSTEMD_SANITIZE_PATH_IN_UNITS
-     find $(TARGET_DIR)/lib/systemd/system -name '*.service' \
-             -exec $(SED) 's,$(HOST_DIR),,g' {} \;
-endef

package/systemd/systemd.mk define SYSTEMD_INSTALL_MACHINEID_HOOK · line 155

Quoted 10 lines
package/systemd/systemd.mk +1 -3
-
 SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
      SYSTEMD_INSTALL_INIT_HOOK \
      SYSTEMD_INSTALL_MACHINEID_HOOK \
-     SYSTEMD_INSTALL_RESOLVCONF_HOOK \
-     SYSTEMD_SANITIZE_PATH_IN_UNITS
+     SYSTEMD_INSTALL_RESOLVCONF_HOOK
 
 define SYSTEMD_USERS
      systemd-journal -1 systemd-journal -1 * /var/log/journal - -

Journal

Quoted 1 line

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 5 lines
Gabe Evans | Co-Founder & CTO
hashrabbit.co ? angel.co/hashrabbit ? github.com/gevans
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160210/5f82d4fe/attachment.html>
author
#3 lore raw

PATCH v2 1/2 systemd: fix dbus activation

In reply to Gabe Evans

Various DBus activated services fail to start with errors similar to:

Unit dbus-org.freedesktop.hostname1.service failed to load: File exists.

The message itself is rather vague and can be seen as a warning in systemd-networkd logs. Meanwhile, tools like hostnamectl don't work at all.

The post-install target hook SYSTEMD_SANITIZE_PATH_IN_UNITS was replacing symlinks with duplicate files. The find command could have used -type f to avoid this but I instead chose to remove the hook since this fix doesn't seem to be needed anymore.

---
Changes v1 -> v2:
- split changes into two separate commits (suggested by Arnout)

---
 package/systemd/systemd.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
package/systemd/systemd.mk +1 -7
index e432069..2340963 100644
@@ -150,16 +150,10 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
 	touch $(TARGET_DIR)/etc/machine-id
 endef
 
-define SYSTEMD_SANITIZE_PATH_IN_UNITS
-	find $(TARGET_DIR)/lib/systemd/system -name '*.service' \
-		-exec $(SED) 's,$(HOST_DIR),,g' {} \;
-endef
-
 SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
 	SYSTEMD_INSTALL_INIT_HOOK \
 	SYSTEMD_INSTALL_MACHINEID_HOOK \
-	SYSTEMD_INSTALL_RESOLVCONF_HOOK \
-	SYSTEMD_SANITIZE_PATH_IN_UNITS
+	SYSTEMD_INSTALL_RESOLVCONF_HOOK
 
 define SYSTEMD_USERS
 	systemd-journal -1 systemd-journal -1 * /var/log/journal - - Journal
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v2 2/2 systemd: remove redundant configure options

* --with-dbuspolicydir, --with-dbussessionservicedir, and --with-dbussystemservicedir are no longer needed since these are defaults in recent releases.

* --disable-dbus has no effect when combined with --disable-tests. The option itself only applies to tests, not the runtime.

---
Changes v1 -> v2:
- split changes into two separate commits (suggested by Arnout)

---
 package/systemd/systemd.mk | 4 ----
 1 file changed, 4 deletions(-)
package/systemd/systemd.mk +0 -4
index 2340963..05121cf 100644
@@ -32,14 +32,10 @@ SYSTEMD_CONF_OPTS += \
 	--disable-selinux \
 	--disable-pam \
 	--disable-libcryptsetup \
-	--with-dbuspolicydir=/etc/dbus-1/system.d \
-	--with-dbussessionservicedir=/usr/share/dbus-1/services \
-	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
 	--disable-efi \
 	--disable-gnuefi \
 	--disable-ldconfig \
 	--disable-tests \
-	--disable-dbus \
 	--without-python
 
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 1/2 systemd: fix dbus activation

In reply to Gabe Evans

Dear Gabe Evans,

Quoted 16 lines · Gabe Evans

Various DBus activated services fail to start with errors similar to:

Unit dbus-org.freedesktop.hostname1.service failed to load: File exists.

The message itself is rather vague and can be seen as a warning in systemd-networkd logs. Meanwhile, tools like hostnamectl don't work at all.

The post-install target hook SYSTEMD_SANITIZE_PATH_IN_UNITS was replacing symlinks with duplicate files. The find command could have used -type f to avoid this but I instead chose to remove the hook since this fix doesn't seem to be needed anymore.

Quoted 6 lines

---
Changes v1 -> v2:
- split changes into two separate commits (suggested by Arnout)

---
 package/systemd/systemd.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Both applied to master, thanks!

Thomas

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