| Summary: | busybox/mount fails to mount loop devices | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Khem Raj <raj.khem> |
| Component: | core | Assignee: | Saul Wold <sgw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium+ | CC: | laurentiu.palcu, meta.mr.watcher, meta.watcher |
| Version: | 1.4 | ||
| Target Milestone: | 1.1.2 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | --- | |
|
Description
Khem Raj
2013-04-16 09:34:53 UTC
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 -> /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:~# mine is .iso image 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. Apparently, when it tries to mount the image as 'fat', it exits with ENODEV and bails out. It doesn't have a chance to try 'iso'.
strace output:
mount("/dev/loop0", "tmp/", "ext4", MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/loop0", "tmp/", "ext3", MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/loop0", "tmp/", "ext2", MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/loop0", "tmp/", "vfat", MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 EINVAL (Invalid argument)
mount("/dev/loop0", "tmp/", "fat", MS_NOATIME|MS_NODIRATIME|MS_SILENT, NULL) = -1 ENODEV (No such device)
So, if the image type is not configured in the kernel, it'll always return ENODEV. So, perhaps, we should not check for ENODEV. Bail out only if we get ENOMEDIUM. I'll give it a test.
Sent a fix for this on oecore mailing list. |