LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-23-2023, 04:25 PM   #1
letu
LQ Newbie
 
Registered: Jul 2023
Posts: 1

Rep: Reputation: 0
Editing a debian img with QEMU


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
 
Old 07-24-2023, 05:37 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,506

Rep: Reputation: Disabled
Sounds like you really want to 'remaster' the installer image.

https://duckduckgo.com/?t=ftsa&q=how...l+image&ia=web
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Set up qemu-kvm-1.0+noroms as spice enabled qemu server vs qemu-kvm-spice on Ubuntu Precise LXer Syndicated Linux News 0 05-26-2012 07:41 AM
After qemu-img, qemu is not capable to detect the C drive (empty) frenchn00b Linux - General 3 10-18-2009 05:39 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM
[php]Reading url [img] and [/img] hylke Programming 13 08-23-2004 01:58 PM
.img burner or way to boot from a .img American Psycho Linux - Software 4 03-24-2004 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration