On Thu, Dec 30, 2010 at 12:29:16AM +0000, Alexander Clouter wrote:
> Package: initramfs-tools
> Severity: normal
> 
> Similar to #582858, however for me it still does not work.

hehe, I see.
 
> 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
> ----

ok, thanks for the details.
 
> 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
> ----

first please if you do changes send them as diff, it is pretty
trivial these days and helps a lot for the review of a change:
git clone git://git.debian.org/kernel/initramfs-tools.git
and see short guide on how to add features or fixes
http://git.debian.org/?p=kernel/initramfs-tools.git;a=blob_plain;f=docs/maintainer-notes.html;hb=HEAD

now on the direct review, your code aboves may work for your testcase,
but will fail several others as it now subtily change a lot of things.

first off you could just keep the current way of parsing mount
and propose a change on the /proc/mount fallback. I see that the matching
prefix /dev poses a problem for ubifs, but please do not drop the matching
'/' on the explicit field.
 
> 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.

so based on your proposal a diff would look like this:

diff --git a/hook-functions b/hook-functions
index cc8b344..6dfd54d 100644
--- a/hook-functions
+++ b/hook-functions
@@ -229,7 +229,7 @@ dep_add_modules()
 
        # On failure fallback to /proc/mounts if readable
        if [ -z "$root" ] && [ -r /proc/mounts ]; then
-               eval "$(awk '/\/dev\// {if ($2 == "/") {print "root=" $1 
"\nFSTYPE=" $5; exit}}' /proc/mounts)"
+               eval "$(awk '!/^rootfs / {if ($2 == "/") {print "root=" $1 
"\nFSTYPE=" $3; exit}}' /proc/mounts)"
        fi
 
        # recheck root device

 
> 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.

well you may choose your words more wisely, as if you'd continue to read
the function you would see that we don't use this FSTYPE value, so this
doesn't matter (;
 

could you please test aboves patch on your box?
thank you 

-- 
maks



-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20101230211117.gq20...@vostochny.stro.at

Reply via email to