FedoraQt / MediaWriter

Fedora Media Writer - Write Fedora Images to Portable Media
GNU General Public License v2.0
710 stars 155 forks source link

Images not a multiple of the device block size silently fail to write on macOS #611

Open bguzzardi opened 1 year ago

bguzzardi commented 1 year ago

Preface: I understand that FMW isn't really meant to be used in this way.

Writing this OpenWrt image to a USB stick fails with no error message on macOS.

My guess is that because the Fedora Media Writer helper uses /dev/rdiskN instead of /dev/diskN on macOS, writes fail if they aren't a multiple of the device block size, see user astruct's answer on StackExchange/SuperUser. That's consistent with what happens using dd:

# USB Stick isn't bootable
% sudo dd if=openwrt-ipq40xx-chromium-google_wifi-squashfs-factory.bin of=/dev/rdisk4 bs=1M
dd: /dev/rdisk4: Invalid argument
20+1 records in
20+0 records out
20971520 bytes transferred in 3.086768 secs (6794006 bytes/sec)
# USB stick boots OK
% sudo dd if=openwrt-ipq40xx-chromium-google_wifi-squashfs-factory.bin of=/dev/disk4 bs=1M 
20+1 records in
20+1 records out
21129694 bytes transferred in 4.396772 secs (4805729 bytes/sec)

I'm assuming the helper encounters a similar error to dd: /dev/rdisk4: Invalid argument which isn't propagated up from the helper into the UI, and because of #257 there's no verification step to catch the missing partial block at the end either.

Thanks to everyone for the hard work you've put into this useful tool, and I hope this report is helpful.

bguzzardi commented 1 year ago

To avoid confusion/distraction/wild-goose-chases, re-running dd without bs=1M still leaves an incomplete image written:

% sudo dd if=openwrt-ipq40xx-chromium-google_wifi-squashfs-factory.bin of=/dev/rdisk4
dd: /dev/rdisk4: Invalid argument
41268+1 records in
41268+0 records out
21129216 bytes transferred in 17.996230 secs (1174091 bytes/sec)
% sudo dd if=openwrt-ipq40xx-chromium-google_wifi-squashfs-factory.bin of=/dev/disk4
41268+1 records in
41268+1 records out
21129694 bytes transferred in 8.008283 secs (2638480 bytes/sec)

The image file is 21129694 bytes long.