aboutsummaryrefslogtreecommitdiffstats
path: root/meta-netboot/recipes-core
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2019-07-03 14:44:09 +0000
committerStéphane Desneux <stephane.desneux@iot.bzh>2019-07-07 21:13:20 +0000
commitf8735714d019273bbc17beab1a288aed9291de62 (patch)
treee724b07da2df8c6835cea7a66929bba4a42c461b /meta-netboot/recipes-core
parentea174a74a9e3325e07b6daa2f998b40f58981d56 (diff)
netboot: systemd must mount /tmp and /run
When using netboot, the initrd script mounts /tmp and /run before pivoting on the new rootfs and then running systemd. As a consequence, systemd doesn't try to remount /tmp or /run (and the correct smack labels are not applied on /tmp and /run, leading to many issues). This patch unmounts /tmp and /run just before running systemd which will then mount them with correct labels. Bug-AGL: SPEC-2596 Change-Id: I4cd7b67f04c232a6e48c777fb5fefa6c46f6744a Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'meta-netboot/recipes-core')
-rw-r--r--meta-netboot/recipes-core/initramfs-netboot/files/init.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
index 2def28eb1..7064314a5 100644
--- a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
+++ b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
@@ -126,8 +126,8 @@ done
# switch to new rootfs
log_info "Switching to new rootfs"
-mkdir -p run/initramfs
-pivot_root . run/initramfs || bail_out "pivot_root failed."
+mkdir -p boot/initramfs
+pivot_root . boot/initramfs || bail_out "pivot_root failed."
# workaround for connman (avoid bringing down the network interface used for booting, disable DNS proxy)
if [[ -f /lib/systemd/system/connman.service ]]; then
@@ -137,8 +137,14 @@ if [[ -f /lib/systemd/system/connman.service ]]; then
fi
# also use /proc/net/pnp to generate /etc/resolv.conf
+rm -f /etc/resolv.conf
grep -v bootserver /proc/net/pnp | sed 's/^domain/search/g' >/etc/resolv.conf
+# unmount tmp and run to let systemd remount them with correct smack labels (SPEC-2596)
+log_info "Unmounting /tmp and /run"
+umount /tmp
+umount /run
+
# finally, run systemd
check_debug "Debug point 2. Exit to continue initrd script (run systemd)."