Latest Raspbian (2017-07-05-raspbian-jessie) dd: /dev/rdiskX: Invalid argument on OSX and other potential issues with “apt-get” post install

Home / OSX / Latest Raspbian (2017-07-05-raspbian-jessie) dd: /dev/rdiskX: Invalid argument on OSX and other potential issues with “apt-get” post install

So this morning I was trying to install the latest rasbian image onto an uSD card and was getting a strange error when I issued dd. I was using rdisk (BSD raw disk) device to speed up the image writing process (note: I don’t think you get this error if you just use /dev/diskX). The dd process would finish and this error would come up:

 

dd: /dev/rdisk6: Invalid argument
 4445+1 records in
 4445+0 records out
 4660920320 bytes transferred in 133.242184 secs (34980816 bytes/sec)

At first I ignored the error and proceeded to boot the Pi, but as soon as I did apt-get update; apt-get upgrade, I would get dpkg errors like:

dpkg: unrecoverable fatal error, aborting:
 files list file for package 'qdbus' is missing final newline
 E: Sub-process /usr/bin/dpkg returned an error code (2)

Turns out the latest raspbian image has a slight “bug” and does not contain a complete number of blocks (notice 4445+1 records in above). To remedy this I had to add “conv=sync” to the dd command to pad the input blocks to input buffer size (for more info on this do “man dd”). So the complete command looks something like this (note rdisk6 is specific to my setup…..your disk# WILL/MIGHT be different):

sudo dd if=2017-07-05-raspbian-jessie.img of=/dev/rdisk6 bs=1m conv=sync
 4445+1 records in
 4446+0 records out

Note that now there is no more error showing up. Also post boot the apt-get upgrade process does not barf anymore :-)……Happy days……yeeaaa