Page 1 of 1

initrd mount freeze if it try to mount a 0Xaa filled device.

Posted: 14 Jul 2013, 18:14
by gernot
The kernel don't freeze. It only takes very long time to read the complete device.
The "busy" function is udf_vrs

Code: Select all

UDF-fs DEBUG super.c:414:udf_vrs: read sector  264c2800
UDF-fs DEBUG super.c:414:udf_vrs: read sector 264c3000
UDF-fs DEBUG super.c:414:udf_vrs: read sector 264c3800 
...
initial posting: http://www.sysresccd.org/forums/viewtop ... =14&t=5133

here is a stopping strace from initrd 3.7.1-beta005

Code: Select all

open("/etc/filesystems", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/proc/filesystems", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7
7b3000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 1024) = 447
read(3, "", 1024)                       = 0
mount("/dev/sdb", "g", "reiserfs", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "ext3", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "ext2", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "ext4", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "squashfs", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "vfat", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "iso9660", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "ntfs", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "fuseblk", MS_VERBOSE, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/sdb", "g", "udf", MS_VERBOSE, NULL

A idea to come around this is to use a
/etc/filesystems and remove udf in the first loop.
After all devices are tested udf should included again.
This should be easy to do because sysrcd test all devices in loop.

Tip for testing: Use a 0xaa filled USB stick. Mount continue after pulling the stick.

Gernot

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 15 Jul 2013, 16:54
by gernot
new cognitions,edit initial post

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 18 Jul 2013, 17:26
by Dukers
Why is the init trying to mount with every FS available? Shouldn't mount itself do the job through libblkid?

BTW, where can I find the latest SystemRescueCd init scripts? I used to access Sourceforge Git, but can't find them anymore there.

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 18 Jul 2013, 20:07
by gernot
Its not the inird/init who try to mount every filesystem. It is the default behavior of the mount command if it is called without -t ... .
The strace showed is only from a single mount command "strace mount /dev/sdb g"
Use the minishell option to get a quick look to the init script.

Gernot

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 19 Jul 2013, 02:12
by Dukers
You're right. mount falls back to /{etc,proc}/filesystems when libblkid doesn't find any known superblock on the device.

Code: Select all

mount -t noudf ...
is also a possible workarround as it is almost the same thing than creating /etc/filesystems without udf (it will ignore true UDF volumes detected by libblkid though).

This appears to be a kernel bug to me.

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 19 Jul 2013, 04:40
by gernot
Its not a bug.... it is.....

In old days i had a writable SYSRCD on a UDF formated DVDRAM. I know today this happens very seldom , but it is nice that it is possible.

by the way, i get "mount: fs type noudf not supported by kernel"

Gernot

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 19 Jul 2013, 11:15
by Dukers
:( So I think no<fs> only works with "mount -a" (reading /etc/fstab).

When I say a bug in the kernel I mean the UDF driver should have more checks to detect that in this situation the volume is not UDF and simply return an error.

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 26 Jul 2013, 15:15
by Dukers
What I said about libblkid is for the util-linux's mount, not the BusyBox one that is used by SYSRCD initramfs. SystemRescueCd already has libblkid (and libuuid) in the initramfs for blkid. I think would be better use util-linux's mount too there. libmount.so will be needed too.

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 26 Jul 2013, 16:40
by Dukers
With util-linux's mount, we can try something like this to avoid some unnecessary mounts:

Code: Select all

--- init.orig	2013-07-26 10:40:01.087645960 -0300
+++ init	2013-07-26 13:33:49.681537217 -0300
@@ -837,7 +837,7 @@
     mkdir -p ${mountdir}
     for curdev in ${searchdevices}
     do
-        devsize=$(blockdev --getsize64 ${curdev}) 2>/dev/null || devsize=0
+        devsize=$(blockdev --getsize64 ${curdev} 2>/dev/null) || devsize=0
         if [ -b "${curdev}" ] && [ ${devsize} -gt 1048576 ] # Check for valid block devices larger than 1MB
         then
             # check the 'skipmount=/dev/xxx' option (use it with a failing hard drive)
@@ -848,8 +848,9 @@
             else
                 good_msg "Attempting to mount device: ${curdev}"
 
-                for curfs in vfat msdos iso9660 ntfs auto
-                do
+                curfs=$(blkid -s TYPE -o value ${curdev} 2>/dev/null)
+                if [ -n "${curfs}" ]
+                then
                     case "${curfs}" in
                         iso9660)
                             mntopt='-o mode=0644'
@@ -861,23 +862,25 @@
                             mntopt=''
                             ;;
                     esac
+                else
+                    mntopt=''
+                fi
 
-                    if mount -r -t ${curfs} ${curdev} ${mountdir} ${mntopt} >/dev/null 2>&1
+                if mount -r ${curdev} ${mountdir} ${mntopt} >/dev/null 2>&1
+                then
+                    if [ -e ${mountdir}/${filepath} ]
                     then
-                        if [ -e ${mountdir}/${filepath} ]
+                        SEARCHDEVICE="${curdev}"
+                        good_msg "File ${filepath} found on device ${curdev}"
+                        if [ "${mountmode}" = 'rw' ] && ! mount -o remount,rw,noatime ${mountdir}
                         then
-                            SEARCHDEVICE="${curdev}"
-                            good_msg "File ${filepath} found on device ${curdev}"
-                            if [ "${mountmode}" = 'rw' ] && ! mount -o remount,rw,noatime ${mountdir}
-                            then
-                                sysresccd_panic "Cannot remount ${curdev} in read-write mode"
-                            fi
-                            return 0
-                        else
-                            umount ${mountdir} >/dev/null 2>&1
+                            sysresccd_panic "Cannot remount ${curdev} in read-write mode"
                         fi
+                        return 0
+                    else
+                        umount ${mountdir} >/dev/null 2>&1
                     fi
-                done
+                fi
             fi
         fi
     done

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 30 Jul 2013, 11:31
by Dukers
admin, I don't use network boot of any kind. But util-linux's mount would not have any side effect I think. What do you think about replace BusyBox's mount with it? The util-linux filesystem probing is much better.

Re: initrd mount freeze if it try to mount a 0Xaa filled dev

Posted: 05 Aug 2013, 14:01
by Dukers
Btw, current initramfs has a lot of old stuff, like udev 164, old glibc, module-init-tools (newer versions are now kmod), etc.