[Buildroot] [PATCH] package/skeleton-init-systemd: create a symlink /var/run to ../run
Trent Piepho
tpiepho at impinj.com
Fri Feb 23 18:25:38 UTC 2018
On Thu, 2018-02-22 at 23:10 +0100, Romain Naour wrote:
> As reported by Jérémy Rosen [1] and Jan Kundrát (RO case)[2], systemd
> looks for the dbus socket in /run/dbus instead of /var/run/dbus which
> is not where dbus puts the socket. This is a change introduced with
> the last version bump v237 [3].
>
> The file /usr/lib/tmpfiles.d/var.con will create automatically that
> symlink at bootup /var/run doesn't exist yet. But dbus creates, at
> install time, the directory /var/run/dbus without taking care of
> /var/run. So we end up with two different directories /run and
> /var/run. This bug affects more or less all systemd-provided
> utilities, including logind and systemd itself.
>
> This patch create the correct symlink run -> ../run when systemd
> is used as init system.
This doesn't work in the RO root case. I described this in another
mail to the list, but in the RO root case target/var is a symlink to
target/usr/share/factory/var. Thus this link is actually created as:
target/usr/share/factory/var/run -> ../run
It points to target/usr/share/factory/run, which is wrong. In order to
get it to work in the RO case, instead create this link.
define SKELETON_INIT_SYSTEMD_VAR_RUN_LINK
ln -sf ../../../../run $(TARGET_DIR)/usr/share/factory/var/run
endef
SKELETON_INIT_SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
SKELETON_INIT_SYSTEMD_VAR_RUN_LINK
Then you get a target that looks like this:
lrwxrwxrwx 1 root root 29 Feb 23 02:35 /var/run -> ../usr/share/factory//var/run
lrwxrwxrwx 1 root root 15 Feb 23 00:51 /usr/share/factory/var/run -> ../../../../run
On the target, /var/run ends up pointing to /run and also on the host
$TARGET_DIR/var/run points to $TARGET_DIR/run.
More information about the buildroot
mailing list