systemd: ensure tmpfiles.d/legacy.conf is installed
PATCH 1/1 systemd: ensure tmpfiles.d/legacy.conf is installed
Systemd doesn't install tmpfiles.d/legacy.conf when sysv compatiblity isn't enabled. This config sets up /var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.
--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +9 -1
@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef + SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOK define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)
Signature · 1 line
2.28.0
PATCH 1/1 systemd: ensure tmpfiles.d/legacy.conf is installed
Hello,
I'm adding Norbert Lange in Cc, since he has done quite a bit of systemd work in Buildroot recently. Norbert, could you review the below patch ?
Also, Norbert, I think it would be nice if you could add yourself in the DEVELOPERS file for package/systemd/. You have been very active recently in improving our systemd package, and it would be good to have someone review systemd related patches.
Thanks!
Thomas
Quoted 33 lines · On Mon, 24 Aug 2020 17:02:46 -0700 Joseph Kogut <[email protected]> wrote:
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +9
-1@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef + SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOK define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 systemd: ensure tmpfiles.d/legacy.conf is installed
Am Di., 25. Aug. 2020 um 10:43 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 50 lines
Hello,
I'm adding Norbert Lange in Cc, since he has done quite a bit of systemd work in Buildroot recently. Norbert, could you review the below patch ?
Also, Norbert, I think it would be nice if you could add yourself in the DEVELOPERS file for package/systemd/. You have been very active recently in improving our systemd package, and it would be good to have someone review systemd related patches.
Thanks!
Thomas
Quoted 31 lines · On Mon, 24 Aug 2020 17:02:46 -0700 Joseph Kogut <[email protected]> wrote:
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +9
-1@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef + SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOK
Quoted 9 lines
package/systemd/systemd.mk define SYSTEMD_INSTALL_MACHINEID_HOOK · line 529
Quoted 2 lines
package/systemd/systemd.mk +0
-0define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Not sure what I should add here, technically the patch is fine.
- Should BR support /var/lock?
Then probably adding you own buildroot.conf to one of the skeletons would be better (handle /var/lock and /var/run at a central spot)
If not, then patching out its uses should be the long-term goal. I am not sure I agree with Joseph that many packages use /var/lock, even less so if you use a systemd rootfs (only know of a few busybox and if-updown services that do).
Being the guy that spent time removing all those legacy files I am prolly biased then it comes to the right answer;
Norbert
PATCH 1/1 systemd: ensure tmpfiles.d/legacy.conf is installed
Hi Norbert,
Quoted 63 lines · Norbert Lange
Am Di., 25. Aug. 2020 um 10:43 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 50 lines
Hello,
I'm adding Norbert Lange in Cc, since he has done quite a bit of systemd work in Buildroot recently. Norbert, could you review the below patch ?
Also, Norbert, I think it would be nice if you could add yourself in the DEVELOPERS file for package/systemd/. You have been very active recently in improving our systemd package, and it would be good to have someone review systemd related patches.
Thanks!
Thomas
Quoted 31 lines · On Mon, 24 Aug 2020 17:02:46 -0700 Joseph Kogut <[email protected]> wrote:
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +9
-1@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef + SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOKQuoted 9 lines
package/systemd/systemd.mk define SYSTEMD_INSTALL_MACHINEID_HOOK · line 529
Quoted 2 lines
package/systemd/systemd.mk +0
-0define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Quoted 6 lines
Not sure what I should add here, technically the patch is fine.
- Should BR support
/var/lock?
Then probably adding you own buildroot.conf to one of the skeletons would be better (handle/var/lockand/var/runat a central spot)
I'm unfamiliar with any technical discussion around this. The Linux documentation [1] itself specifies that lock files should be stored at /var/lock. It seems odd to me that this path would be expected not to exist at all. Do you have any insight? I might add, this same approach was adopted by Arch Linux [2] some time ago.
Quoted 5 lines
If not, then patching out its uses should be the long-term goal. I am not sure I agree with Joseph that many packages use
/var/lock, even less so if you use a systemd rootfs (only know of a few busybox and if-updown services that do).
Admittedly, I'm not sure how many packages actually still use /var/lock. One would need to download and extract every package supported by buildroot to have an accurate picture. In my build directory, I grepped for it and found references in alsa-utils, busybox, linux-pam, and uboot-tools, the last of which this patch attempted to fix.
Would it be preferable to patch uboot-tools to default to /run/lock? What are the technical reasons for this? It seems equivalent to me to symlink /var/lock -> ../run/lock, and prevents applications which haven't yet been updated to use the new path from breaking inexplicably.
Quoted 4 lines
Being the guy that spent time removing all those legacy files I am prolly biased then it comes to the right answer;
Norbert
[1] https://www.kernel.org/doc/Documentation/admin-guide/devices.rst
[2] https://github.com/archlinux/svntogit-packages/blob/febacd7859ba2556df1122c89fcdc7383676514f/trunk/PKGBUILD#L195
PATCH 1/1 systemd: ensure tmpfiles.d/legacy.conf is installed
Am Mi., 26. Aug. 2020 um 03:51 Uhr schrieb Joseph Kogut <[email protected]>:
Quoted 74 lines
Hi Norbert,
Quoted 63 lines · Norbert Lange
Am Di., 25. Aug. 2020 um 10:43 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 50 lines
Hello,
I'm adding Norbert Lange in Cc, since he has done quite a bit of systemd work in Buildroot recently. Norbert, could you review the below patch ?
Also, Norbert, I think it would be nice if you could add yourself in the DEVELOPERS file for package/systemd/. You have been very active recently in improving our systemd package, and it would be good to have someone review systemd related patches.
Thanks!
Thomas
Quoted 31 lines · On Mon, 24 Aug 2020 17:02:46 -0700 Joseph Kogut <[email protected]> wrote:
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +9
-1@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef + SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOKQuoted 9 lines
package/systemd/systemd.mk define SYSTEMD_INSTALL_MACHINEID_HOOK · line 529
Quoted 2 lines
package/systemd/systemd.mk +0
-0define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.comQuoted 6 lines
Not sure what I should add here, technically the patch is fine.
- Should BR support
/var/lock?
Then probably adding you own buildroot.conf to one of the skeletons would be better (handle/var/lockand/var/runat a central spot)
Quoted 5 lines
I'm unfamiliar with any technical discussion around this. The Linux documentation [1] itself specifies that lock files should be stored at
/var/lock. It seems odd to me that this path would be expected not to exist at all. Do you have any insight? I might add, this same approach was adopted by Arch Linux [2] some time ago.
/run holds the runtime state, /var is a bad fit for locks, indicated by /var/lock
already being a symlink. Most distros use /run/lock as backing storage, aswell as systemd and openrc, see for ex. [1].
Nowadays you should use flock, those uucp locks for serial ports are a thing long past, it is weird that it's still in the Linux docs. For ex I dont know of any Linux related tools (util-linux, etc.) using lockfiles.
Note that the legacy.conf also creates the /var/run -> /run symlink, which is actually still often needed (even if it should go away aswell), and that Arch is a more "general" distro.
Said /var/run symlink comes from buildroot skeleton, and I would put /var/lock there too (solve it for all init systems). systemd-tmpfiles further can be disabled in
buildroot, I dont think thats a good idea and should be mandatory, but some action is necessary.
Quoted 14 lines
Quoted 6 lines
If not, then patching out its uses should be the long-term goal. I am not sure I agree with Joseph that many packages use
/var/lock, even less so if you use a systemd rootfs (only know of a few busybox and if-updown services that do).Admittedly, I'm not sure how many packages actually still use
/var/lock. One would need to download and extract every package supported by buildroot to have an accurate picture. In my build directory, I grepped for it and found references in alsa-utils, busybox, linux-pam, and uboot-tools, the last of which this patch attempted to fix.
Quoted 5 lines
Would it be preferable to patch uboot-tools to default to
/run/lock? What are the technical reasons for this? It seems equivalent to me to symlink/var/lock-> ../run/lock, and prevents applications which haven't yet been updated to use the new path from breaking inexplicably.
Yeah, it's a legacy workaround in other words. Question is, if everyone should be blessed with that workaround. BR also adds systemd service files instead of using upstream init scripts.
There are distros which have separate /run/lock and /var/lock directories, (thanks to FHS allowing this), so those apps don't really lock systemwide there.
And for a technical reason, you are needlessly depending on the blockdevice that's continuously written to.
Norbert
Quoted 8 lines
Quoted 5 lines
Being the guy that spent time removing all those legacy files I am prolly biased then it comes to the right answer;
Norbert
[1] https://www.kernel.org/doc/Documentation/admin-guide/devices.rst
[2] https://github.com/archlinux/svntogit-packages/blob/febacd7859ba2556df1122c89fcdc7383676514f/trunk/PKGBUILD#L195
Quoted 5 lines · Joseph Kogut
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>
After all the discussion, I did finally apply to master, thanks.
For Norbert: we simply have legacy packages that write to /var/lock instead of/run/lock. In an ideal world, we'd patch all of them to do the right thing. However, that's not realistic. So let's enable this legacy stuff to make sure that those legacy packages don't actually write to disk.
We could indeed instead enable sysv compatibility, for maximum support of
legacy packages. What exactly would be the effects of that?
Regards,
Arnout
Quoted 19 lines
--- package/systemd/systemd.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +6
-0@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK touch $(TARGET_DIR)/etc/machine-id endef +# systemd doesn't install legacy.conf without sysv-compat +# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef
package/systemd/systemd.mk define SYSTEMD_INSTALL_MACHINEID_HOOK · line 529
Quoted 10 lines
package/systemd/systemd.mk +3
-1+ SYSTEMD_POST_INSTALL_TARGET_HOOKS += \ SYSTEMD_INSTALL_INIT_HOOK \ SYSTEMD_INSTALL_MACHINEID_HOOK \ - SYSTEMD_INSTALL_RESOLVCONF_HOOK + SYSTEMD_INSTALL_RESOLVCONF_HOOK \ + SYSTEMD_INSTALL_LEGACY_CONF_HOOK define SYSTEMD_INSTALL_IMAGES_CMDS $(SYSTEMD_INSTALL_BOOT_FILES)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 10 lines · Arnout Vandecappelle
Quoted 5 lines · Joseph Kogut
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>After all the discussion, I did finally apply to master, thanks.
And I ended up reverting it again - legacy.conf is now legacy.conf.in and it needs to be preprocessed, but that is only done if sysv-compat is enabled.
So if we want this, our only option is to enable sysv-compat (which is probably something we should do anyway).
Regards,
Arnout
Quoted 28 lines
For Norbert: we simply have legacy packages that write to
/var/lockinstead of/run/lock. In an ideal world, we'd patch all of them to do the right thing. However, that's not realistic. So let's enable this legacy stuff to make sure that those legacy packages don't actually write to disk.We could indeed instead enable sysv compatibility, for maximum support of legacy packages. What exactly would be the effects of that?
Regards,
ArnoutQuoted 19 lines
---
package/systemd/systemd.mk| 10 +++++++++-1 file changed, 9 insertions(+), 1 deletion(-)package/systemd/systemd.mk +0
-0@@ -512,10 +512,18 @@ define SYSTEMD_INSTALL_MACHINEID_HOOKtouch $(TARGET_DIR)/etc/machine-id
endef
+# systemd doesn't install legacy.conf without sysv-compatpackage/systemd/systemd.mk +6
-0+# This config ensures /var/lock is created +define SYSTEMD_INSTALL_LEGACY_CONF_HOOK + $(INSTALL) -D -m 0644 $(@D)/tmpfiles.d/legacy.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d +endef +
SYSTEMD_POST_INSTALL_TARGET_HOOKS+= \
Quoted 8 lines
Quoted 8 lines
SYSTEMD_INSTALL_INIT_HOOK\
SYSTEMD_INSTALL_MACHINEID_HOOK\
-SYSTEMD_INSTALL_RESOLVCONF_HOOK
+SYSTEMD_INSTALL_RESOLVCONF_HOOK\
+SYSTEMD_INSTALL_LEGACY_CONF_HOOK
defineSYSTEMD_INSTALL_IMAGES_CMDS
$(SYSTEMD_INSTALL_BOOT_FILES)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Am Sa., 8. Jan. 2022 um 21:40 Uhr schrieb Arnout Vandecappelle <[email protected]>:
Quoted 12 lines · Arnout Vandecappelle
Quoted 9 lines · Joseph Kogut
Quoted 5 lines
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>
Quoted 7 lines
Quoted 1 line
After all the discussion, I did finally apply to master, thanks.
And I ended up reverting it again - legacy.conf is now legacy.conf.in and it
needs to be preprocessed, but that is only done if sysv-compat is enabled.So if we want this, our only option is to enable sysv-compat (which is
probably something we should do anyway).
Why the only option? you should just ship your own legacy.conf, it wont change. Adding sysv compatibility, which is alot more than just the mkdir and symlink, would mean adding alot baggage.
Baggage that wont even work as Yann spake thusly [1]
a tmpfile.conf with those 3 lines would be enough:
d /run/lock 0755 root root -
L /var/lock - - - - ../run/lock
d /run/lock/subsys 0755 root root -
Norbert.
PS. I am too lazy to google everything up, but I believe I brought up this very topic before.
[1] - https://lists.buildroot.org/pipermail/buildroot/2020-July/287275.html
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 15 lines · Norbert Lange
Am Sa., 8. Jan. 2022 um 21:40 Uhr schrieb Arnout Vandecappelle <[email protected]>:
Quoted 14 lines · Arnout Vandecappelle
Quoted 10 lines · Joseph Kogut
Quoted 5 lines
Systemd doesn't install
tmpfiles.d/legacy.confwhen sysv compatiblity isn't enabled. This config sets up/var/lock, which many programs such as uboot's fw_printenv/setenv still depend on by default.Signed-off-by Joseph Kogut <[email protected]>After all the discussion, I did finally apply to master, thanks.
Quoted 7 lines
Quoted 5 lines
And I ended up reverting it again - legacy.conf is now legacy.conf.in and it
needs to be preprocessed, but that is only done if sysv-compat is enabled.So if we want this, our only option is to enable sysv-compat (which is
probably something we should do anyway).Why the only option? you should just ship your own legacy.conf, it wont change.
I meant: if we want to use the legacy.conf from upstream. But you're right
it's not the only option, we could also manually sed out stuff from the .in file.
Quoted 2 lines
Adding sysv compatibility, which is alot more than just the mkdir and symlink, would mean adding alot baggage.
Ack.
Quoted 6 lines
Baggage that wont even work as Yann spake thusly [1]
a tmpfile.conf with those 3 lines would be enough:
d/run/lock0755 root root -
L/var/lock- - - - ../run/lock
d/run/lock/subsys0755 root root -
All right, I hope I remember this by the time a see the patch :-)
Quoted 5 lines
Norbert.
PS. I am too lazy to google everything up, but I believe I brought up this very topic before.
I'm also too lazy to google it.
Regards,
Arnout
Quoted 3 lines
[1] - https://lists.buildroot.org/pipermail/buildroot/2020-July/287275.html
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot