1

I would like to use my Linux host to update and upgrade a Raspian image. Can this be done?

I know you can mount the image and make permanent changes, see e.g. https://raspberrypi.stackexchange.com/a/13138/101680

The reason I want to do this is I have a Pi Zero that won't boot. I suspect a bug in Raspian Buster and would like to experiment with the latest changes (Pi Zero USB On The Go cannot connect)

Peter Bill
  • 339
  • 2
  • 8

1 Answers1

1

You should be able to use Qemu User Emulation to accomplish this via chroot. Its a similar sort of setup to debootsrapping a foreign arch but you'll already have the OS installed.

This assumes your host is Debian based - i'd assume the Qemu stuff is available on other distros though.

Important steps from the Debian Wiki

sudo apt-get install qemu binfmt-support qemu-user-static

Mount your Pi SD card somewhere on your linux host

mkdir /tmp/pizero
sudo mount /dev/mmcblks0p1 /tmp/pizero (or whatever it is called on your system)

Copy the Qemu binary onto the pi SD card (can be deleted when you've finished) - might not need to do this anymore though.
cp /usr/bin/qemu-arm-static /tmp/pizero/usr/bin

Chroot into the Pi and you can then treat it as if it was running natively.
sudo chroot /tmp/pizero

and you should end up as root on the Pi and able to run apt and stuff against the Pi FS.