[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#886328: marked as done (live-boot: Please use /run/live instead of /lib/live/mount)



Your message dated Wed, 28 Mar 2018 19:36:02 +0000
with message-id <E1f1Gra-000Cgc-Id@fasolo.debian.org>
and subject line Bug#886328: fixed in live-boot 1:20180328
has caused the Debian Bug report #886328,
regarding live-boot: Please use /run/live instead of /lib/live/mount
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
886328: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886328
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Currently live-boot mounts following things:

  /lib/live/mount/medium: the live media mounted read-only
  /lib/live/mount/rootfs/filesystem.{squashfs,ext*,...}: the root fs image
  /lib/live/mount/overlay: the copy-on-write content from aufs
  /lib/live/mount/findiso: the loop-mounted iso image when using findiso
  /lib/live/mount/persistence/*: persistent devices with copy-on-write overlay

Some of these mounts are mounted in /live before they are moved to their
correct place. Since the final root filesystem is mounted in /root and
run-init switches to it, special care needs to be taken when moving the
mount points around.

/lib/live/mount/overlay is not accessible any more in the live system:

$ df -h
/dev/loop0 169M  169M     0 100% /lib/live/mount/rootfs/root.squashfs
tmpfs      744M     0  744M   0% /lib/live/mount/overlay
overlay    1,5G 1001M  536M  66% /

The early initramfs stage mounts tmpfs on /run which doesn't need to be
moved once the final root filesystem is in place. The mount points do
not need much space and can live on /run/live without problems. Since
these mount points are run-time variable data, they fit perfectly for
/run and comply with FHS 3.0.

Therefore move /lib/live/mount to /run/live and skip the intermedia
/live mount points. This reduces code and complexity. A tested patch is
attached.

See also for the previous larger layout change:
https://lists.debian.org/debian-live/2012/10/msg00021.html

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.drung@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 3f97c0d3153c2073eb93473eeb26d2f8153f6464 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.drung@profitbricks.com>
Date: Thu, 4 Jan 2018 11:02:32 +0100
Subject: [PATCH] Use /run/live instead of /lib/live/mount

Currently live-boot mounts following things:

  /lib/live/mount/medium: the live media mounted read-only
  /lib/live/mount/rootfs/filesystem.{squashfs,ext*,...}: the root fs image
  /lib/live/mount/overlay: the copy-on-write content from aufs
  /lib/live/mount/findiso: the loop-mounted iso image when using findiso
  /lib/live/mount/persistence/*: persistent devices with copy-on-write overlay

Some of these mounts are mounted in /live before they are moved to their
correct place. Since the final root filesystem is mounted in /root and
run-init switches to it, special care needs to be taken when moving the
mount points around.

/lib/live/mount/overlay is not accessible any more in the live system:

$ df -h
/dev/loop0 169M  169M     0 100% /lib/live/mount/rootfs/root.squashfs
tmpfs      744M     0  744M   0% /lib/live/mount/overlay
overlay    1,5G 1001M  536M  66% /

The early initramfs stage mounts tmpfs on /run which doesn't need to be
moved once the final root filesystem is in place. The mount points do
not need much space and can live on /run/live without problems. Since
these mount points are run-time variable data, they fit perfectly for
/run and comply with FHS 3.0.

Therefore move /lib/live/mount to /run/live and skip the intermedia
/live mount points. This reduces code and complexity.

See also for the previous larger layout change:
https://lists.debian.org/debian-live/2012/10/msg00021.html

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
---
 backend/initramfs-tools/live.hook  |  2 +-
 components/0001-init-vars.sh       |  2 +-
 components/2010-remove-persistence |  2 +-
 components/9990-main.sh            | 20 +++----------------
 components/9990-misc-helpers.sh    | 24 +++++++++++-----------
 components/9990-overlay.sh         | 41 +++++++-------------------------------
 6 files changed, 25 insertions(+), 66 deletions(-)

diff --git a/backend/initramfs-tools/live.hook b/backend/initramfs-tools/live.hook
index 1ce922d..97f4c5e 100755
--- a/backend/initramfs-tools/live.hook
+++ b/backend/initramfs-tools/live.hook
@@ -8,7 +8,7 @@ set -e
 
 # Reading configuration file from filesystem and live-media
 for _FILE in /etc/live/boot.conf /etc/live/boot/* \
-	     /lib/live/mount/media/live/boot.conf /lib/live/mount/media/live/boot/*
+	     /run/live/medium/live/boot.conf /run/live/medium/live/boot/*
 do
 	if [ -e "${_FILE}" ]
 	then
diff --git a/components/0001-init-vars.sh b/components/0001-init-vars.sh
index 7e69956..603cf43 100755
--- a/components/0001-init-vars.sh
+++ b/components/0001-init-vars.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-mountpoint="/live/medium"
+mountpoint="/run/live/medium"
 alt_mountpoint="/media"
 LIVE_MEDIA_PATH="live"
 HOSTNAME="host"
diff --git a/components/2010-remove-persistence b/components/2010-remove-persistence
index 5dcf0c0..717a408 100755
--- a/components/2010-remove-persistence
+++ b/components/2010-remove-persistence
@@ -27,5 +27,5 @@ Remove_persistence ()
 	esac
 
 	# Remove persistence
-	cd /live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
+	cd /run/live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
 }
diff --git a/components/9990-main.sh b/components/9990-main.sh
index e5884f9..20e8c0c 100755
--- a/components/9990-main.sh
+++ b/components/9990-main.sh
@@ -128,20 +128,6 @@ Live ()
 		mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
 	fi
 
-	# At this point /root should contain the final root filesystem.
-	# Move all mountpoints below /live into /root/lib/live/mount.
-	# This has to be done after mounting the root filesystem to /
-	# otherwise these mount points won't be accessible from the running system.
-	for _MOUNT in $(cat /proc/mounts | cut -f 2 -d " " | grep -e "^/live/")
-	do
-		local newmount
-		newmount="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
-		mkdir -p "${newmount}"
-		mount -o move "${_MOUNT}" "${newmount}" > /dev/null 2>&1 || \
-		mount -o bind "${_MOUNT}" "${newmount}" > /dev/null || \
-		log_warning_msg "W: failed to move or bindmount ${_MOUNT} to ${newmount}"
-	done
-
 	if [ -n "${ROOT_PID}" ]
 	then
 		echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
@@ -162,10 +148,10 @@ Live ()
 	then
 		losetup -d /dev/loop0
 
-		if is_mountpoint /root/lib/live/mount/findiso
+		if is_mountpoint /run/live/findiso
 		then
-			umount /root/lib/live/mount/findiso
-			rmdir --ignore-fail-on-non-empty /root/lib/live/mount/findiso \
+			umount /run/live/findiso
+			rmdir --ignore-fail-on-non-empty /run/live/findiso \
 				>/dev/null 2>&1 || true
 		fi
 	fi
diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh
index fba3d43..e21fced 100755
--- a/components/9990-misc-helpers.sh
+++ b/components/9990-misc-helpers.sh
@@ -203,9 +203,9 @@ check_dev ()
 			if [ -f ${mountpoint}/${FINDISO} ]
 			then
 				umount ${mountpoint}
-				mkdir -p /live/findiso
-				mount -t ${fstype} -o ro,noatime "${devname}" /live/findiso
-				loopdevname=$(setup_loop "/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" 0 "")
+				mkdir -p /run/live/findiso
+				mount -t ${fstype} -o ro,noatime "${devname}" /run/live/findiso
+				loopdevname=$(setup_loop "/run/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" 0 "")
 				devname="${loopdevname}"
 				mount -t iso9660 -o ro,noatime "${devname}" ${mountpoint}
 			else
@@ -703,7 +703,7 @@ mount_persistence_media ()
 
 	# get_custom_mounts() might call this with a directory path instead
 	# of a block device path. This means we have found sub-directory path
-	# underneath /lib/live/mounts/persistence, so we're done
+	# underneath /run/live/persistence, so we're done
 	if [ -d "${device}" ]
 	then
 		echo "${device}"
@@ -715,7 +715,7 @@ mount_persistence_media ()
 		return 1
 	fi
 
-	backing="/live/persistence/$(basename ${device})"
+	backing="/run/live/persistence/$(basename ${device})"
 
 	mkdir -p "${backing}"
 	old_backing="$(where_is_mounted ${device})"
@@ -1383,9 +1383,9 @@ get_custom_mounts ()
 				continue
 			fi
 
-			if trim_path ${dir} | grep -q -e "^[^/]" -e "^/lib" -e "^/lib/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
+			if trim_path ${dir} | grep -q -e "^[^/]" -e "^/lib" -e "^/run/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
 			then
-				log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/lib\", or \"/lib/live\" or any of its sub-directories."
+				log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/lib\", or \"/run/live\" or any of its sub-directories."
 				continue
 			fi
 
@@ -1575,11 +1575,11 @@ activate_custom_mounts ()
 		local cow_dir links_source
 		if [ -n "${opt_link}" ] && [ -z "${PERSISTENCE_READONLY}" ]
 		then
-			link_files ${source} ${dest} "s|^/live/|/lib/live/mount/|"
+			link_files ${source} ${dest} ""
 		elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
 		then
-			mkdir -p ${rootmnt}/lib/live/mount/persistence
-			links_source=$(mktemp -d ${rootmnt}/lib/live/mount/persistence/links-source-XXXXXX)
+			mkdir -p /run/live/persistence
+			links_source=$(mktemp -d /run/live/persistence/links-source-XXXXXX)
 			chown_ref ${source} ${links_source}
 			chmod_ref ${source} ${links_source}
 			# We put the cow dir in the below strange place to
@@ -1587,7 +1587,7 @@ activate_custom_mounts ()
 			# has its own directory and isn't nested with some
 			# other custom mount (if so that mount's files would
 			# be linked, causing breakage.
-			cow_dir="/live/overlay/lib/live/mount/persistence/$(basename ${links_source})"
+			cow_dir="/run/live/overlay/run/live/persistence/$(basename ${links_source})"
 			mkdir -p ${cow_dir}
 			chown_ref "${source}" "${cow_dir}"
 			chmod_ref "${source}" "${cow_dir}"
@@ -1604,7 +1604,7 @@ activate_custom_mounts ()
 			# bind-mount and union mount are handled the same
 			# in read-only mode, but note that rootfs_dest_backing
 			# is non-empty (and necessary) only for unions
-			cow_dir="/live/overlay/${dest}"
+			cow_dir="/run/live/overlay/${dest}"
 			if [ -e "${cow_dir}" ] && [ -z "${opt_link}" ]
 			then
 				# If an earlier custom mount has files here
diff --git a/components/9990-overlay.sh b/components/9990-overlay.sh
index d1b9cef..220fa3a 100755
--- a/components/9990-overlay.sh
+++ b/components/9990-overlay.sh
@@ -15,12 +15,7 @@ setup_unionfs ()
 		panic "${UNIONTYPE} not available."
 	fi
 
-	# run-init can't deal with images in a subdir, but we're going to
-	# move all of these away before it runs anyway.  No, we're not,
-	# put them in / since move-mounting them into / breaks mono and
-	# some other apps.
-
-	croot="/"
+	croot="/run/live/rootfs"
 
 	# Let's just mount the read-only file systems first
 	rootfslist=""
@@ -135,8 +130,7 @@ setup_unionfs ()
 
 	# tmpfs file systems
 	touch /etc/fstab
-	mkdir -p /live/overlay
-	mount -t tmpfs tmpfs /live/overlay
+	mkdir -p /run/live/overlay
 
 	# Looking for persistence devices or files
 	if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
@@ -245,11 +239,11 @@ setup_unionfs ()
 
 	if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
 	then
-		mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
-		root_backing="/live/persistence/$(basename ${cowdevice})-root"
+		mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/run/live/overlay"
+		root_backing="/run/live/persistence/$(basename ${cowdevice})-root"
 		mkdir -p ${root_backing}
 	else
-		root_backing="/live/overlay"
+		root_backing="/run/live/overlay"
 	fi
 
 	if [ "${cow_fstype}" = "nfs" ]
@@ -290,7 +284,7 @@ setup_unionfs ()
 	for dir in ${cow_dirs}; do
 		unionmountpoint="${rootmnt}${dir}"
 		mkdir -p ${unionmountpoint}
-		cow_dir="/live/overlay${dir}"
+		cow_dir="/run/live/overlay${dir}"
 		rootfs_dir="${rootfs}${dir}"
 		mkdir -p ${cow_dir}
 		if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
@@ -313,22 +307,6 @@ setup_unionfs ()
 		chmod 1777 "${rootmnt}"/tmp
 	fi
 
-	live_rootfs_list=""
-	for d in ${rootfslist}
-	do
-		live_rootfs="/live/rootfs/${d##*/}"
-		live_rootfs_list="${live_rootfs_list} ${live_rootfs}"
-		mkdir -p "${live_rootfs}"
-		case "${d}" in
-			*.dir)
-				# do nothing # mount -o bind "${d}" "${live_rootfs}"
-				;;
-			*)
-				mount -o move "${d}" "${live_rootfs}"
-				;;
-		esac
-	done
-
 	# Adding custom persistence
 	if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
 	then
