Bug#668616: initramfs-tools: for root /boot/rootfs missing /boot/rootfs /sys/block/ entry
Package: initramfs-tools
Version: 0.101
Severity: important
Tags: patch
Hi,
Since my last upgrade on a squeeze with parts of wheezy, update-initramfs
fails to create the initrd.img file with the following error message:
mkinitramfs: for root /boot/rootfs missing /boot/rootfs /sys/block/ entry
mkinitramfs: workaround is MODULES=most
mkinitramfs: Error please report the bug
The machine is a kvm virtual machine with few space on /boot so the
suggested workaround is not an option for me.
During my last upgrade, initramfs-tools was *not* upgraded. So I tried
to see in details where the problem really come from.
Looking into /usr/share/initramfs-tools/hook-functions, I see:
=====
# find and only copy root relevant modules
dep_add_modules()
{
[...]
# findout root block device + fstype
eval "$( mount | while read dev foo mp foo fs opts rest ; do
[ "$mp" = "/" ] && printf "root=$dev
FSTYPE=$fs"
&& break; done)"
# On failure fallback to /proc/mounts if readable
if [ -z "$root" ] && [ -r /proc/mounts ]; then
eval "$(while read dev mp fs opts rest ; do
[ "$mp" = "/" ] && [ "$fs" != "rootfs" ]
&& printf "root=$dev
FSTYPE=$fs"
&& break; done < /proc/mounts)"
fi
[...]
root="$(readlink -f ${root})"
[...]
# Error out if /sys lack block dev
if [ -z "${block}" ] || [ ! -e /sys/block/${block} ]; then
echo "mkinitramfs: for root ${root} missing ${block} /sys/block/ entry" >&2
echo "mkinitramfs: workaround is MODULES=most" >&2
echo "mkinitramfs: Error please report the bug" >&2
exit 1
fi
[...]
}
====
Note how the output of the 'mount' command is handled differently from
the contents of '/proc/mounts': there is no test ' && [ "$fs" != "rootfs" ]'
in the first case.
And if root=rootfs, then 'root="$(readlink -f ${root})"' set root to /boot/rootfs
as rootfs does not exist and the script is run from the boot directory.
kooot:/boot# mount
rootfs on / type rootfs (rw)
[...]
kooot:/boot# readlink -f rootfs
/boot/rootfs
kooot:/boot#
During my upgrade, sysvinit-utils and initscripts have been upgraded from
2.88dsf-13.1 to 2.88dsf-22.1. I think (I did not check) that this move
/etc/mtab into a symlink to /proc/mounts. So, the result of "mount"
should be handled the same as the contents of /proc/mounts.
And indeed, adding " && [ "$fs" != "rootfs" ]" when handling the
output of mount fixed the problem for me.
Kernel: Linux 3.3.0-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages initramfs-tools depends on:
ii cpio 2.11-7
ii klibc-utils 2.0~rc3-1
ii module-init-tools 6-2
ii udev 175-3.1
Versions of packages initramfs-tools recommends:
ii busybox 1:1.19.3-5
Versions of packages initramfs-tools suggests:
ii bash-completion 1:1.99-3
-- no debconf information
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120413141318.30609.13940.reportbug@eyak.imag.fr" >http://lists.debian.org/20120413141318.30609.13940.reportbug@eyak.imag.fr