Skip to contentSkip to conversation

systemd: Ensure /run and /var/run are the same on R/O rootfs

PATCH New Jan Kundrát 4 participants 6 messages Feb 8, 2018 – Mar 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 systemd: Ensure /run and /var/run are the same on R/O rootfs

When I updated systemd from 234 to 237 and D-Bus from 1.12.0 to 1.12.2 on my system with a read-only rootfs (buildroot 1c0c55c028 to buildroot 27d2229692), my D-Bus-activated services stopped working. Checking the logs, it turned out that systemd PID 1 was not able to connect the D-Bus socket at all. There were some recent changes in systemd where upstream refactored code which waits for sockets to appear. However, the real problem is that systemd is configured to look for the D-Bus socket in /run/dbus, while D-Bus creates it at /var/run/dbus/. D-Bus upstream explains in a bugreport [1] that this "traditional" /var/run/dbus is going to stay because it's hardcoded in other independent implementations of the D-Bus APIs.

As is also said in that bugreport, the root cause is that /run and /var/run are effectively two separate directories on Buildroot -- at least when configured for a R/O rootfs. Furthermore, systemd actually actively warns about this:

systemd[1]: System is tainted: var-run-bad

Looking further, systemd-tmpfiles also detects breakage:

systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:12] Duplicate line for path "/var/run", ignoring. systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:21] Duplicate line for path "/var/lib", ignoring.

This change simply skips /var/run from being copied from the /usr/share/factory. The symlink is still created by another tmpfiles.d entry which belongs to systemd.

The other warnings are still in present:

systemd-tmpfiles[174]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. systemd-tmpfiles[174]: [/usr/lib/tmpfiles.d/var.conf:21] Duplicate line for path "/var/lib", ignoring.

I'm leaving that one to someone who is more familiar with systemd and buildroot conventions. My box now boots again, so I'm happy :).

[1] https://bugs.freedesktop.org/show_bug.cgi?id=101628

---
 package/skeleton-init-systemd/skeleton-init-systemd.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/skeleton-init-systemd/skeleton-init-systemd.mk +3 -1
index a2d4e8c4b3..95142904f5 100644
@@ -42,7 +42,9 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR
 	mkdir $(TARGET_DIR)/var
 	for i in $(TARGET_DIR)/usr/share/factory/var/*; do \
 		j="$${i#$(TARGET_DIR)/usr/share/factory}"; \
-		if [ -L "$${i}" ]; then \
+		if [ "$${j}" = "/var/run" ]; then \
+			echo "# $${j} is being handled by systemd"
+		elif [ -L "$${i}" ]; then \
 			printf "L+! %s - - - - %s\n" \
 				"$${j}" "../usr/share/factory/$${j}" \
 			|| exit 1; \
Signature · 1 line
2.14.3
#1 lore raw

PATCH 2/3 package/libgpiod: Bump to stable 1.0

According to upstream, this one has non-backward-compatible API changes, so porting of end users' code will be required. On the other hand, the library also got a stable API now.

---
 package/libgpiod/libgpiod.hash | 2 +-
 package/libgpiod/libgpiod.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/libgpiod/libgpiod.hash +1 -1
index 73150dc9b9..a98e138fa4 100644
@@ -1,2 +1,2 @@
 # From https://www.kernel.org/pub/software/libs/libgpiod/sha256sums.asc
-sha256 50c7862428ca90b58672e2475aea66d33a6fc86c6bab1928c0660f3aedf44a37  libgpiod-0.3.2.tar.xz
+sha256 34c76b3730b9d4a1159bcb14000f78b1e890251b8a3823b794fa930654eabdd0  libgpiod-1.0.tar.xz
package/libgpiod/libgpiod.mk +1 -1
index bc2e51d280..598adcc599 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-LIBGPIOD_VERSION = 0.3.2
+LIBGPIOD_VERSION = 1.0
 LIBGPIOD_SOURCE = libgpiod-$(LIBGPIOD_VERSION).tar.xz
 LIBGPIOD_SITE = https://www.kernel.org/pub/software/libs/libgpiod
 LIBGPIOD_LICENSE = LGPL-2.1+
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/3 package/libgpiod: Bump to stable 1.0

Hi Jan,

Quoted 5 lines · Jan Kundr?t

According to upstream, this one has non-backward-compatible API changes, so porting of end users' code will be required. On the other hand, the library also got a stable API now.

The libgpiod maintainer has posted a bump patch yesterday.

http://patchwork.ozlabs.org/patch/870463/

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH 3/3 package/rauc: Version bump to 0.3

In reply to Jan Kundrát

There's a bug in 0.2 which prevents proper operation when activated via D-Bus, which is why I'm bumping this.

---
 package/rauc/rauc.hash | 4 ++--
 package/rauc/rauc.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
package/rauc/rauc.hash +2 -2
index 649d19571e..91d7c1d62e 100644
@@ -1,3 +1,3 @@
 # Locally calculated, after verifying against
-# https://github.com/rauc/rauc/releases/download/v0.2/rauc-0.2.tar.xz.asc
-sha256 83aa3ac3716e1c29315162e3cbf5d4db79f26dd95efe1bc634bbce364b95491a rauc-0.2.tar.xz
+# https://github.com/rauc/rauc/releases/download/v0.3/rauc-0.3.tar.xz.asc
+sha256 dc01bfb08b1830376782f9a51cfec290171519267ab97cc909435da9ac6d6d98 rauc-0.3.tar.xz
package/rauc/rauc.mk +1 -1
index 4909062cf5..63fbc53022 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-RAUC_VERSION = 0.2
+RAUC_VERSION = 0.3
 RAUC_SITE = https://github.com/rauc/rauc/releases/download/v$(RAUC_VERSION)
 RAUC_SOURCE = rauc-$(RAUC_VERSION).tar.xz
 RAUC_LICENSE = LGPL-2.1
Signature · 1 line
2.14.3
#4 lore raw

PATCH 3/3 package/rauc: Version bump to 0.3

Hello,

Quoted 9 lines · Jan Kundr?t

There's a bug in 0.2 which prevents proper operation when activated via D-Bus, which is why I'm bumping this.

---
 package/rauc/rauc.hash | 4 ++--
 package/rauc/rauc.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 1/3 systemd: Ensure /run and /var/run are the same on R/O rootfs

In reply to Jan Kundrát

Jan, All,

On 2018-02-08 12:22 +0100, Jan Kundr?t spake thusly:

Quoted 21 lines

When I updated systemd from 234 to 237 and D-Bus from 1.12.0 to 1.12.2 on my system with a read-only rootfs (buildroot 1c0c55c028 to buildroot 27d2229692), my D-Bus-activated services stopped working. Checking the logs, it turned out that systemd PID 1 was not able to connect the D-Bus socket at all. There were some recent changes in systemd where upstream refactored code which waits for sockets to appear. However, the real problem is that systemd is configured to look for the D-Bus socket in /run/dbus, while D-Bus creates it at /var/run/dbus/. D-Bus upstream explains in a bugreport [1] that this "traditional" /var/run/dbus is going to stay because it's hardcoded in other independent implementations of the D-Bus APIs.

As is also said in that bugreport, the root cause is that /run and /var/run are effectively two separate directories on Buildroot -- at least when configured for a R/O rootfs. Furthermore, systemd actually actively warns about this:

systemd[1]: System is tainted: var-run-bad

Looking further, systemd-tmpfiles also detects breakage:

Quoted 7 lines

systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:12] Duplicate line for path "/var/run", ignoring. systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. systemd-tmpfiles[172]: [/usr/lib/tmpfiles.d/var.conf:21] Duplicate line for path "/var/lib", ignoring.

This change simply skips /var/run from being copied from the /usr/share/factory. The symlink is still created by another tmpfiles.d entry which belongs to systemd.

We believe this issue has been fixed in antoher way with that patch:

6e5df928539 package/skeleton-systemd: invert factory logic

As thus, I've marked this patch as rejected.

If your use-case is still not fixed, please re-send it.

Thanks!

Regards,
Yann E. MORIN.

Quoted 38 lines

The other warnings are still in present:

systemd-tmpfiles[174]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. systemd-tmpfiles[174]: [/usr/lib/tmpfiles.d/var.conf:21] Duplicate line for path "/var/lib", ignoring.

I'm leaving that one to someone who is more familiar with systemd and buildroot conventions. My box now boots again, so I'm happy :).

[1] https://bugs.freedesktop.org/show_bug.cgi?id=101628

---
 package/skeleton-init-systemd/skeleton-init-systemd.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/skeleton-init-systemd/skeleton-init-systemd.mk +3 -1
index a2d4e8c4b3..95142904f5 100644
@@ -42,7 +42,9 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR
 	mkdir $(TARGET_DIR)/var
 	for i in $(TARGET_DIR)/usr/share/factory/var/*; do \
 		j="$${i#$(TARGET_DIR)/usr/share/factory}"; \
-		if [ -L "$${i}" ]; then \
+		if [ "$${j}" = "/var/run" ]; then \
+			echo "# $${j} is being handled by systemd"
+		elif [ -L "$${i}" ]; then \
 			printf "L+! %s - - - - %s\n" \
 				"$${j}" "../usr/share/factory/$${j}" \
 			|| exit 1; \
Signature · 7 lines
2.14.3


_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'