@@ -339,7 +317,7 @@ setup_unionfs ()
 		# Gather information about custom mounts from devies detected as overlays
 		get_custom_mounts ${custom_mounts} ${overlay_devices}
 
-		[ -n "${LIVE_BOOT_DEBUG}" ] && cp ${custom_mounts} "/lib/live/mount/persistence"
+		[ -n "${LIVE_BOOT_DEBUG}" ] && cp ${custom_mounts} "/run/live/persistence"
 
 		# Now we do the actual mounting (and symlinking)
 		local used_overlays
@@ -356,9 +334,4 @@ setup_unionfs ()
 			fi
 		done
 	fi
-
-	# ensure that a potentially stray tmpfs gets removed
-	# otherways, initramfs-tools is unable to remove /live
-	# and fails to boot
-	umount /live/overlay > /dev/null 2>&1 || true
 }
-- 
2.14.1


--- End Message ---
--- Begin Message ---
Source: live-boot
Source-Version: 1:20180328

We believe that the bug you reported is fixed in the latest version of
live-boot, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 886328@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Luca Boccassi <bluca@debian.org> (supplier of updated live-boot package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 28 Mar 2018 20:07:39 +0100
Source: live-boot
Binary: live-boot live-boot-doc live-boot-initramfs-tools
Architecture: source
Version: 1:20180328
Distribution: unstable
Urgency: low
Maintainer: Live Systems Maintainers <debian-live@lists.debian.org>
Changed-By: Luca Boccassi <bluca@debian.org>
Description:
 live-boot  - Live System Boot Components
 live-boot-doc - Live System Boot Components (documentation)
 live-boot-initramfs-tools - Live System Boot Components (initramfs-tools backend)
Closes: 856482 868559 877776 884355 884886 885453 885455 885466 886328 886337 892772
Changes:
 live-boot (1:20180328) unstable; urgency=low
 .
   [ Raphaël Hertzog ]
   * Fix read-only persistence mode with overlayfs. Closes: #877776
     Thanks to Ronny Standtke <ronny.standtke@fhnw.ch> for the patch.
   * Add a small warning in the long description that the
     package must not be installed on a regular system, but only in
     a live image. Closes: #884886
   * Strip comments from checksums files passed to "shaXsum -c"
     Thanks to Andreas Heinlein for the report (Closes: #856482)
 .
   [ Steve McIntyre ]
   * Repo moved to salsa
 .
   [ Benjamin Drung ]
   * Don't replace busybox's wget by the true wget.
     It was likely done for https support but since buster the busybox
     provided wget has https support too. We save a lot of space by
     doing so (8 Mb). (Closes: #885455)
   * Avoid double slashes in some paths (Closes: #885453)
   * Support setting upperdir tmpfs size with overlay-size boot parameter
     (Closes: #885466)
   * Simplify mount point handling by using /run/live instead of /lib/live/mount
     (Closes: #886328)
   * Add configuration variables to build a stripped down initrd
     (Closes: #886337)
 .
   [ Daniel Reichelt ]
   * Use klibc's mount again for fuse mounts (Closes: #868559)
 .
   [ raizo62 ]
   * Update DNSFILE even if DNSFILE contains only commented or empty lines
 .
   [ Sameer Agrawal ]
   * Fix ifconfig parsing (Closes: #892772)
 .
   [ Chas Williams ]
   * Add back persistence fsck option
   * Remove workaround for ipconfig issues
 .
   [ Benjamin Drung ]
   * Remove sourcing /scripts/functions in components
   * Support live-{top,premount,bottom} hooks (Closes: #884355)
 .
   [ Luca Boccassi ]
   * Add backward compatibility rbind mount /lib/live/mount -> /run/live.
     The paths used in the current released versions of live-boot are a
     form of public API, and existing applications and scripts might rely
     on them. Do a recursive bind mount of the new path on the previous one
     so that they do not break on upgrade (see #886328).
     This backward-compatible mount point will be deprecated and removed
     before the Bullseye (Debian 11) release. Users are recommended to start
     migrating to the new /run/live path as soon as possible.
 .
   [ Erik Ziegenbalg ]
   * fromiso: add support for local ISO (ONIE)
 .
   [ Luca Boccassi ]
   * Clarify FROMISO documentation in live-boot manpage
   * Use HTTPS in debian/copyright (policy 4.0.0).
   * Remove dead link to live-systems.org from debian/copyright.
   * Bump Standards-Version to 4.1.3, no changes.
   * Add myself to Uploaders.
Checksums-Sha1:
 3f5b3c5a5ad40b6a5d59b5595174ea234c5c0178 1548 live-boot_20180328.dsc
 c7251bc1398cea57cc3ce08759a8cfd08c87d602 101172 live-boot_20180328.tar.xz
 4d9ab1a3a5a8ce3cfeab09ea4acd0f3d7c2fb62a 6110 live-boot_20180328_source.buildinfo
Checksums-Sha256:
 a94801aa0bc428bf21c57ba382ab8e5a6e8a5128275ff925b389d65fc651a49c 1548 live-boot_20180328.dsc
 58acb3a961c40707350f7cd61e58f255d330f6dfdad9022b2962e4335a29c469 101172 live-boot_20180328.tar.xz
 232fa4dfc580417be8f267e4b1abe7f1046190c638ad1941ee6ba17cf1b2cfa4 6110 live-boot_20180328_source.buildinfo
Files:
 50529a169e238d221981166260b34fbb 1548 misc optional live-boot_20180328.dsc
 43184c037c144665bd3e96710850c0a5 101172 misc optional live-boot_20180328.tar.xz
 a1adbcdd7e789312055c0498aedc5fa1 6110 misc optional live-boot_20180328_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQFFBAEBCgAvFiEE6g0RLAGYhL9yp9G8SylmgFB4UWIFAlq76koRHGJsdWNhQGRl
Ymlhbi5vcmcACgkQSylmgFB4UWIwVQgAmIk7GLLWbSGkyCTfJUSNTEpLgHPY6SJv
0TlDP69ndXMNl8FxKBG9pUpByZ4sCmEtjkktV2s3pIHyG2YuhXeLXiZOo0BYUA/t
r10jnYDTfRn3qxHKtluEJgX2JIU4S1fEa5sWQ2TV9rTsihV8vpl4KvryQZmRW/Qu
OsB4j4N4tp0WYiEl8ZJFJdnXvYZhsq4a7XUESOkAqaUkvUbqwPVVuatIe/2m6c1P
u7Kj5qhIyQOM2oOVvG4YZnyJl5gKD6XcfZEmBBx37o0IXu6ZCRlju23uE8wus9sZ
dGJfSCZblItwRMfgC1IM3EfFYlV9rqdbQyQM/26eF6eC0bKuV96sjA==
=6rI8
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: