Bug#608339: initramfs-tools: MODULES=dep fails when / is ubifs (reopen)
Package: initramfs-tools
Severity: normal
Similar to #582858, however for me it still does not work.
When I set MODULES=dep, root cannot be found as the root mountpoint
device does not start with '^/dev/' (thanks to my symlinking /etc/mtab
to /proc/mounts I also get two /'s also):
---- output of 'mount' ----
rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (rw,relatime)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,relatime,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
varrun on /var/run type tmpfs (rw,nosuid,relatime,mode=755)
varlock on /var/lock type tmpfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=10240k,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime,size=32768k)
tmpfs on /var/tmp type tmpfs (rw,nosuid,nodev,noexec,relatime,size=8192k)
/dev/sda1 on /root/moo type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro)
---- contents of /proc/mounts ----
rootfs / rootfs rw 0 0
ubi0:rootfs / ubifs rw,relatime 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
varrun /var/run tmpfs rw,nosuid,relatime,mode=755 0 0
varlock /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev tmpfs rw,relatime,size=10240k,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noexec,relatime,size=32768k 0 0
tmpfs /var/tmp tmpfs rw,nosuid,nodev,noexec,relatime,size=8192k 0 0
/dev/sda1 /root/moo vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro 0 0
----
This is trivially resolved by amending the routines that search for the
root block device and fstype in /usr/share/initramfs-tools/hook-functions
to the following instead:
----
# findout root block device + fstype
eval "$(mount | awk '!/^rootfs / && / on \/ type / {print "root=" $1 "\nFSTYPE=" $5; exit}')"
# On failure fallback to /proc/mounts if readable
if [ -z "$root" ] && [ -r /proc/mounts ]; then
eval "$(awk '!/^rootfs / && / \/ / {print "root=" $1 "\nFSTYPE=" $3; exit}' /proc/mounts)"
fi
----
This filters out the useless '^rootfs' entry (enabling embedded folk to
continue symlinking) and permits anything (not just '^/dev/...') as the
root device. Now the ubifs root filesystem detection functions.
It should also be noted, the original 'failure fallback' does not work
anyway as it incorrectly refers to $5 (over eager cutting and pasting it
seems) when it should refer to $3 for FSTYPE.
Cheers
---- System Info (armel - orion5x) ----
root@(none):~# cat /proc/cpuinfo
Processor : Feroceon rev 0 (v5l)
BogoMIPS : 332.59
Features : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant : 0x0
CPU part : 0x926
CPU revision : 0
Hardware : Technologic Systems TS-78xx SBC
Revision : 0000
Serial : 0000000000000000
Reply to: