Repository: systemd/mkosi

Issue:
mkosi qemu failes to boot (Host Ubuntu 23.04)
mkosi version: commit 3d0137492cd66bbe8ad9f2db247dcca034b1ede6 (recent main)
mkosi.conf

```
[Output]
Format=disk

[Host]
ToolsTree=default
# sqtpm cause another error -> apparmor!
QemuSwtpm=False
# setup qemu to exit on kernel panic
# https://unix.stackexchange.com/questions/443017/can-i-make-qemu-exit-with-failure-on-kernel-panic
QemuArgs=-no-reboot
KernelCommandLineExtra=panic=-1

[Content]
Bootable=true
RootPassword=root
WithDocs=false

[Packages]
WithNetwork=true

[Distribution]
Distribution=ubuntu
Release=focal
# this is just the initial setup, we will replace the sources.list inside the image via mkosi.extra/ directory
# so this setting applies only during the initial setup
Repositories=main,universe

[Output]
OutputDirectory=../../out/ubuntu

[Content]
Autologin=yes
Packages=linux-image-generic
         systemd 
         systemd-sysv
         udev
         dbus
         apt
         sudo
         wget
         curl
         gpg
         ca-certificates
```

mkosi.repart/

```
00-esp.conf -> default with SizeMin/MaxBytes=2048M
20-root.conf -> default with Minimize=guess, Format=btrfs
```

Extra tree exists but is omitted here (just a /data/testfile).
When trying to boot this image with mkosi qemu, I get a kernel panic:

```
$ mkosi --image=ubuntu qemu
BdsDxe: loading Boot0001 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0x3,0x0)/Scsi(0x1,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0x3,0x0)/Scsi(0x1,0x0)
[    0.000000] Linux version 5.4.0-171-generic (buildd@lcy02-amd64-005) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #189-Ubuntu SMP Fri Jan 5 14:23:02 UTC 2024 (Ubuntu 5.4.0-171.189-generic 5.4.259)
[    0.000000] Command line: console=ttyS0
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Hygon HygonGenuine
[    0.000000]   Centaur CentaurHauls
[    0.000000]   zhaoxin   Shanghai  
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000002ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000030000-0x000000000004ffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000050000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007e8ebfff] usable
[    0.000000] BIOS-e820: [mem 0x000000007e8ec000-0x000000007eaebfff] reserved
[    0.000000] BIOS-e820: [mem 0x000000007eaec000-0x000000007eb73fff] usable
[    0.000000] BIOS-e820: [mem 0x000000007eb74000-0x000000007eb7dfff] ACPI data
[    0.000000] BIOS-e820: [mem 0x000000007eb7e000-0x000000007ebfdfff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000007ebfe000-0x000000007effffff] usable
[    0.000000] BIOS-e820: [mem 0x000000007f000000-0x000000007fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] extended physical RAM map:
[    0.000000] reserve setup_data: [mem 0x0000000000000000-0x000000000002ffff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000030000-0x000000000004ffff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000000050000-0x000000000009ffff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000100000-0x000000007d13a017] usable
[    0.000000] reserve setup_data: [mem 0x000000007d13a018-0x000000007d176e57] usable
[    0.000000] reserve setup_data: [mem 0x000000007d176e58-0x000000007e8ebfff] usable
[    0.000000] reserve setup_data: [mem 0x000000007e8ec000-0x000000007eaebfff] reserved
[    0.000000] reserve setup_data: [mem 0x000000007eaec000-0x000000007eb73fff] usable
[    0.000000] reserve setup_data: [mem 0x000000007eb74000-0x000000007eb7dfff] ACPI data
[    0.000000] reserve setup_data: [mem 0x000000007eb7e000-0x000000007ebfdfff] ACPI NVS
[    0.000000] reserve setup_data: [mem 0x000000007ebfe000-0x000000007effffff] usable
[    0.000000] reserve setup_data: [mem 0x000000007f000000-0x000000007fffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] efi: EFI v2.70 by Debian distribution of EDK II
[    0.000000] efi:  SMBIOS=0x7e9d4000  SMBIOS 3.0=0x7e9d2000  ACPI=0x7eb7d000  ACPI 2.0=0x7eb7d014  MEMATTR=0x7d7d2198 
[    0.000000] secureboot: Secure boot disabled
[    0.000000] SMBIOS 3.0.0 present.
[    0.000000] DMI: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 2023.11-6 02/10/2024
[    0.000000] Hypervisor detected: KVM
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 2e801001, primary cpu clock
[    0.000000] kvm-clock: using sched offset of 876089394 cycles
[    0.000001] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[    0.000002] tsc: Detected 2496.000 MHz processor
[    0.000081] last_pfn = 0x7f000 max_arch_pfn = 0x400000000
[    0.000124] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT  
[    0.006335] check: Scanning 1 areas for low memory corruption
[    0.006362] Using GB pages for direct mapping
[    0.006420] secureboot: Secure boot disabled
[    0.006421] RAMDISK: [mem 0x66658000-0x6fe16fff]
[    0.006424] ACPI: Early table checksum verification disabled
[    0.006426] ACPI: RSDP 0x000000007EB7D014 000024 (v02 BOCHS )
[    0.006428] ACPI: XSDT 0x000000007EB7C0E8 00004C (v01 BOCHS  BXPC     00000001      01000013)
[    0.006432] ACPI: FACP 0x000000007EB78000 0000F4 (v03 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006435] ACPI: DSDT 0x000000007EB79000 0020F3 (v01 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006436] ACPI: FACS 0x000000007EBDC000 000040
[    0.006438] ACPI: APIC 0x000000007EB77000 000078 (v03 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006440] ACPI: HPET 0x000000007EB76000 000038 (v01 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006441] ACPI: MCFG 0x000000007EB75000 00003C (v01 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006443] ACPI: WAET 0x000000007EB74000 000028 (v01 BOCHS  BXPC     00000001 BXPC 00000001)
[    0.006444] ACPI: Reserving FACP table memory at [mem 0x7eb78000-0x7eb780f3]
[    0.006445] ACPI: Reserving DSDT table memory at [mem 0x7eb79000-0x7eb7b0f2]
[    0.006445] ACPI: Reserving FACS table memory at [mem 0x7ebdc000-0x7ebdc03f]
[    0.006445] ACPI: Reserving APIC table memory at [mem 0x7eb77000-0x7eb77077]
[    0.006446] ACPI: Reserving HPET table memory at [mem 0x7eb76000-0x7eb76037]
[    0.006446] ACPI: Reserving MCFG table memory at [mem 0x7eb75000-0x7eb7503b]
[    0.006447] ACPI: Reserving WAET table memory at [mem 0x7eb74000-0x7eb74027]
[    0.006609] No NUMA configuration found
[    0.006609] Faking a node at [mem 0x0000000000000000-0x000000007effffff]
[    0.006613] NODE_DATA(0) allocated [mem 0x7ef5d000-0x7ef87fff]
[    0.006711] Zone ranges:
[    0.006711]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.006712]   DMA32    [mem 0x0000000001000000-0x000000007effffff]
[    0.006713]   Normal   empty
[    0.006713]   Device   empty
[    0.006714] Movable zone start for each node
[    0.006715] Early memory node ranges
[    0.006716]   node   0: [mem 0x0000000000001000-0x000000000002ffff]
[    0.006716]   node   0: [mem 0x0000000000050000-0x000000000009ffff]
[    0.006717]   node   0: [mem 0x0000000000100000-0x000000007e8ebfff]
[    0.006717]   node   0: [mem 0x000000007eaec000-0x000000007eb73fff]
[    0.006718]   node   0: [mem 0x000000007ebfe000-0x000000007effffff]
[    0.006894] Zeroed struct page in unavailable ranges: 4875 pages
[    0.006895] Initmem setup node 0 [mem 0x0000000000001000-0x000000007effffff]
[    0.010477] ACPI: PM-Timer IO Port: 0x608
[    0.010485] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.010510] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.010511] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.010512] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.010513] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.010513] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.010514] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.010517] Using ACPI (MADT) for SMP configuration information
[    0.010518] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.010520] TSC deadline timer available
[    0.010521] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.010533] KVM setup pv sched yield
[    0.010539] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.010540] PM: Registered nosave memory: [mem 0x00030000-0x0004ffff]
[    0.010541] PM: Registered nosave memory: [mem 0x000a0000-0x000fffff]
[    0.010542] PM: Registered nosave memory: [mem 0x7d13a000-0x7d13afff]
[    0.010542] PM: Registered nosave memory: [mem 0x7d176000-0x7d176fff]
[    0.010543] PM: Registered nosave memory: [mem 0x7e8ec000-0x7eaebfff]
[    0.010544] PM: Registered nosave memory: [mem 0x7eb74000-0x7eb7dfff]
[    0.010544] PM: Registered nosave memory: [mem 0x7eb7e000-0x7ebfdfff]
[    0.010545] [mem 0x80000000-0xdfffffff] available for PCI devices
[    0.010546] Booting paravirtualized kernel on KVM
[    0.010548] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.010551] setup_percpu: NR_CPUS:8192 nr_cpumask_bits:1 nr_cpu_ids:1 nr_node_ids:1
[    0.010634] percpu: Embedded 60 pages/cpu s208896 r8192 d28672 u2097152
[    0.010651] setup async PF for cpu 0
[    0.010655] kvm-stealtime: cpu 0, msr 7aa32040
[    0.010659] Built 1 zonelists, mobility grouping on.  Total pages: 509247
[    0.010660] Policy zone: DMA32
[    0.010661] Kernel command line: console=ttyS0
[    0.010733] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.010764] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.010789] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.013308] Memory: 1794296K/2077652K available (14339K kernel code, 2395K rwdata, 9288K rodata, 2768K init, 17228K bss, 283356K reserved, 0K cma-reserved)
[    0.013679] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.013713] ftrace: allocating 44720 entries in 175 pages
[    0.022605] ftrace: allocated 175 pages with 6 groups
[    0.022702] rcu: Hierarchical RCU implementation.
[    0.022702] rcu: 	RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=1.
[    0.022703] 	Tasks RCU enabled.
[    0.022704] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.022704] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.024122] NR_IRQS: 524544, nr_irqs: 256, preallocated irqs: 16
[    0.024236] random: crng init done
[    0.024248] Console: colour dummy device 80x25
[    0.078325] printk: console [ttyS0] enabled
[    0.078615] ACPI: Core revision 20190816
[    0.078960] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.079618] APIC: Switch to symmetric I/O mode setup
[    0.080093] x2apic enabled
[    0.080424] Switched APIC routing to physical x2apic.
[    0.080754] KVM setup pv IPIs
[    0.081611] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.082024] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x23fa772cf26, max_idle_ns: 440795269835 ns
[    0.082713] Calibrating delay loop (skipped) preset value.. 4992.00 BogoMIPS (lpj=9984000)
[    0.083338] x86/cpu: User Mode Instruction Prevention (UMIP) activated
[    0.086779] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.087129] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.087515] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.088068] Spectre V2 : Mitigation: Enhanced IBRS
[    0.088355] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.088836] Spectre V2 : Spectre v2 / PBRSB-eIBRS: Retire a single CALL on VMEXIT
[    0.089272] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier
[    0.089762] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
[    0.090343] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.090712] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.091090] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.091468] x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask'
[    0.091851] x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256'
[    0.092244] x86/fpu: Supporting XSAVE feature 0x080: 'AVX-512 ZMM_Hi256'
[    0.092641] x86/fpu: Supporting XSAVE feature 0x200: 'Protection Keys User registers'
[    0.093108] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.093475] x86/fpu: xstate_offset[5]:  832, xstate_sizes[5]:   64
[    0.093844] x86/fpu: xstate_offset[6]:  896, xstate_sizes[6]:  512
[    0.094212] x86/fpu: xstate_offset[7]: 1408, xstate_sizes[7]: 1024
[    0.094712] x86/fpu: xstate_offset[9]: 2432, xstate_sizes[9]:    8
[    0.095076] x86/fpu: Enabled xstate features 0x2e7, context size is 2440 bytes, using 'compacted' format.
[    0.098158] Freeing SMP alternatives memory: 40K
[    0.099849] pid_max: default: 32768 minimum: 301
[    0.100943] LSM: Security Framework initializing
[    0.101249] Yama: becoming mindful.
[    0.101482] AppArmor: AppArmor initialized
[    0.101759] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.102219] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.102713] *** VALIDATE tmpfs ***
[    0.103012] *** VALIDATE proc ***
[    0.103252] *** VALIDATE cgroup1 ***
[    0.103477] *** VALIDATE cgroup2 ***
[    0.103771] smpboot: CPU0: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (family: 0x6, model: 0x8d, stepping: 0x1)
[    0.104485] Performance Events: Icelake events, full-width counters, Intel PMU driver.
[    0.104997] ... version:                2
[    0.105250] ... bit width:              48
[    0.105507] ... generic registers:      8
[    0.105758] ... value mask:             0000ffffffffffff
[    0.106097] ... max period:             00007fffffffffff
[    0.106448] ... fixed-purpose events:   3
[    0.106703] ... event mask:             00000007000000ff
[    0.106711] rcu: Hierarchical SRCU implementation.
[    0.106750] smp: Bringing up secondary CPUs ...
[    0.107036] smp: Brought up 1 node, 1 CPU
[    0.107292] smpboot: Max logical packages: 1
[    0.107555] smpboot: Total of 1 processors activated (4992.00 BogoMIPS)
[    0.108078] devtmpfs: initialized
[    0.108307] x86/mm: Memory block size: 128MB
[    0.108678] PM: Registering ACPI NVS region [mem 0x7eb7e000-0x7ebfdfff] (524288 bytes)
[    0.109192] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.109793] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.110229] pinctrl core: initialized pinctrl subsystem
[    0.110623] PM: RTC time: 14:11:59, date: 2024-02-13
[    0.110771] NET: Registered protocol family 16
[    0.111082] audit: initializing netlink subsys (disabled)
[    0.111474] EISA bus registered
[    0.111669] cpuidle: using governor ladder
[    0.111921] cpuidle: using governor menu
[    0.112176] KVM setup pv remote TLB flush
[    0.112431] ACPI: bus type PCI registered
[    0.112679] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.113123] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    0.113684] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in E820
[    0.114102] PCI: Using configuration type 1 for base access
[    0.114717] audit: type=2000 audit(1707833520.511:1): state=initialized audit_enabled=0 res=1
[    0.115734] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.116147] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.116918] ACPI: Added _OSI(Module Device)
[    0.117183] ACPI: Added _OSI(Processor Device)
[    0.117452] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.117735] ACPI: Added _OSI(Processor Aggregator Device)
[    0.118059] ACPI: Added _OSI(Linux-Dell-Video)
[    0.118327] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.118646] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.119473] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.120164] ACPI: Interpreter enabled
[    0.120398] ACPI: (supports S0 S4 S5)
[    0.120619] ACPI: Using IOAPIC for interrupt routing
[    0.120928] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.121516] ACPI: Enabled 2 GPEs in block 00 to 3F
[    0.122679] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.122728] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
[    0.123317] acpi PNP0A08:00: _OSC: platform does not support [PCIeHotplug LTR]
[    0.123790] acpi PNP0A08:00: _OSC: OS now controls [SHPCHotplug PME AER PCIeCapability]
[    0.124357] PCI host bridge to bus 0000:00
[    0.124608] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.125016] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.125423] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.125871] pci_bus 0000:00: root bus resource [mem 0x80000000-0xdfffffff window]
[    0.126325] pci_bus 0000:00: root bus resource [mem 0xf0000000-0xfebfffff window]
[    0.126755] pci_bus 0000:00: root bus resource [mem 0x7000000000-0x77ffffffff window]
[    0.127222] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.127570] pci 0000:00:00.0: [8086:29c0] type 00 class 0x060000
[    0.128329] pci 0000:00:01.0: [1af4:1000] type 00 class 0x020000
[    0.129210] pci 0000:00:01.0: reg 0x10: [io  0x60c0-0x60df]
[    0.131117] pci 0000:00:01.0: reg 0x20: [mem 0x7000000000-0x7000003fff 64bit pref]
[    0.131964] pci 0000:00:01.0: reg 0x30: [mem 0xfffc0000-0xffffffff pref]
[    0.132826] pci 0000:00:02.0: [1af4:1005] type 00 class 0x00ff00
[    0.133822] pci 0000:00:02.0: reg 0x10: [io  0x60a0-0x60bf]
[    0.134719] pci 0000:00:02.0: reg 0x14: [mem 0x80042000-0x80042fff]
[    0.136750] pci 0000:00:02.0: reg 0x20: [mem 0x7000004000-0x7000007fff 64bit pref]
[    0.138316] pci 0000:00:03.0: [1af4:1004] type 00 class 0x010000
[    0.139394] pci 0000:00:03.0: reg 0x10: [io  0x6040-0x607f]
[    0.140777] pci 0000:00:03.0: reg 0x14: [mem 0x80041000-0x80041fff]
[    0.142257] pci 0000:00:03.0: reg 0x20: [mem 0x7000008000-0x700000bfff 64bit pref]
[    0.148242] pci 0000:00:1f.0: [8086:2918] type 00 class 0x060100
[    0.148811] pci 0000:00:1f.0: quirk: [io  0x0600-0x067f] claimed by ICH6 ACPI/GPIO/TCO
[    0.149364] pci 0000:00:1f.2: [8086:2922] type 00 class 0x010601
[    0.151163] pci 0000:00:1f.2: reg 0x20: [io  0x6080-0x609f]
[    0.152348] pci 0000:00:1f.2: reg 0x24: [mem 0x80040000-0x80040fff]
[    0.153091] pci 0000:00:1f.3: [8086:2930] type 00 class 0x0c0500
[    0.154101] pci 0000:00:1f.3: reg 0x20: [io  0x6000-0x603f]
[    0.155072] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.155445] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.155810] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.156177] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.156543] ACPI: PCI Interrupt Link [LNKE] (IRQs 5 *10 11)
[    0.156908] ACPI: PCI Interrupt Link [LNKF] (IRQs 5 *10 11)
[    0.157273] ACPI: PCI Interrupt Link [LNKG] (IRQs 5 10 *11)
[    0.157639] ACPI: PCI Interrupt Link [LNKH] (IRQs 5 10 *11)
[    0.157982] ACPI: PCI Interrupt Link [GSIA] (IRQs *16)
[    0.158294] ACPI: PCI Interrupt Link [GSIB] (IRQs *17)
[    0.158601] ACPI: PCI Interrupt Link [GSIC] (IRQs *18)
[    0.158717] ACPI: PCI Interrupt Link [GSID] (IRQs *19)
[    0.159024] ACPI: PCI Interrupt Link [GSIE] (IRQs *20)
[    0.159330] ACPI: PCI Interrupt Link [GSIF] (IRQs *21)
[    0.159637] ACPI: PCI Interrupt Link [GSIG] (IRQs *22)
[    0.159943] ACPI: PCI Interrupt Link [GSIH] (IRQs *23)
[    0.160395] iommu: Default domain type: Translated 
[    0.160826] SCSI subsystem initialized
[    0.161092] vgaarb: loaded
[    0.161268] ACPI: bus type USB registered
[    0.161520] usbcore: registered new interface driver usbfs
[    0.162043] usbcore: registered new interface driver hub
[    0.162364] usbcore: registered new device driver usb
[    0.162678] pps_core: LinuxPPS API ver. 1 registered
[    0.162713] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.163253] PTP clock support registered
[    0.163504] EDAC MC: Ver: 3.0.0
[    0.163775] Registered efivars operations
[    0.164041] PCI: Using ACPI for IRQ routing
[    0.235650] NetLabel: Initializing
[    0.235856] NetLabel:  domain hash size = 128
[    0.236115] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.236466] NetLabel:  unlabeled traffic allowed by default
[    0.238352] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.238650] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.243733] clocksource: Switched to clocksource kvm-clock
[    0.248360] *** VALIDATE bpf ***
[    0.248594] VFS: Disk quotas dquot_6.6.0
[    0.248839] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.249263] *** VALIDATE ramfs ***
[    0.249472] *** VALIDATE hugetlbfs ***
[    0.249699] AppArmor: AppArmor Filesystem Enabled
[    0.249699] pnp: PnP ACPI init
[    0.249699] system 00:04: [mem 0xe0000000-0xefffffff window] has been reserved
[    0.250871] pnp: PnP ACPI: found 5 devices
[    0.251535] thermal_sys: Registered thermal governor 'fair_share'
[    0.251535] thermal_sys: Registered thermal governor 'bang_bang'
[    0.251909] thermal_sys: Registered thermal governor 'step_wise'
[    0.252272] thermal_sys: Registered thermal governor 'user_space'
[    0.252634] thermal_sys: Registered thermal governor 'power_allocator'
[    0.257504] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.258445] pci 0000:00:01.0: can't claim BAR 6 [mem 0xfffc0000-0xffffffff pref]: no compatible bridge window
[    0.259038] pci 0000:00:01.0: BAR 6: assigned [mem 0x80000000-0x8003ffff pref]
[    0.259470] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    0.259840] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    0.260207] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.260617] pci_bus 0000:00: resource 7 [mem 0x80000000-0xdfffffff window]
[    0.261020] pci_bus 0000:00: resource 8 [mem 0xf0000000-0xfebfffff window]
[    0.261423] pci_bus 0000:00: resource 9 [mem 0x7000000000-0x77ffffffff window]
[    0.261872] NET: Registered protocol family 2
[    0.262160] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.262768] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.263295] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.263788] TCP bind hash table entries: 16384 (order: 6, 262144 bytes, linear)
[    0.264224] TCP: Hash tables configured (established 16384 bind 16384)
[    0.264633] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.265029] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.265466] NET: Registered protocol family 1
[    0.265728] NET: Registered protocol family 44
[    0.266021] PCI: CLS 0 bytes, default 64
[    0.266278] Trying to unpack rootfs image as initramfs...
[    0.269049] Initramfs unpacking failed: invalid magic at start of compressed archive
[    0.281106] Freeing initrd memory: 155388K
[    0.281386] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x23fa772cf26, max_idle_ns: 440795269835 ns
[    0.281988] check: Scanning for low memory corruption every 60 seconds
[    0.282541] Initialise system trusted keyrings
[    0.282809] Key type blacklist registered
[    0.283063] workingset: timestamp_bits=36 max_order=19 bucket_order=0
[    0.283943] zbud: loaded
[    0.284245] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.284656] fuse: init (API version 7.31)
[    0.284898] *** VALIDATE fuse ***
[    0.285096] *** VALIDATE fuse ***
[    0.285331] Platform Keyring initialized
[    0.287533] Key type asymmetric registered
[    0.287782] Asymmetric key parser 'x509' registered
[    0.288071] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.288550] io scheduler mq-deadline registered
[    0.288868] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[    0.289318] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.289771] ACPI: Power Button [PWRF]
[    0.290234] PCI Interrupt Link [GSIF] enabled at IRQ 21
[    0.291026] PCI Interrupt Link [GSIG] enabled at IRQ 22
[    0.291768] PCI Interrupt Link [GSIH] enabled at IRQ 23
[    0.292462] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.314605] 00:02: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.315528] Linux agpgart interface v0.103
[    0.410776] loop: module loaded
[    0.412090] tun: Universal TUN/TAP device driver, 1.6
[    0.413450] PPP generic driver version 2.4.2
[    0.414601] VFIO - User Level meta-driver version: 0.3
[    0.415965] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.417457] ehci-pci: EHCI PCI platform driver
[    0.418058] ehci-platform: EHCI generic platform driver
[    0.418365] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.418734] ohci-pci: OHCI PCI platform driver
[    0.418998] ohci-platform: OHCI generic platform driver
[    0.419306] uhci_hcd: USB Universal Host Controller Interface driver
[    0.419714] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    0.420589] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.420887] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.421231] mousedev: PS/2 mouse device common for all mice
[    0.421662] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    0.422320] rtc_cmos 00:03: RTC can wake from S4
[    0.422804] rtc_cmos 00:03: registered as rtc0
[    0.423077] rtc_cmos 00:03: alarms up to one day, y3k, 242 bytes nvram, hpet irqs
[    0.423534] i2c /dev entries driver
[    0.423766] device-mapper: uevent: version 1.0.3
[    0.424065] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[    0.424588] platform eisa.0: Probing EISA bus 0
[    0.424861] platform eisa.0: EISA: Cannot allocate resource for mainboard
[    0.425266] platform eisa.0: Cannot allocate resource for EISA slot 1
[    0.425651] platform eisa.0: Cannot allocate resource for EISA slot 2
[    0.426037] platform eisa.0: Cannot allocate resource for EISA slot 3
[    0.426444] platform eisa.0: Cannot allocate resource for EISA slot 4
[    0.426823] platform eisa.0: Cannot allocate resource for EISA slot 5
[    0.427197] platform eisa.0: Cannot allocate resource for EISA slot 6
[    0.427570] platform eisa.0: Cannot allocate resource for EISA slot 7
[    0.427943] platform eisa.0: Cannot allocate resource for EISA slot 8
[    0.428321] platform eisa.0: EISA: Detected 0 cards
[    0.428611] intel_pstate: CPU model not supported
[    0.428891] ledtrig-cpu: registered to indicate activity on CPUs
[    0.429245] EFI Variables Facility v0.08 2004-May-17
[    0.430896] drop_monitor: Initializing network drop monitor service
[    0.431346] NET: Registered protocol family 10
[    0.431805] Segment Routing with IPv6
[    0.432044] NET: Registered protocol family 17
[    0.432323] Key type dns_resolver registered
[    0.432620] RAS: Correctable Errors collector initialized.
[    0.432952] IPI shorthand broadcast: enabled
[    0.433214] sched_clock: Marking stable (376002793, 54486111)->(431339862, -850958)
[    0.433695] registered taskstats version 1
[    0.433946] Loading compiled-in X.509 certificates
[    0.434536] Loaded X.509 cert 'Build time autogenerated kernel key: 18834757a2cf2ab485937c6c161822e3c9988018'
[    0.435384] Loaded X.509 cert 'Canonical Ltd. Live Patch Signing: 14df34d1a87cf37625abec039ef2bf521249b969'
[    0.436219] Loaded X.509 cert 'Canonical Ltd. Kernel Module Signing: 88f752e560a1e0737e31163a466ad7b70a850c19'
[    0.436809] blacklist: Loading compiled-in revocation X.509 certificates
[    0.437250] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing: 61482aa2830d0ab2ad5af10b7250da9033ddcef0'
[    0.437852] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (2017): 242ade75ac4a15e50d50c84b0d45ff3eae707a03'
[    0.438519] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (ESM 2018): 365188c1d374d6b07c3c8f240f8ef722433d6a8b'
[    0.439144] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (2019): c0746fd6c5da3ae827864651ad66ae47fe24b3e8'
[    0.439745] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (2021 v1): a8d54bbb3825cfb94fa13c9f8a594a195c107b8d'
[    0.440377] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (2021 v2): 4cf046892d6fd3c9a5b03f98d845f90851dc6a8c'
[    0.440997] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (2021 v3): 100437bb6de6e469b581e61cd66bce3ef4ed53af'
[    0.441617] Loaded X.509 cert 'Canonical Ltd. Secure Boot Signing (Ubuntu Core 2019): c1d57b8f6b743f23ee41f4f7ee292f06eecadfb9'
[    0.442284] zswap: loaded using pool lzo/zbud
[    0.442566] Key type ._fscrypt registered
[    0.442801] Key type .fscrypt registered
[    0.443122] Key type big_key registered
[    0.443377] Key type encrypted registered
[    0.443613] AppArmor: AppArmor sha1 policy hashing enabled
[    0.444085] ima: No TPM chip found, activating TPM-bypass!
[    0.444408] ima: Allocated hash algorithm: sha1
[    0.444674] ima: No architecture policies found
[    0.444940] evm: Initialising EVM extended attributes:
[    0.445238] evm: security.selinux
[    0.445435] evm: security.SMACK64
[    0.445632] evm: security.SMACK64EXEC
[    0.445845] evm: security.SMACK64TRANSMUTE
[    0.446083] evm: security.SMACK64MMAP
[    0.446295] evm: security.apparmor
[    0.446502] evm: security.ima
[    0.446676] evm: security.capability
[    0.446885] evm: HMAC attrs: 0x1
[    0.447234] PM:   Magic number: 12:53:182
[    0.447532] rtc_cmos 00:03: setting system clock to 2024-02-13T14:12:00 UTC (1707833520)
[    0.448198] md: Waiting for all devices to be available before autodetect
[    0.448601] md: If you don't use raid, use raid=noautodetect
[    0.448993] md: Autodetecting RAID arrays.
[    0.449236] md: autorun ...
[    0.449403] md: ... autorun DONE.
[    0.449614] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.450049] Please append a correct "root=" boot option; here are the available partitions:
[    0.450542] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.451024] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.0-171-generic #189-Ubuntu
[    0.451469] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 2023.11-6 02/10/2024
[    0.451945] Call Trace:
[    0.452097]  dump_stack+0x6d/0x8b
[    0.452297]  panic+0x114/0x2f6
[    0.452483]  mount_block_root+0x23f/0x2e8
[    0.452719]  mount_root+0x38/0x3a
[    0.452916]  prepare_namespace+0x13f/0x194
[    0.453158]  kernel_init_freeable+0x265/0x289
[    0.453415]  ? rest_init+0xb0/0xb0
[    0.453617]  kernel_init+0xe/0x110
[    0.453821]  ret_from_fork+0x1f/0x40
[    0.454317] Kernel Offset: 0x36e00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[    0.454949] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
```

I see that the cause seems to be:

 [    0.449614] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6

mkosi qemu executed with sudo does have the same result.

Am I missing something in the configuration?

Additional information:

```
['qemu-system-x86_64', '-machine', 'type=q35,smm=on', '-smp', '1', '-m', '2G', '-object', 'rng-random,filename=/dev/urandom,id=rng0', '-device', 'virtio-rng-pci,rng=rng0,id=rng-device0', '-nic', 'user,model=virtio-net-pci', '-accel', 'kvm', '-cpu', 'max', '-nographic', '-nodefaults', '-chardev', 'stdio,mux=on,id=console,signal=off', '-serial', 'chardev:console', '-mon', 'console', '-drive', 'if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd', '-drive', 'file=/tmp/mkosi-ovmf-vars3mwdjjyw,if=pflash,format=raw', '-global', 'ICH9-LPC.disable_s3=1', '-global', 'driver=cfi.pflash01,property=secure,value=on', '-smbios', 'type=11,value=io.systemd.credential.binary:agetty.autologin=cm9vdA==', '-smbios', 'type=11,value=io.systemd.credential.binary:login.noauth=eWVz', '-smbios', 'type=11,value=io.systemd.credential.binary:firstboot.timezone=RXVyb3BlL0Jlcmxpbg==', '-smbios', 'type=11,value=io.systemd.credential.binary:firstboot.locale=Qy5VVEYtOA==', '-device', 'virtio-scsi-pci,id=scsi', '-drive', 'if=none,id=scratch,file=/var/tmp/mkosi-scratchpwwm6gwm,format=raw', '-device', 'scsi-hd,drive=scratch', '-smbios', 'type=11,value=io.systemd.stub.kernel-cmdline-extra=systemd.wants=network.target module_blacklist=vmw_vmci systemd.tty.term.ttyS0=xterm-256color systemd.tty.columns.ttyS0=342 systemd.tty.rows.ttyS0=54 ip=enc0:any ip=enp0s1:any ip=enp0s2:any ip=host0:any ip=none loglevel=4 SYSTEMD_SULOGIN_FORCE=1 systemd.tty.term.console=xterm-256color systemd.tty.columns.console=342 systemd.tty.rows.console=54 console=ttyS0 panic=-1 systemd.mount-extra=LABEL=scratch:/var/tmp:ext4', '-drive', 'if=none,id=mkosi,file=/home/daniel/XYZ/ubuntu/ubuntu.raw,format=raw', '-device', 'scsi-hd,drive=mkosi,bootindex=1', '-no-reboot']
```



Discussion:

Resolving patch:
diff --git a/mkosi/__init__.py b/mkosi/__init__.py
--- a/mkosi/__init__.py
+++ b/mkosi/__init__.py
@@ -1678,11 +1678,20 @@ def build_kernel_modules_initrd(context: Context, kver: str) -> Path:
         sandbox=context.sandbox,
     )
 
-    # Debian/Ubuntu do not compress their kernel modules, so we compress the initramfs instead. Note that
-    # this is not ideal since the compressed kernel modules will all be decompressed on boot which
-    # requires significant memory.
+
     if context.config.distribution.is_apt_distribution():
-        maybe_compress(context, Compression.zstd, kmods, kmods)
+        # Ubuntu Focal's kernel does not support zstd-compressed initrds so use xz instead.
+        if context.config.distribution == Distribution.ubuntu and context.config.release == "focal":
+            compression = Compression.xz
+        # Older Debian and Ubuntu releases do not compress their kernel modules, so we compress the initramfs instead.
+        # Note that this is not ideal since the compressed kernel modules will all be decompressed on boot which
+        # requires significant memory.
+        elif context.config.distribution == Distribution.debian and context.config.release in ("sid", "testing"):
+            compression = Compression.none
+        else:
+            compression = Compression.zstd
+
+        maybe_compress(context, compression, kmods, kmods)
 
     return kmods
 
diff --git a/mkosi/config.py b/mkosi/config.py
--- a/mkosi/config.py
+++ b/mkosi/config.py
@@ -576,7 +576,10 @@ def config_parse_compress_level(value: Optional[str], old: Optional[int]) -> Opt
 
 def config_default_compression(namespace: argparse.Namespace) -> Compression:
     if namespace.output_format in (OutputFormat.tar, OutputFormat.cpio, OutputFormat.uki, OutputFormat.esp):
-        if namespace.distribution.is_centos_variant() and int(namespace.release) <= 8:
+        if (
+            (namespace.distribution.is_centos_variant() and int(namespace.release) <= 8) or
+            (namespace.distribution == Distribution.ubuntu and namespace.release == "focal")
+        ):
             return Compression.xz
         else:
             return Compression.zstd


Test patch: