* [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks
@ 2020-10-04 22:41 Norbert Lange
2022-01-09 10:29 ` Arnout Vandecappelle
2022-01-12 8:14 ` Thomas Petazzoni
0 siblings, 2 replies; 5+ messages in thread
From: Norbert Lange @ 2020-10-04 22:41 UTC (permalink / raw)
To: buildroot
Linux distros changed /var/run and /var/lock to reside on an tmpfs in
/run a long time ago, and buildroot seems to agree by providing this
tmpfs on all supported init systems.
Packages on the other hand are currently free to either use /var/run
or /run, and similarly using /var/lock should be identical to the
replacement /run/lock.
This series aims to ensure that *if* /var/lock is needed, then
it will be a symlink to /run/lock. Allowing packages to continue
working and allowing them to migrate to using /run/lock.
If all relevant packages are fixed,
the compatibility symlinks in /var can be dropped.
Status before this patch:
* Systemd
/run will be mounted by PID1, /var/run will be recreated by
/usr/lib/tmpfiles.d/var.conf.
Creating /run/lock/subsys and the compatibility symlink is handled
in /usr/lib/tmpfiles.d/legacy.conf.
But this is *currently not installed* by Buildroot, see [1].
* OpenRC
Seems to check for existence of a /run directory and does all
necessary setup.
* SysV
/var/lock is currently a symlink to /tmp.
* Busybox
Same as sysv (Buildroot uses the sysv skeleton)
Note that we create /run/lock/subsys, so sysv scrips could expect this
directory to exist. Apart from simplifying scripts, creating the dir
early as root adds some security.
Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
package/busybox/inittab | 1 +
package/skeleton-init-openrc/skeleton/var/lock | 2 +-
package/skeleton-init-sysv/skeleton/var/lock | 2 +-
package/sysvinit/inittab | 13 +++++++------
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/package/busybox/inittab b/package/busybox/inittab
index ff1725c775..f2b4df801b 100644
--- a/package/busybox/inittab
+++ b/package/busybox/inittab
@@ -18,6 +18,7 @@
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
::sysinit:/bin/mount -a
+::sysinit:/bin/mkdir -p /run/lock/subsys
::sysinit:/sbin/swapon -a
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
diff --git a/package/skeleton-init-openrc/skeleton/var/lock b/package/skeleton-init-openrc/skeleton/var/lock
index 1431b0e432..386c09e727 120000
--- a/package/skeleton-init-openrc/skeleton/var/lock
+++ b/package/skeleton-init-openrc/skeleton/var/lock
@@ -1 +1 @@
-../tmp
\ No newline at end of file
+../run/lock
\ No newline at end of file
diff --git a/package/skeleton-init-sysv/skeleton/var/lock b/package/skeleton-init-sysv/skeleton/var/lock
index 1431b0e432..386c09e727 120000
--- a/package/skeleton-init-sysv/skeleton/var/lock
+++ b/package/skeleton-init-sysv/skeleton/var/lock
@@ -1 +1 @@
-../tmp
\ No newline at end of file
+../run/lock
\ No newline at end of file
diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab
index a31471031f..afc28e6c03 100644
--- a/package/sysvinit/inittab
+++ b/package/sysvinit/inittab
@@ -8,12 +8,13 @@ si0::sysinit:/bin/mount -t proc proc /proc
si1::sysinit:/bin/mount -o remount,rw /
si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm
si3::sysinit:/bin/mount -a
-si4::sysinit:/sbin/swapon -a
-si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
-si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
-si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
-si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null
-si9::sysinit:/bin/hostname -F /etc/hostname
+si4::sysinit:/bin/mkdir -p /run/lock/subsys
+si5::sysinit:/sbin/swapon -a
+si6::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
+si7::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
+si8::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
+si9::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null
+si10::sysinit:/bin/hostname -F /etc/hostname
rcS:12345:wait:/etc/init.d/rcS
# S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks
2020-10-04 22:41 [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks Norbert Lange
@ 2022-01-09 10:29 ` Arnout Vandecappelle
2022-01-12 8:14 ` Thomas Petazzoni
1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2022-01-09 10:29 UTC (permalink / raw)
To: Norbert Lange, buildroot
Cc: joseph.kogut, Adam Duskett, Michał Łyszczek
On 05/10/2020 00:41, Norbert Lange wrote:
> Linux distros changed /var/run and /var/lock to reside on an tmpfs in
> /run a long time ago, and buildroot seems to agree by providing this
> tmpfs on all supported init systems.
>
> Packages on the other hand are currently free to either use /var/run
> or /run, and similarly using /var/lock should be identical to the
> replacement /run/lock.
>
> This series aims to ensure that *if* /var/lock is needed, then
> it will be a symlink to /run/lock. Allowing packages to continue
> working and allowing them to migrate to using /run/lock.
>
> If all relevant packages are fixed,
> the compatibility symlinks in /var can be dropped.
>
> Status before this patch:
>
> * Systemd
>
> /run will be mounted by PID1, /var/run will be recreated by
> /usr/lib/tmpfiles.d/var.conf.
>
> Creating /run/lock/subsys and the compatibility symlink is handled
> in /usr/lib/tmpfiles.d/legacy.conf.
> But this is *currently not installed* by Buildroot, see [1].
>
> * OpenRC
>
> Seems to check for existence of a /run directory and does all
> necessary setup.
>
> * SysV
>
> /var/lock is currently a symlink to /tmp.
>
> * Busybox
>
> Same as sysv (Buildroot uses the sysv skeleton)
>
> Note that we create /run/lock/subsys, so sysv scrips could expect this
> directory to exist. Apart from simplifying scripts, creating the dir
> early as root adds some security.
>
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
Applied to master, thanks.
Regards,
Arnout
> ---
> package/busybox/inittab | 1 +
> package/skeleton-init-openrc/skeleton/var/lock | 2 +-
> package/skeleton-init-sysv/skeleton/var/lock | 2 +-
> package/sysvinit/inittab | 13 +++++++------
> 4 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/package/busybox/inittab b/package/busybox/inittab
> index ff1725c775..f2b4df801b 100644
> --- a/package/busybox/inittab
> +++ b/package/busybox/inittab
> @@ -18,6 +18,7 @@
> ::sysinit:/bin/mount -o remount,rw /
> ::sysinit:/bin/mkdir -p /dev/pts /dev/shm
> ::sysinit:/bin/mount -a
> +::sysinit:/bin/mkdir -p /run/lock/subsys
> ::sysinit:/sbin/swapon -a
> null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
> null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
> diff --git a/package/skeleton-init-openrc/skeleton/var/lock b/package/skeleton-init-openrc/skeleton/var/lock
> index 1431b0e432..386c09e727 120000
> --- a/package/skeleton-init-openrc/skeleton/var/lock
> +++ b/package/skeleton-init-openrc/skeleton/var/lock
> @@ -1 +1 @@
> -../tmp
> \ No newline at end of file
> +../run/lock
> \ No newline at end of file
> diff --git a/package/skeleton-init-sysv/skeleton/var/lock b/package/skeleton-init-sysv/skeleton/var/lock
> index 1431b0e432..386c09e727 120000
> --- a/package/skeleton-init-sysv/skeleton/var/lock
> +++ b/package/skeleton-init-sysv/skeleton/var/lock
> @@ -1 +1 @@
> -../tmp
> \ No newline at end of file
> +../run/lock
> \ No newline at end of file
> diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab
> index a31471031f..afc28e6c03 100644
> --- a/package/sysvinit/inittab
> +++ b/package/sysvinit/inittab
> @@ -8,12 +8,13 @@ si0::sysinit:/bin/mount -t proc proc /proc
> si1::sysinit:/bin/mount -o remount,rw /
> si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm
> si3::sysinit:/bin/mount -a
> -si4::sysinit:/sbin/swapon -a
> -si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
> -si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
> -si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
> -si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null
> -si9::sysinit:/bin/hostname -F /etc/hostname
> +si4::sysinit:/bin/mkdir -p /run/lock/subsys
> +si5::sysinit:/sbin/swapon -a
> +si6::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
> +si7::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
> +si8::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
> +si9::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null
> +si10::sysinit:/bin/hostname -F /etc/hostname
> rcS:12345:wait:/etc/init.d/rcS
>
> # S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks
2020-10-04 22:41 [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks Norbert Lange
2022-01-09 10:29 ` Arnout Vandecappelle
@ 2022-01-12 8:14 ` Thomas Petazzoni
2022-01-12 8:53 ` Norbert Lange
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2022-01-12 8:14 UTC (permalink / raw)
To: Norbert Lange
Cc: joseph.kogut, Adam Duskett, Michał Łyszczek, buildroot
Hello Norbert,
On Mon, 5 Oct 2020 00:41:36 +0200
Norbert Lange <nolange79@gmail.com> wrote:
> Linux distros changed /var/run and /var/lock to reside on an tmpfs in
> /run a long time ago, and buildroot seems to agree by providing this
> tmpfs on all supported init systems.
I am not 100% sure but it seems like this patch has potentially broken
the build of vtun, which now fails with:
/usr/bin/install: cannot create directory '/home/giuliobenetti/autobuild/run/instance-0/output-1/target/var/lock': File exists
If you look at http://autobuild.buildroot.net/?reason=vtun%, vtun
version 3.0.4 restarted failing to build on January 10, with this error.
Could you have a look ?
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks
2022-01-12 8:14 ` Thomas Petazzoni
@ 2022-01-12 8:53 ` Norbert Lange
2022-01-12 18:39 ` Arnout Vandecappelle
0 siblings, 1 reply; 5+ messages in thread
From: Norbert Lange @ 2022-01-12 8:53 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Joseph Kogut, Adam Duskett, Michał Łyszczek, buildroot
[-- Attachment #1.1: Type: text/plain, Size: 1294 bytes --]
Thomas Petazzoni <thomas.petazzoni@bootlin.com> schrieb am Mi., 12. Jan.
2022, 09:14:
> Hello Norbert,
>
> On Mon, 5 Oct 2020 00:41:36 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > Linux distros changed /var/run and /var/lock to reside on an tmpfs in
> > /run a long time ago, and buildroot seems to agree by providing this
> > tmpfs on all supported init systems.
>
> I am not 100% sure but it seems like this patch has potentially broken
> the build of vtun, which now fails with:
>
> /usr/bin/install: cannot create directory
> '/home/giuliobenetti/autobuild/run/instance-0/output-1/target/var/lock':
> File exists
>
> If you look at http://autobuild.buildroot.net/?reason=vtun%, vtun
> version 3.0.4 restarted failing to build on January 10, with this error.
>
> Could you have a look ?
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Seems like the issue is, that run/lock is not existing when installing.
Anything installed there will be gone (already before this commit), so it's
kinda pointless to do so.
I don't know how many packages have this issue, imho it would be better to
fix them instead of making a run/lock directory for broken packages (that
will get removed later)
Norbert
[-- Attachment #1.2: Type: text/html, Size: 2156 bytes --]
[-- Attachment #2: Type: text/plain, Size: 150 bytes --]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks
2022-01-12 8:53 ` Norbert Lange
@ 2022-01-12 18:39 ` Arnout Vandecappelle
0 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2022-01-12 18:39 UTC (permalink / raw)
To: Norbert Lange, Thomas Petazzoni
Cc: Joseph Kogut, Adam Duskett, Michał Łyszczek, buildroot
On 12/01/2022 09:53, Norbert Lange wrote:
>
>
>
> Thomas Petazzoni <thomas.petazzoni@bootlin.com
> <mailto:thomas.petazzoni@bootlin.com>> schrieb am Mi., 12. Jan. 2022, 09:14:
>
> Hello Norbert,
>
> On Mon, 5 Oct 2020 00:41:36 +0200
> Norbert Lange <nolange79@gmail.com <mailto:nolange79@gmail.com>> wrote:
>
> > Linux distros changed /var/run and /var/lock to reside on an tmpfs in
> > /run a long time ago, and buildroot seems to agree by providing this
> > tmpfs on all supported init systems.
>
> I am not 100% sure but it seems like this patch has potentially broken
> the build of vtun, which now fails with:
>
> /usr/bin/install: cannot create directory
> '/home/giuliobenetti/autobuild/run/instance-0/output-1/target/var/lock':
> File exists
>
> If you look at http://autobuild.buildroot.net/?reason=vtun%
> <http://autobuild.buildroot.net/?reason=vtun%>, vtun
> version 3.0.4 restarted failing to build on January 10, with this error.
>
> Could you have a look ?
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com <https://bootlin.com>
>
>
> Seems like the issue is, that run/lock is not existing when installing.
> Anything installed there will be gone (already before this commit), so it's
> kinda pointless to do so.
Ah, yes, there are many packages that require a directory in a tmpfs and that
create it at build time (because they dont "know" that it's going to be a tmpfs)
and at runtime (in the init script, through tmpfiles, or by the application itself).
> I don't know how many packages have this issue, imho it would be better to fix
> them instead of making a run/lock directory for broken packages (that will get
> removed later)
We're not going to patch packages just for that, because unavoidably some
upstreams are not going to be receptive. Creating the directory is a much
simpler solution.
Regards,
Arnout
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-12 18:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 22:41 [Buildroot] [PATCH] skeleton + init: prepare /run/lock and adjust compat symlinks Norbert Lange
2022-01-09 10:29 ` Arnout Vandecappelle
2022-01-12 8:14 ` Thomas Petazzoni
2022-01-12 8:53 ` Norbert Lange
2022-01-12 18:39 ` Arnout Vandecappelle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.