I'm on Debian 11 (where I'm using the default qemu version 5.2) and I'm trying to boot Fedora 37 using the following qemu commands :
/usr/bin/./qemu-system-x86_64
-enable-kvm
-m 8G
-machine q35,accel=kvm
-smp 8,cores=4
-cpu host,kvm=off
-smp 2,sockets=1,cores=2,threads=1
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd
-device ich9-intel-hda
-device hda-output
-usb -device usb-kbd
-device usb-mouse
-device virtio-net-pci,netdev=net0
-netdev tap,id=net0,ifname=tap0,script=no,downscript=no,vhost=on
-device ich9-ahci,id=sata
-drive id=SystemDisk,if=none,snapshot=off,cache=none,media=disk,format=raw,file=/dev/sdd
-device ide-hd,bus=sata.4,drive=SystemDisk
-device bochs-display
-device pcie-root-port,bus=pcie.0,multifunction=on,port=1,chassis=1,id=port.1 \
Let's say that I have installed Fedora on the partition sdd4 of the SATA disk sdd :
Disk /dev/sdd: 298,09 GiB, 320072933376 bytes, 625142448 sectors
Disk model: HM320JI
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 73A113CC-FF92-447C-9C08-A9B8C7432437
Dispositivo Start Fine Settori Size Tipo
/dev/sdd1 2048 1050623 1048576 512M EFI System
/dev/sdd2 1050624 222515199 221464576 105,6G Linux filesystem
/dev/sdd3 623140864 625141759 2000896 977M Linux swap
/dev/sdd4 222556860 427353734 204796875 97,7G Linux filesystem
(Debian 11 is installed on sdd2 and both the partitions share the same EFI partition (sdd1). I have installed Fedora several times,physically and virtually (using virt-manager),but I always see the same error. Fedora can boot properly if I use virt-manager,but not if I use the qemu parameters that you see above.
Can you give a look at these pictures ?
https://ibb.co/Thpp5L9
https://ibb.co/JxZLyb6
https://ibb.co/Bqh3r6t
the UUID number that you see on the grub menu when Fedora is loaded with virt-manager is different from the UUID number that you see on the grub menu when Fedora is loaded using the qemu parameters. The correct value is the one indicated by virt-manager. I don't know why when I load Fedora using the qemu + kvm directly it shows the old and wrong UUID number that comes from a previous installation and it does not work.
I have booted Fedora using virt-manager and I have regenerated the initramfs with the following command :
sudo dracut --force --no-hostonly --kver 6.0.7-301.fc37.x86_64
but the UIID number is not changed and Fedora does not boot using the qemu parameters.
Now,please give a look at these pics :
https://ibb.co/PwJyT8c
https://ibb.co/0sm7L2p
I have changed the wrong UUID number with the correct one on the grub menu such as the names of the vmlinuz and initramfs files (values taken from booting Fedora using virt-manager,where it works) but it does not boot when I use the qemu parameters.
I'm worried about the line :
-drive id=SystemDisk,if=none,snapshot=off,cache=none,media=disk,format=raw,file=/dev/sdd.
Maybe should I change that file= option to be a reference to a location in /dev/disk/by-id/ata-something ? I'm having some troubles to find the correct parameters to pass to qemu.