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

Bug#652459: initramfs-tools: [patch] Please support mounting of /usr in the initramfs



On Sat, May 11, 2013 at 08:02:36PM +0100, Roger Leigh wrote:
> With all the patches applied, /usr will be automatically mounted if
> it is present in the /etc/fstab on the rootfs.  This works for both
> local and nfs.  I've not tested LVM, but standard UUIDs work fine.
> You can also mount /etc so that this can be independently mounted;
> obviously this can't use the fstab, so it's done using an equivalent
> set of command-line options as for the rootfs.  This is a separate
> patch so it can be easily dropped.

Additional patch attached to canonicalise mount device names.  This
isn't just cosmetic--mount requires the device names to match when
we try to mount all filesystems in fstab during boot (which we already
fixed up for the tmpfs mounts).  This does it for all local device
paths.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
>From 36b9ea47b06dc184404eef696e5457b750898ec9 Mon Sep 17 00:00:00 2001
From: Roger Leigh <Roger Leigh rleigh@debian.org>
Date: Sun, 12 May 2013 00:24:18 +0100
Subject: [PATCH 13/13] resolve_device: Canonicalise symbolic links to real
 device nodes

Canonicalise device names to match util-linux mount behaviour.
This ensures that "mount -a" in mountall does not try to mount
/usr a second time (which it will attempt if the mounted device
does not match the canonical device name).  This also fixes a
longstanding annoyance with the output of mount and df using long
UUIDs rather than short device names.

Note that resolve_device may be called more than one; it's done
during options parsing for ROOT and ETC, and again immediately
prior to mounting.  This is because during options parsing the
device node does not exist, but we still need to construct a
path into /dev from the LABEL or UUID.
---
 scripts/functions |    2 ++
 scripts/local     |    6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/scripts/functions b/scripts/functions
index 6354573..eeec778 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -492,6 +492,8 @@ resolve_device() {
 		DEV="/dev/disk/by-uuid/${DEV#UUID=}"
 		;;
 	esac
+	# Only canonicalise if a valid file, in case $DEV isn't a filename
+	[ -e "$DEV" ] && DEV=$(readlink -f "$DEV")
 	echo "$DEV"
 }
 
diff --git a/scripts/local b/scripts/local
index 3299232..55464a2 100644
--- a/scripts/local
+++ b/scripts/local
@@ -120,6 +120,8 @@ local_mount_root()
 
 	local_premount
 
+	ROOT=$(resolve_device "$ROOT")
+
 	if [ "${readonly}" = "y" ]; then
 		roflag=-r
 	else
@@ -151,6 +153,8 @@ local_mount_etc()
 
 	local_premount
 
+	ETC=$(resolve_device "$ETC")
+
 	if [ "${readonly}" = "y" ]; then
 		roflag=-r
 	else
@@ -178,6 +182,8 @@ local_mount_fs()
 
 	local_premount
 
+	MNT_FSNAME=$(resolve_device "$MNT_FSNAME")
+
 	if [ "${readonly}" = "y" ]; then
 		roflag=-r
 	else
-- 
1.7.10.4


Reply to: