From 40c56de6f25ad179700d38604a27844d3a770a3c Mon Sep 17 00:00:00 2001 From: Glennie Vignarajah Date: Mon, 26 May 2008 23:41:15 +0200 Subject: initramfs-tools: Fix UUID rootfs detection with 'MODULES=dep' When MODULES is set to 'dep' in /etc/initramfs-tools/initramfs.conf, update-initramfs fails to detect correctly the root filesystem(device and fs used). When called, this command fails with: ---------- mkinitramfs: missing rootfs root rootfs /sys entry mkinitramfs: workaround is MODULES=most mkinitramfs: Error please report the bug update-initramfs: failed for /boot/initrd.img-2.6.25-2-amd64 ---------- So we have 3 cases here. eval "$(mount | awk '/"... returns * an UUID when the rootfs is mounted with the 'LABEL=' or 'UUID='. The UUID is a relative symbolic link located in /dev/disk/by-uuid/ pointing to the real device. * the real disk device. * /dev/root When "root=/dev/root", we have to figure out what it is, which is done in the "if" block. Also changing the matching regex in front to catch that type. Once we got the symlink to the root device, we can use 'readlink' to get the real device. Using 'readlink' on a file which is not a symlink doesn't matters(case 2). --- hook-functions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hook-functions') diff --git a/hook-functions b/hook-functions index 8c90d37..c48416a 100644 --- a/hook-functions +++ b/hook-functions @@ -222,7 +222,11 @@ dep_add_modules() local block minor root FSTYPE root_dev_path x # findout root block device + fstype - eval "$(mount | awk '/ \/ / {print "root=" $1 "\nFSTYPE=" $5; exit}')" + eval "$(mount | awk '/\/dev\// {if ($3 == "/") {print "root=" $1 "\nFSTYPE=" $5; exit}}')" + if [ "${root}" = "/dev/root" ] ; then + root="/dev/disk/by-uuid/"$(/lib/udev/vol_id --uuid ${root}) 2>/dev/null + fi + root="$(readlink -f ${root})" # find out real rootfs on auto type if [ "${FSTYPE}" = "auto" ]; then -- cgit v1.2.3