I have the following Makefile setup to build an image based on 24.04 on a 24.04 system. It is having trouble doing apt update/upgrade due to no networking. The same setup works while building a 22.04 image on a 22.04 system:
export BASE_TAR := noble-server-cloudimg-amd64-root.tar.xz
rootfs.ext4: $(BASE_TAR)
qemu-img create -f raw tmp.$@ 5G
mkfs.ext4 tmp.$@
guestfish --rw --add tmp.$@ --network --mount /dev/sda:/ tar-in $(BASE_TAR) / compress:xz acls:true
virt-df -h -a tmp.$@
virt-customize -v -x --format raw -a tmp.$@ \
--run-command "apt update && apt upgrade -y"
I have qemu 8.2.2 and libvirt 10.0.0 (virsh --version) installed. I noticed two things:
It seems that when qemu system started it up, it failed to bring up the network interface eth0 during running of the init script. That script was looking for either dhclient or dhcpcd, which for 24.04 system, doesn't exist.
One of the argument qemu-system-x86_64 uses was:
-netdev stream,id=usernet,addr.type=unix,addr.path=/run/user/1000/libguestfscnHwJM/passt.sockIt means it was using unix domain docket and passt? while on 22.04 it was using-netdev user,id=usernet,net=169.254.0.0/16. Not sure it was a problem or not. I just knew I ran into a bunch of problems with 24.04's passt apparmor profile.
I can't post the full debug output due to the 30000 character limitation. Here is the part that is most relevant.
libguestfs: command: run: passt libguestfs: command: run: \ --one-off
libguestfs: command: run: \ --socket
/run/user/1000/libguestfsRqcEyQ/passt.sock libguestfs: command: run: \
--pid /run/user/1000/libguestfsRqcEyQ/passt1.pid libguestfs: command: run: \ --address 169.254.2.15 libguestfs: command: run: \ --netmask 16
libguestfs: command: run: \ --mac-addr 52:56:00:00:00:02 libguestfs:
command: run: \ --gateway 169.254.2.2 No routable interface for IPv6:
IPv6 is disabled Template interface: eth0 (IPv4) MAC:
host: 52:56:00:00:00:02 DHCP:
assign: 169.254.2.15
mask: 255.255.0.0
router: 169.254.2.2 DNS:
169.254.2.2 DNS search list:
mshome.net UNIX domain socket bound at /run/user/1000/libguestfsRqcEyQ/passt.sock
You can now start qemu (>= 7.2, with commit 13c6be96618c):
kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=/run/user/1000/libguestfsRqcEyQ/passt.sock
or qrap, for earlier qemu versions:
./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio /usr/bin/qemu-system-x86_64
-global virtio-blk-pci.scsi=off
-no-user-config
-nodefaults
-display none
-machine q35,accel=kvm:tcg,graphics=off
-cpu max,la57=off
-m 1280
-no-reboot
-rtc driftfix=slew
-no-hpet
-global kvm-pit.lost_tick_policy=discard
-kernel /var/tmp/.guestfs-1000/appliance.d/kernel
-initrd /var/tmp/.guestfs-1000/appliance.d/initrd
-object rng-random,filename=/dev/urandom,id=rng0
-device virtio-rng-pci,rng=rng0
-device virtio-scsi-pci,id=scsi
-drive file=/repos/CypressGradientMaker/install/tmp.rootfs.ext4,cache=writeback,format=raw,discard=unmap,id=hd0,if=none
-device scsi-hd,drive=hd0
-drive file=/var/tmp/.guestfs-1000/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none,format=raw
-device scsi-hd,drive=appliance
-device virtio-serial-pci
-serial stdio
-chardev socket,path=/run/user/1000/libguestfsRqcEyQ/guestfsd.sock,id=channel0
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0
-netdev stream,id=usernet,addr.type=unix,addr.path=/run/user/1000/libguestfsRqcEyQ/passt.sock
-device virtio-net-pci,netdev=usernet
-append "panic=1 console=ttyS0 edd=off udevtimeout=6000 udev.event-timeout=6000 no_timer_check printk.time=1
cgroup_disable=memory usbcore.nousb cryptomgr.notests tsc=reliable
8250.nr_uarts=1 root=UUID=8e46b281-78e2-4925-be4a-aad975191a4f selinux=0 guestfs_verbose=1 guestfs_network=1 TERM=xterm-256color"
qemu-system-x86_64: -no-hpet: warning: -no-hpet is deprecated, use
'-machine hpet=off' instead \x1bc\x1b[?7l\x1b[2J\x1b[0mSeaBIOS
(version 1.16.3-debian-1.16.3-2)
iPXE (https://ipxe.org) 00:04.0 C000 PCI2.10 PnP PMM+4EFCA9F0+4EF0A9F0
C000
Press Ctrl-B to configure iPXE (PCI 00:04.0)...
....
- for f in /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd /sbin/udevd /lib/udev/udevd /usr/lib/udev/udevd
- '[' -x /lib/systemd/systemd-udevd ']'
- UDEVD=/lib/systemd/systemd-udevd
- break
- '[' -z /lib/systemd/systemd-udevd ']'
- /lib/systemd/systemd-udevd --daemon
Starting systemd-udevd version 255.4-1ubuntu8.6
- udevadm trigger
- udevadm settle --timeout=600
- shopt -s nullglob
- for f in /sys/block/sd*/device/timeout
- echo 300
- for f in /sys/block/sd*/device/timeout
- echo 300
- for f in /sys/block/{h,s,ub,v}d*/queue/scheduler
- echo noop
/init: line 108: echo: write error: Invalid argument
- for f in /sys/block/{h,s,ub,v}d*/queue/scheduler
- echo noop
/init: line 108: echo: write error: Invalid argument
- shopt -u nullglob
- ip addr add 127.0.0.1/8 brd + dev lo scope host
- ip link set dev lo up
- test 1 = 1
++ ls -I all -I default -I lo /proc/sys/net/ipv4/conf
- iface=eth0
- touch /etc/fstab
- rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved
- dhclient --version
- dhcpcd eth0
/init: line 123: dhcpcd: command not found
++ seq 0 10
- for i in
seq 0 10
- grep nameserver /etc/resolv.conf
grep: /etc/resolv.conf: No such file or directory
- sleep 1
- for i in
seq 0 10
- grep nameserver /etc/resolv.conf
grep: /etc/resolv.conf: No such file or directory
- sleep 1
- for i in
seq 0 10
- grep nameserver /etc/resolv.conf
grep: /etc/resolv.conf: No such file or directory
- sleep 1