This is my code(Imported from UTM, which is broken):
qemu-system-aarch64 -L /Users/brandon/Applications/UTM.app/Contents/Resources/qemu -S -spice "unix=on,addr=/Users/---/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/0F075A81-8EDB-4245-B17D-061AA68FD704.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=on" -chardev spiceport,id=org.qemu.monitor.qmp,name=org.qemu.monitor.qmp.0 -mon chardev=org.qemu.monitor.qmp,mode=control -nodefaults -vga none -device virtio-net-pci,mac=AE:AF:A6:1C:D7:8B,netdev=net0 -netdev vmnet-shared,id=net0 -device virtio-gpu-gl-pci -cpu host -smp cpus=8,sockets=1,cores=8,threads=1 -machine virt -accel hvf -drive if=pflash,format=raw,unit=0,file=/Users/---/Applications/UTM.app/Contents/Resources/qemu/edk2-aarch64-code.fd,readonly=on -drive "if=pflash,unit=1,file=/Users/---/Library/Containers/com.utmapp.UTM/Data/Documents/Windows 11.utm/Data/efi_vars.fd" -m 8192 -device ich9-intel-hda -device hda-duplex -device nec-usb-xhci,id=usb-bus -device usb-tablet,bus=usb-bus.0 -device usb-mouse,bus=usb-bus.0 -device usb-kbd,bus=usb-bus.0 -device qemu-xhci,id=usb-controller-0 -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device usb-storage,drive=driveD7009BCF-2F84-4263-A943-3D3172E42D37,removable=true,bootindex=0,bus=usb-bus.0 -drive if=none,media=cdrom,id=driveD7009BCF-2F84-4263-A943-3D3172E42D37 -device nvme,drive=drive30D3D5C5-0482-4FF1-AF8B-3EC71F330561,serial=30D3D5C5-0482-4FF1-AF8B-3EC71F330561,bootindex=1 -drive "if=none,media=disk,id=drive30D3D5C5-0482-4FF1-AF8B-3EC71F330561,file=/Users/brandon/Library/Containers/com.utmapp.UTM/Data/Documents/Windows 11.utm/Data/30D3D5C5-0482-4FF1-AF8B-3EC71F330561.qcow2,discard=unmap,detect-zeroes=unmap" -device usb-storage,drive=drive72383F72-3B29-4849-B30A-43C8593DEFD3,removable=true,bootindex=2,bus=usb-bus.0 -drive if=none,media=cdrom,id=drive72383F72-3B29-4849-B30A-43C8593DEFD3 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1 -name "Windows 11" -uuid 0F075A81-8EDB-4245-B17D-061AA68FD704 -rtc base=localtime -device virtio-rng-pci
The error says -spice: invalid option.
I tried reinstalling qemu. I expected the VM to boot
That means that when the QEMU binary was built the necessary dependencies for SPICE weren't present, so configure disabled it (it is an optional feature). If you pass configure the option --enable-spice then that will force configure to either enable this feature or else to exit with an error, so you can identify what dependent libraries you need to install.
Related
Was trying to connect to the qemu running on windows to the Host using QEMU Guest Agent.
I started the qemu using this commands
qemu-system-x86_64 -cpu host -enable-kvm -display none -daemonize -m 64G -smp cores=8 -drive file="e2e-VMImage1.qcow2" -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -device usb-tablet,id=input0,bus=usb.0,port=1 -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -nic user,hostfwd=tcp::42-:22 -vnc 10.190.215.107:40 -device vfio-pci,host=0000:1d:00.0 -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -qmp tcp:localhost:4444,server=on,wait=off
when I start qemu-ga on the windows qemu
qemu-ga -m virtio-serial-pci -p /dev/virtio-ports/org.qemu.guest_agent.1
I am getting error
error opening path \.\Global\org.qemu_agent.0: Access is denied
error opening channel
, I have tried several combination.
I am trying to emulate ARM64 Linux on qemu. The following command works:
qemu-system-aarch64 -M virt-6.2 -cpu cortex-a53 -m 1G -smp 4\
-kernel Image.gz \
-append 'earlycon=pl011,0x9000000 console=ttyAMA0 root=/dev/vda rw' \
-drive file=base.img,format=raw,if=virtio \
-nographic
However, the block device type is virtio. To make it work, the virtio driver should be added to the kernel, which I don't want.
After some googling, I tried following command:
qemu-system-aarch64 -M virt-6.2 -cpu cortex-a53 -m 1G -smp 4\
-kernel Image.gz \
-append 'earlycon=pl011,0x9000000 console=ttyAMA0 root=/dev/vda rw' \
-drive file=base.img,format=raw,if=virtio \
-device sdhci-pci -device sd-card,drive=mydrive -drive id=mydrive,if=none,format=raw,file=base2.img \
-nographic
I was expecting an extra sd-card device, but it does not work. The command lsblk shows nothing new, nor can I find anything new under /dev.
So, how can I emulate a block device in qemu without adding new driver to the kernel?
I'm virtualizing an arm64 machine on my x64 system using this command:
"C:\Program Files\qemu\qemu-system-aarch64.exe"
-name "Windows on ARM64"
-M virt,virtualization=true
-cpu cortex-a72
-smp 6
-m 4G
-bios QEMU_EFI.img
-accel tcg,thread=multi
-device VGA
-device ramfb
-device ich9-usb-ehci1
-device nec-usb-xhci
-device usb-kbd
-device usb-mouse
-nic user,model=virtio
-device usb-storage,drive=moredrivers
-drive if=none,id=moredrivers,media=cdrom,file=.\virtio-win-0.1.208.iso
-device usb-storage,drive=drivers
-drive if=none,id=drivers,readonly=on,file=.\drivers.vhdx
-device usb-storage,drive=system
-drive if=none,id=system,format=raw,file=.\system.vhdx
It runs really slowly, the processor having 1Ghz available on all 6 cores, going 100% all times.
Is there any way to increase performance?
I have created a macos virtual machine using qemu cli everything seems to work great so far. My challenge is to convert it to an libvirt xml now.
I'm trying using this command: virsh domxml-from-native qemu-argv but I get the following error with no other info error: this function is not supported by the connection driver: virConnectDomainXMLFromNative
This is my cli command, I'm using Fedora 31
qemu-system-x86_64 -enable-kvm -m 16G \
-cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+aes,+xsave,+avx,+xsaveopt,avx2,+smep \
-boot order=c \
-machine pc-q35-2.9 \
-smp 16,sockets=1,cores=8,threads=2 \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \
-drive if=pflash,format=raw,file=OVMF_VARS-3440x1440.fd \
-smbios type=2 \
-device ich9-intel-hda -device hda-duplex \
-device ide-drive,bus=ide.0,drive=Clover \
-drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'HighSierra/Clover.qcow2' \
-device ide-drive,bus=ide.1,drive=MacHDD \
-drive id=MacHDD,if=none,file=/dev/disk/by-id/ata-SanDisk_SDSSDA120G_163757447010,format=raw \
-nic user,model=e1000-82545em \
-device vfio-pci,host=08:00.0,multifunction=on \
-device vfio-pci,host=08:00.1 \
-rtc clock=host,base=localtime \
-vga none \
-nographic \
-serial none \
-parallel none \
-usb \
-device usb-host,hostbus=5,hostport=4 \
-device usb-host,hostbus=5,hostport=4.1 \
-device usb-host,hostbus=5,hostport=4.2 \
-device usb-host,hostbus=5,hostport=4.3 \
-device usb-host,hostbus=5,hostport=4.4
I have no clue where to start, the documentation for this function is almost nonexistent
Unfortunately support for the domxml-from-native command has been removed from recentish libvirt, because we found that in practice it was too unreliable and incomplete to be useful.
Your best bet for importing a pre-existing disk image to libvirt is to use the "virt-install" command with its "--import" flag. You can use the various other args to define the disks, NICs, etc.
The only thing I think you'll have trouble with is the "isa-applesmc" device as I don't think libvirt supports that. For that you will need to edit the XML virt-intsall has created, and then add a passthrough option as illustrated here https://libvirt.org/drvqemu.html#qemucommand
I have just found out that if you run QEMU with -monitor telnet::45454,server,nowait -nographic, then Ctrl-C kills the QEMU VM instead of generating SIGINT on the guest: How to pass Ctrl-C to the guest when running qemu with -nographic? | Unix & Linux Stack Exchange
However, I don't want to remove -monitor because it is convenient to automate monitor commands, e.g. it allows me to create a helper script that does:
echo 'savevm my_snap_id' | telnet localhost 45454
Is there a way to both keep my Ctrl-C and -monitor working with -nographic?
Full QEMU command:
qemu-system-x86_64 -append 'root=/dev/vda console=ttyS0' -kernel 'bzImage' -drive file='rootfs.ext2.qcow2,if=virtio,format=qcow2' -nographic -monitor telnet::45454,server,nowait
On QEMU 2.10.1, Ubuntu 17.10, full QEMU command:
./x86_64-softmmu/qemu-system-x86_64 \
-append "root=/dev/sda console=ttyS0 nokaslr printk.time=y" \
-drive file="${dir}/out/x86_64/buildroot/images/rootfs.ext2.qcow2,format=qcow2" \
-kernel "${dir}/out/x86_64/buildroot/images/bzImage" \
-nographic \
If I add:
-chardev stdio,id=s1,signal=off \
-serial none -device isa-serial,chardev=s1
then Ctrl+C starts working as desired, but Ctrl+A X does not work to quit QEMU, which is annoying sometimes: I can use telnet to quit, but it requires more typing / automation.
http://lists.nongnu.org/archive/html/qemu-discuss/2018-04/msg00006.html
Add -serial mon:stdio and remove other -serial options
The following satisfies all my requirements:
./x86_64-softmmu/qemu-system-x86_64 \
-append 'root=/dev/vda nopat nokaslr norandmaps printk.devkmsg=on printk.time=y console=ttyS0' \
-drive file="${dir}/out/x86_64/buildroot/images/rootfs.ext2.qcow2,if=virtio,format=qcow2" \
-kernel "${dir}/out/x86_64/buildroot/images/bzImage" \
-nographic \
-monitor telnet::45454,server,nowait \
-serial mon:stdio
Or for aarch64:
./aarch64-softmmu/qemu-system-aarch64 \
-M virt \
-append 'root=/dev/vda nokaslr norandmaps printk.devkmsg=on printk.time=y' \
-cpu cortex-a57 \
-drive file="${dir}/out/aarch64/buildroot/images/rootfs.ext2.qcow2,if=virtio,format=qcow2" \
-kernel "${dir}/out/aarch64/buildroot/images/Image" \
-monitor telnet::45454,server,nowait \
-nographic \
-serial mon:stdio \
Tested on QEMU 9d2a09063922757ec3640d93f6b35921ab95b1c2
(post v2.12.0-rc2).