Description of problem: mount -o ...sizelimit=... does not get passed to hfsplus loopback. Version-Release number of selected component (if applicable): util-linux-2.21.2-2.fc17.x86_64 How reproducible: always Steps to Reproduce: 1. Obtain the xcode 4.3.3 image from apple devel web site (free registration required) - some other image may work, if one knows how to calculate the offset. 2. mount -t hfsplus -o loop,offset=33280,sizelimit=1975387136,ro xcode_4.3.3_for_lion.dmg /mnt Actual results: mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so [10679.677225] hfs: invalid secondary volume header [10679.677240] hfs: unable to find HFS+ superblock Expected results: Should mount correctly, and dmesg should show: [12194.322495] SELinux: initialized (dev loop0, type hfsplus), uses genfs_contexts Additional info: This works, so the offset/sizelimit parameters are correct: losetup --sizelimit 1975387136 --offset 33280 /dev/loop0 xcode_4.3.3_for_lion.dmg mount -o ro /dev/loop0 /mnt I am filing this as it should be possible to do it in a single mount command, according to the documentation. $ ls -l xcode_4.3.3_for_lion.dmg -rw-------. 1 Hin-Tak Hin-Tak 1975427679 Jul 24 03:51 xcode_4.3.3_for_lion.dmg $ md5sum xcode_4.3.3_for_lion.dmg d6b3a2983320cb11d0ea3f1541323a03 xcode_4.3.3_for_lion.dmg
Please, try LIBMOUNT_DEBUG=0xffff mount -t hfsplus -o loop,offset=33280,sizelimit=1975387136,ro xcode_4.3.3_for_lion.dmg /mnt &> log and add the 'log' file to bugzilla. Thanks.
Created attachment 602082 [details] LIBMOUNT_DEBUG=0xffff ... &> mountlog as requested. LIBMOUNT_DEBUG=0xffff ... &> mountlog as requested.
caveat: I am guessing the end of image (sizelimit) is not passed along correctly, since the error message "hfs: invalid secondary volume header" comes from checking the HFS+ 2nd volume header, which is located at the end of byte-range. For most other partition types (FAT, etc), there is no need to set sizelimit since there is no important information at the end of the partition. I read something about default blocksize of the loopback device also... but in any case, "mount ... -o <loop-options> ..." should work the same way as "losetup <loop-options> /dev/loop0" + "mount /dev/loop0...".
The mount works the same way as losetup, it's the same code which is shared between losetup and mount. I don't see anything wrog in the debug output. BTW, in comment #1 you do not use '-t hfsplus' in the your losetup+mount example, can you try it for the alone mount? I mean: # mount -o offset=33280,sizelimit=1975387136,ro xcode_4.3.3_for_lion.dmg /mnt thanks.
(In reply to comment #4) > The mount works the same way as losetup, it's the same code which is shared > between losetup and mount. I don't see anything wrog in the debug output. > > BTW, in comment #1 you do not use '-t hfsplus' in the your losetup+mount > example, can you try it for the alone mount? I mean: > > # mount -o offset=33280,sizelimit=1975387136,ro xcode_4.3.3_for_lion.dmg > /mnt > > thanks. # mount -o offset=33280,sizelimit=1975387136,ro xcode_4.3.3_for_lion.dmg /mnt mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so # dmesg | tail -2 [100532.597545] hfs: invalid secondary volume header [100532.597564] hfs: unable to find HFS+ superblock Same parameters, two-step process still works: # losetup --offset 33280 --sizelimit 1975387136 /dev/loop0 xcode_4.3.3_for_lion.dmg # mount /dev/loop0 /mnt # dmesg | tail -1 [100601.738595] SELinux: initialized (dev loop0, type hfsplus), uses genfs_contexts
I guess it's already fixed in util-linux >= 2.23-rc2 (-0.5 in Fedora 19). Upstream commit: commit 293714c0d157ae04d08bb587e800c70f05cc4a29 Author: Jeff Mahoney <jeffm> Date: Tue Apr 9 14:32:50 2013 +0200 loopdev: sync capacity after setting it