Skip to contentSkip to conversation

package/uboot-tools: create /var/lock directory for fw_printenv

PATCH New Anton Leontiev 4 participants 4 messages Oct 4, 2020 – Oct 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/uboot-tools: create /var/lock directory for fw_printenv

fw_setenv/fw_printenv create lock-files in /var/lock. If this directory doesn't exist tools fail with following error:

Error opening lock file /var/lock/fw_printenv.lock

---
 package/uboot-tools/uboot-tools.mk | 1 +
 1 file changed, 1 insertion(+)
package/uboot-tools/uboot-tools.mk +1 -0
index a06c25998f..578702f04e 100644
@@ -65,6 +65,7 @@ ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y)
 define UBOOT_TOOLS_INSTALL_FWPRINTENV
 	$(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv $(TARGET_DIR)/usr/sbin/fw_printenv
 	ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/var/lock
 endef
 endif
 
Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/1 package/uboot-tools: create /var/lock directory for fw_printenv

Hello Anton,

Thanks for your patch, I'm adding Norbert in Cc. See below for some comments.

Quoted 15 lines · On Sun, 4 Oct 2020 15:55:38 +0300 Anton Leontiev <[email protected]> wrote:

fw_setenv/fw_printenv create lock-files in /var/lock. If this directory doesn't exist tools fail with following error:

Error opening lock file /var/lock/fw_printenv.lock

---
 package/uboot-tools/uboot-tools.mk | 1 +
 1 file changed, 1 insertion(+)
package/uboot-tools/uboot-tools.mk +0 -0
index a06c25998f..578702f04e 100644

package/uboot-tools/uboot-tools.mk ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y) · line 68

Quoted 4 lines
package/uboot-tools/uboot-tools.mk +1 -0
@@ -65,6 +65,7 @@ ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y)
 define UBOOT_TOOLS_INSTALL_FWPRINTENV
 	$(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv $(TARGET_DIR)/usr/sbin/fw_printenv
 	ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/var/lock

Unfortunately, this cannot be the correct solution: the skeleton-init-sysv package already creates /var/lock, as a symlink to /tmp, so your patch would clash with that. So I suppose you have a systemd init?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/uboot-tools: create /var/lock directory for fw_printenv

systemd init will not create /run/lock and the /var/lock symlink anymore, this was caused by one of my changes. Still need some feedback for the correct solution

1) copy over the old legacy.conf. Patch is at [1]
(would be a quick temporary solution)
2) create a own buildroot.conf in the systemd-skeleton, adding those dirs there (and in the future potentially other stuff)
3) Add some variable BR_SKELETON_LOCKDIR that uboot-tools selects (aswell as sysv and busybox init)
Only do 1 or2 if that variable is set.

At any rate, systemd-tmpfiles tool should be mandatory for systemd.

And if there's the will to drop the legacy /var/lock directory, then packages like uboot-tools should be configured or
patched to use /run/lock, and that directory should exist for all init systems [2].

Norbert

[1] - https://patchwork.ozlabs.org/project/buildroot/list/?series=197464
[2] - https://patchwork.ozlabs.org/project/buildroot/list/?series=205918

Am Mi., 14. Okt. 2020 um 23:55 Uhr schrieb Thomas Petazzoni < [email protected]>:

Quoted 35 lines

Hello Anton,

Thanks for your patch, I'm adding Norbert in Cc. See below for some comments.

package/uboot-tools/

Quoted 11 lines · On Sun, 4 Oct 2020 15:55:38 +0300 Anton Leontiev <[email protected]> wrote:

fw_setenv/fw_printenv create lock-files in /var/lock. If this directory doesn't exist tools fail with following error:

Error opening lock file /var/lock/fw_printenv.lock

---
 package/uboot-tools/uboot-tools.mk | 1 +
 1 file changed, 1 insertion(+)
package/uboot-tools/ renamed from package/uboot-tools/uboot-tools.mk +0 -0

uboot-tools.mk

package/uboot-tools/uboot-tools.mk ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y) · line 66

Quoted 6 lines

index a06c25998f..578702f04e 100644

package/uboot-tools/uboot-tools.mk +0 -0
@@ -65,6 +65,7 @@ ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y)
 define UBOOT_TOOLS_INSTALL_FWPRINTENV
      $(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv

$(TARGET_DIR)/usr/sbin/fw_printenv

package/uboot-tools/uboot-tools.mk ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y) · line 68

Quoted 2 lines
package/uboot-tools/uboot-tools.mk +1 -0
      ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
+     $(INSTALL) -m 0755 -d $(TARGET_DIR)/var/lock

Unfortunately, this cannot be the correct solution: the skeleton-init-sysv package already creates /var/lock, as a symlink to /tmp, so your patch would clash with that. So I suppose you have a systemd init?

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20201015/52e126d3/attachment.html>

#3 lore raw

PATCH 1/1 package/uboot-tools: create /var/lock directory for fw_printenv

Hi,

Quoted 12 lines · Norbert Lange

systemd init will not create /run/lock and the /var/lock symlink anymore, this was caused by one of my changes. Still need some feedback for the correct solution

1) copy over the old legacy.conf. Patch is at [1]
? ? (would be a quick temporary solution)
2) create a own buildroot.conf in the systemd-skeleton, adding those dirs there (and in the future potentially other stuff)
3) Add some variable BR_SKELETON_LOCKDIR that uboot-tools selects (aswell as sysv and busybox init)
? ? Only do 1 or2 if that variable is set.

Quoted 2 lines

At any rate, systemd-tmpfiles tool should be mandatory for systemd.

I strongly agree with that. I don't see any good use case for systemd without it.

Quoted 4 lines

And if there's the will to drop the legacy /var/lock directory, then packages like?uboot-tools should?be configured or
patched to use /run/lock, and that directory should exist for all init systems [2].

I also stumbled into this issue when switching to 2020.08. And for now I have an additional tmpfiles directive.
Nevertheless I'm strongly in favor of patching u-boot. But I'm not sure how upstream sees it.

As "quickfix" I would tend to option 1. I saw it done elsewhere. But this would require tmpfiles...

Regards,
Michael