diff options
author | Glennie Vignarajah <glennie@glennie.fr> | 2008-05-26 23:41:15 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2008-05-28 00:07:33 +0200 |
commit | 40c56de6f25ad179700d38604a27844d3a770a3c (patch) | |
tree | 33e0cb2510f07e25f39ea0f4cd560cdd23e383b8 /hook-functions | |
parent | 8db2495b6d17f1e8d1f114a4105548f5d0d53dc5 (diff) | |
download | initramfs-tools-40c56de6f25ad179700d38604a27844d3a770a3c.tar.gz initramfs-tools-40c56de6f25ad179700d38604a27844d3a770a3c.zip |
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).
Diffstat (limited to 'hook-functions')
-rw-r--r-- | hook-functions | 6 |
1 files changed, 5 insertions, 1 deletions
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 |