<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4308</bug_id>
          
          <creation_ts>2013-04-16 09:34:53 +0000</creation_ts>
          <short_desc>busybox/mount fails to mount loop devices</short_desc>
          <delta_ts>2013-04-18 07:28:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.1.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Khem Raj">raj.khem</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>laurentiu.palcu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>32215</commentid>
    <comment_count>0</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2013-04-16 09:34:53 +0000</bug_when>
    <thetext>busybox is failing to mount loop devices

mount -o rw,loop,noatime,nodiratime /tmp/my.img /media/isolinux
mount: mounting /dev/loop0 on /media/isolinux failed: No such device

sh-4.2# ls /media/isolinux/ -ld
drwxr-xr-x    2 root     root             0 Apr 16 09:10 /media/isolinux/
sh-4.2# ls /dev/loop0 -ld
brw-rw----    1 root     disk        7,   0 Apr 16 09:10 /dev/loop0


The offending commit is below 


commit ecd90bc6aa63da2aef2513ac090d4b426b2b719c
Author: Saul Wold &lt;sgw@linux.intel.com&gt;
Date:   Tue Apr 9 23:25:54 2013 -0700

    busybox: fail on no media
    
    The current behaviour of busybox is to try all fstype when automounting
    even when no media exists.  The util-linux mount command bails when no
    media exists, so change the behaviour of busybox to do the same.
    
    It could also be argued that the KERN_INFO message from btrfs could be
    removed, but that would be harder to accomplish.
    
    (From OE-Core rev: e5403f55a1e9b1747535450fd95f499c85211771)
    
    Signed-off-by: Saul Wold &lt;sgw@linux.intel.com&gt;
    Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32260</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2013-04-17 05:55:11 +0000</bug_when>
    <thetext>
I looked into this and created a local ext2 image, with mkfs.ext2 and then tried to mount it loop, it worked correct both when specifing a -t and letting it auto mount, can you give me more details about the /tmp/my.img file you created?

I tried this with ext2, ext3, and ext4


ls -l /bin/mount
lrwxrwxrwx    1 root     root            12 Apr 17 05:40 /bin/mount -&gt; /bin/busybox
root@qemux86-64:~# mount -o rw,loop -t ext2 ext2.img mnt
root@qemux86-64:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                16.8M     14.4M      1.5M  90% /
devtmpfs                 55.4M      4.0K     55.4M   0% /dev
tmpfs                    57.1M    228.0K     56.9M   0% /var/volatile
tmpfs                    57.1M         0     57.1M   0% /media/ram
/dev/loop0             1003.0K     17.0K    935.0K   2% /home/root/mnt
root@qemux86-64:~# umount mnt
root@qemux86-64:~# mount -o rw,loop ext2.img mnt
EXT4-fs (loop0): mounted filesystem without journal. Opts: (null)
root@qemux86-64:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext3 (rw,relatime,barrier=1,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=56696k,nr_inodes=14174,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /var/volatile type tmpfs (rw,relatime)
tmpfs on /media/ram type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
/dev/loop0 on /home/root/mnt type ext4 (rw,relatime)
root@qemux86-64:~#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32261</commentid>
    <comment_count>2</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2013-04-17 05:56:25 +0000</bug_when>
    <thetext>mine is .iso image</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32282</commentid>
    <comment_count>3</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-04-17 12:05:25 +0000</bug_when>
    <thetext>It looks like the command works just fine if passing the -t iso9660 to the mount command. I think the checking done in the mentioned patch is not in the right place or some extra checking must be added.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32286</commentid>
    <comment_count>4</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-04-17 12:47:19 +0000</bug_when>
    <thetext>Apparently, when it tries to mount the image as &apos;fat&apos;, it exits with ENODEV and bails out. It doesn&apos;t have a chance to try &apos;iso&apos;.

strace output:
mount(&quot;/dev/loop0&quot;, &quot;tmp/&quot;, &quot;ext4&quot;, MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount(&quot;/dev/loop0&quot;, &quot;tmp/&quot;, &quot;ext3&quot;, MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount(&quot;/dev/loop0&quot;, &quot;tmp/&quot;, &quot;ext2&quot;, MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount(&quot;/dev/loop0&quot;, &quot;tmp/&quot;, &quot;vfat&quot;, MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount(&quot;/dev/loop0&quot;, &quot;tmp/&quot;, &quot;fat&quot;, MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 ENODEV (No such device)

So, if the image type is not configured in the kernel, it&apos;ll always return ENODEV. So, perhaps, we should not check for ENODEV. Bail out only if we get ENOMEDIUM. I&apos;ll give it a test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32315</commentid>
    <comment_count>5</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-04-17 13:54:49 +0000</bug_when>
    <thetext>Sent a fix for this on oecore mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32336</commentid>
    <comment_count>6</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-04-18 07:28:07 +0000</bug_when>
    <thetext>Fix merged:
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=ef0e1cc32d19390626a9da6a948632ffacb242ac</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>