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.
Related
Do qemu 5.1.0-dirty and qemu 5.1.0 versions behave differently?
No error occurs, but it boots with qemu 5.1.0-dirty version and not with 5.1.0. What could be the problem?
/home/pi/qemu/qemu-5.1.0/build/aarch64-softmmu/qemu-system-aarch64 -drive file=/home/pi/images/boot.qcow2,id=disk0,format=raw,if=none,cache=none -monitor null -object rng-random,filename=/dev/random,id=rng0 -cpu host -machine type=virt -device virtio-keyboard-pci -device virtio-rng-pci,rng=rng0 -device virtio-blk-pci,drive=disk0 -serial mon:stdio -kernel /home/pi/kernel/Image-vdt -usb -nodefaults -device virtio-net-pci,netdev=net0,mac=CA:FE:BA:BE:BE:EF,rombar=0 -netdev type=tap,id=net0,ifname=qemu_tap0,script=no,downscript=no -device virtio-gpu-pci,virgl,xres=1680,yres=560 -display sdl,gl=on -device virtio-tablet-pci -show-cursor -m 5G -smp 3 -device qemu-xhci,id=xhci -enable-kvm -append "root=/dev/vda9 ro loglevel=7 audit=0 enforcing=0 console=tty0 fbcon=map:10 video=1680x560-32 mem=5G"
Both versions used the same command line, but only booted
from the qemu 5.1.0-dirty version.
In qemu 5.1.0, which does not boot, the QEMU screen is created, but the phrase 'guest has not initialized the display (yet)' is displayed and it does not proceed any further.
5.1.0-dirty only exists in binaries, and version 5.1.0 was used after compiling the source code.
Use the compile options --enable-sdl --enable-gtk --target-list=aarch64-softmmu .
img1
It should boot normally, but it doesn't.
What is the difference between qemu 5.1.0-dirty and regular qemu 5.1.0?
-dirty on the end of a QEMU version string means "5.1.0 plus any number of unknown extra changes", i.e. it is not a clean upstream version. It could have absolutely anything in it. You would need to find out exactly where the binary came from and what sources it was built from to be able to find out what the differences are between it and a clean 5.1.0.
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.
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'm working with VxWorks, a Real Time Operating System for embedded systems. They recently added QEMU support, and I've been trying to figure it out. (I'm fairly new to all these technologies.) I would like to checkpoint and restart the virtual machine, ie save the RAM and processor state and reload it later from exactly that point.
QEMU has some support for this called "snapshots." However, everything I've seen and tried requires a disk image in qcow2 format. But my simulation has no disk, the program is loaded directly into RAM and run.
Here's my QEMU command:
qemu-system-aarch64 -m 4096M -smp 4 -machnie xlnx-zcu102 -device loader,file=~/vxworks_21.03/workspace3/QEMU_helloWorld/default/vxWorks,addr=0x00100000 -nographic -monitor telnet:127.0.0.1:35163,server,nowait -serial telnet:127.0.0.1:39251,server -device loader,file=~/vxworks_21.03/workspace3/vip_xlnx_zynqmp_smp_64/default/xlnx-zcu102-rev-1.1.dtb,addr=0x0f000000 -device loader,addr=0x000ffffc,data=0xd2a1e000,data-len=4 -device loader,addr=0x000ffffc,cpu-num=0 -nic user -nic user -nic user -nic user,id=n0,hostfwd=tcp:127.0.0.1:0-:1534,hostfwd=udp:127.0.0.1:0-:17185
Then I log into the monitor and:
$ telnet 127.0.0.1 35163
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) savevm
Error: No block device can accept snapshots
I tried a number of things, like creating an empty disk image, or the snapshot_blkdev command, but no luck so far.
The host is RedHat Linux 8.4 running on an x86 desktop, the guest is ARM64.
It turns out that a disk image is required to do snapshots, but you don't have to hook it up to the guest. To do that you pass qemu -drive argument with with if=none. Like this:
-drive if=none,format=qcow2,file=dummy.qcow2
So here is the whole sequence that worked:
$ qemu-img create -f qcow2 dummy.qcow2 32M
$ qemu-system-aarch64 -m 4096M -smp 4 -machnie xlnx-zcu102 -device loader,file=vxWorks,addr=0x00100000 -nographic -monitor telnet:127.0.0.1:35163,server,nowait -serial telnet:127.0.0.1:39251,server -device loader,file=xlnx-zcu102-rev-1.1.dtb,addr=0x0f000000 -device loader,addr=0x000ffffc,data=0xd2a1e000,data-len=4 -device loader,addr=0x000ffffc,cpu-num=0 -nic user -nic user -nic user -nic user,id=n0,hostfwd=tcp:127.0.0.1:0-:1534,hostfwd=udp:127.0.0.1:0-:17185 -snapshot -drive if=none,format=qcow2,file=dummy.qcow2
Then in the monitor terminal savevm and loadvm work:
$ telnet 127.0.0.1 35163
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) savevm save1
(qemu) info snapshots
List of snapshots present on all disks:
ID TAG VM SIZE DATE VM CLOCK ICOUNT
-- save1 44.3 MiB 2021-06-28 10:08:28 00:00:05.952
(qemu) loadvm save1
This information came thanks to Peter Maydell and his blog post: https://translatedcode.wordpress.com/2015/07/06/tricks-for-debugging-qemu-savevm-snapshots/