Article 6D7BV Editing a debian img with QEMU

Editing a debian img with QEMU

by
letu
from LinuxQuestions.org on (#6D7BV)
Hello,

I'm trying to edit an existing debian img with QEMU.
The goal is to pre-install some packages and configure the distro before installing it to a single board computer.

I'm using fedora as my main distro.
The debian image I want to install is debian 12 and my single board computer is a rock64 armv8.

The main issues I'm facing are:
- I dont know if the qemu command below will edit my image after I complete the installation, does anyone know how can I verify that the installation was successful and the img was written, without booting the installation steps again?
- When I'm on the shell on debian, I dont have access to commands like `apt-get` or `apt`, I cant use sudo or su (commands not found) and also the `home` directory is missing (although it was created through the installation steps) and that beats the purpose of the whole attempt.

Some minor annoyances:
- Extremely slow installation (every attempt it takes me 2-3+ hours), is this normal?
- the `dd` command is very slow (1 hour+), is this normal?
- Pressing ctrl+c when inside the emulation exits qemu (I've done this many times when I'm on shell to cancel commands and resulted on having to do the installation again)
- The colors contrast of the emulation is poor and same for the viewport (adding a '-vga std' did not help_

The steps I'm following are:
- Download the debian image from: https://deb.debian.org/debian/dists/...D-card-images/
- Install `qemu-system-aarch64`
- download the kernel from: https://deb.debian.org/debian/dists/...staller/arm64/
- increase the size of the image by 4 giga bytes so it will have additional space to write our changes: `qemu-img resize debian-installer.img 4G`
- Run qemu:

Code:qemu-system-aarch64 \
-kernel installer-linux \
-cpu cortex-a53 \
-m 1024 \
-M virt \
-no-reboot -serial stdio \
-append "rw root=/dev/mmcblk0p1 panic=0" \
-initrd installer-initrd.gz \
-hda debian-installer.img- Go through the installation (this is extremely slow - it usually takes 2-3 hours and I did it more than 10 times the last days, as Im trying to figure things out)
- before completing the installation and rebooting, I go to the shell and try to install new packages and also add some configs for the users I created

If the above succeeds, I want to:
- Write the img to the sd card: `dd if=debian-installer.img of=/dev/mmcblk0`
- Boot the image to the single board computer
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments