Skip to content

Instantly share code, notes, and snippets.

Created September 5, 2022 15:45
What would you like to do?
Create 32-bit Debian Sid armhf VM
Install Sid from the correct mini.iso
mkdir debian-arm7hf
cd debian-arm7hf
qemu-img create -f qcow2 debian-arm.qcow2 16G
Use 80 x 24 terminal
qemu-system-arm -M virt -kernel ./vmlinuz -initrd ./initrd.gz -nographic -m 1024M -append "console=ttyAMA0 root=/dev/vda2" -drive file=mini.iso,id=cdrom,if=none,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom -netdev tap,id=hostnet0 -device virtio-net-device,netdev=hostnet0,id=net0 -drive file=debian-arm.qcow2,id=hd,if=none -device virtio-blk-device,drive=hd
Run the installer until installing grub fails.
Go back to the main menu and choose Execute a Shell
chroot /target /bin/bash
mkdir /boot/grub
apt install grub-uboot-bin grub2-common
mount -t sysfs sysfs /sys
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/vda2
Ignore the "Installing GRUB" screen, it will go back to the main menu.
Choose the menu option that allows you to continue without a boot loader.
Ignore the "Installing GRUB" screen, it will switch to "Finishing the installation".
Sadly you can't just shut the VM down at this point. You have to reboot it and then shut it down.
The reboot will leave you on the installer. Quit Qemu with Ctrl-a then x
Use the reset command to undo terminal settings left by the installer.
On the VM host run
sudo virt-ls -a debian-arm.qcow2 /boot/
Pick the newest kernel and initrd names. They might be different than the following ones:
sudo virt-copy-out -a debian-arm.qcow2 /boot/vmlinuz-5.18.0-4-armmp-lpae /boot/initrd.img-5.18.0-4-armmp-lpae .
Don't forget the trailing period with a space before it.
I like using the names with version numbers because it helps keep track of those files when you need to repeat this after the kernel is upgraded.
qemu-system-arm -M virt -kernel ./vmlinuz-5.18.0-4-armmp-lpae -initrd ./initrd.img-5.18.0-4-armmp-lpae -nographic -m 1024M -append "console=ttyAMA0 root=/dev/vda2" -netdev tap,id=hostnet0 -device virtio-net-device,netdev=hostnet0,id=net0 -drive file=debian-arm.qcow2,id=hd,if=none -device virtio-blk-device,drive=hd
When the VM boots you can ssh into it.
Copy link

ambiamber commented Sep 5, 2022

If you try to run any of the commands and they are not installed on your VM host:

  1. Debian/Ubuntu install apt-file
  2. Enterprise Linux (RHEL, etc.) and Fedora use dnf provides
  3. Arch use pacman -Fy

To find the package with the command

Copy link

The mini.iso may not give you Debian unstable (Sid). You can follow the official instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment