Qemu Files not deleting “No Such File Or Directory Found”

I have some malware that installed crypto mining on my mac – I’m trying to delete all the files in terminal but keep coming up with “No Such File Or Directory Found” as an error. I’m tearing my hair out with this and its running my CPU constantly at 100%.

I’ve looked at other similar situations but this feels quite specific to me, Any help would be so much appreciated.

How to boot an Arch USB device in QEMU and save to a VM?

I’m trying to get an Arch Linux QEMU-KVM hypervisor going.

I used the same USB to originally download Arch-linux to my machine using rufus on my windows to setup the archlinux iso on it.

sudo qemu-system-x86_64 -enable-kvm -nographic -m 384 \ -drive file=/dev/sdb,format=raw,index=0,media=disk \ -hda /media/guestos/webServer/image.qcow2 

Where /dev/sdb is the usb and /dev/sda5 is mounted to /media/guestos/webServer

If I include the last line, I get error:

qemu-system-x86_64: -hda /media/guestos/webServer/image.qcow2: drive with bus=0, unit=0 (index=0) exists 

If I remove the last line, the usb is able to start booting, but it doesn’t show anything after it says “loading archlinux.iso”

If I boot my normal OS, it says Ok a bunch of times, at the part QEMU stops at. When I’m running QEMU the screen just shows a flashing pointer in the top left and that’s it.

How do I fully boot from the USB in qemu? For the initial setup do I have to include the .qcow2 image I plan to save it to in my startup command or am I able to switch to console mode and save it through that?

Packer and Qemu – Qemu hangs during SIGKILL – reboot requested

I’m attempting to build an Ubuntu 19.04 server image with packer. I have it booting and running the install seemingly fine, and after an hour and change, Qemu shows that the install is finished and a SIGINT and sometimes SIGKILL were sent, and a reboot requested, but eventually packer times out because Qemu never reboots the OS to let packer SSH in and finish its thing. I’ve tried a few things to get Qemu to output something about why it is failing to reboot:

-serial stdio

-serial mon:stdio

-serial telnet:127.0.0.1:4444,server,nowait

All to no avail. I get no feedback from Qemu about anything. I’ve also tried finding good examples to configure tracing and -append console=ttyS0 with a kernel. I’m a Qemu and Packer nub, so forgive me if I’m missing something obvious. I’ve done a lot of searching around trying to find ways to debug qemu to figure out why it’s hanging on reboot.

Ubuntu 19.04 Desktop build:

Packer: 1.4.1

Qemu: 3.1.0 (apt install)

macOS 10.14.5 build environment:

Packer: 1.4.0

Qemu: 4.0.0 (brew install)

In both environments, qemu seems to hang on the reboot part. I say seems, because while I do have -display gtk on the Ubuntu desktop and see where it hangs, there’s a bug(?) and -display sdl is broken on Mac, and gtk doesn’t work. I also tried curses on Mac, but that doesn’t work either. So as best as I can tell, both break in the same spot. I can provide my preseed.cfg if needed.

Here’s my ubuntu.json:

{     "builders": [         {             "type": "qemu",             "boot_command": [                 "<enter><wait2><esc><wait2><enter>",                 "<wait>",                 "/install/vmlinuz",                 " initrd=/install/initrd.gz quiet",                 " vga=788",                 " auto=true",                 " priority=critical",                 " reboot=pci",                 " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",                 " --- <enter>"             ],             "qemuargs": [                 ["-display", "gtk"],                 ["-serial", "stdio"]             ],             "boot_wait": "5s",             "disk_size": 20000,             "headless": false,             "http_directory": "http",             "iso_url": "http://cdimage.ubuntu.com/releases/19.04/release/ubuntu-19.04-server-amd64.iso",             "iso_checksum_type": "sha256",             "iso_checksum_url": "http://cdimage.ubuntu.com/releases/19.04/release/SHA256SUMS",             "communicator": "ssh",             "ssh_username": "ubuntu",             "ssh_password": "ubuntu",             "ssh_port": 22,             "ssh_wait_timeout": "120m",             "shutdown_command": "echo 'ubuntu' | sudo shutdown -P now",             "vm_name": "ubuntu-19.04-amd64.qcow2"         }     ] } 

qemu gpu passthrough black screen

previously at may 2017 I have configured a virtual qemu machine with a gpu passthrought of a radeon 5450, it works fine except a kernel panic (on VM) after the 2nd boot of the VM…

Now I am trying to remake this machine with the same configuration ( just 1-2 things different) formerly :

  • Gigabyte GA-990-FXA-ud3
  • AMD FX6300
  • 1st graphic card : NVidia GT210
  • 2nd graphic card : AMD Radeon HD5450
  • debian 8

changes since :

  • AMD FX8350
  • 1st graphic card : NVidia GT710

(I know its a little bit outdated configuration but I am not a gamer so I do not need more)

I have written this startup script :

#/bin/sh  echo '0000:02:00.1' | tee /sys/bus/pci/devices/0000:02:00.1/driver/unbind  modprobe vfio modprobe vfio_pci  echo 1002 68f9 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id echo 1002 aa68 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id   qemu-system-x86_64 -M q35 -m 2048 -enable-kvm \ -bios OVMF.fd \ -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \ -soundhw ac97 \ -hda virtualrawdrive -cdrom ubuntuinstall.iso \ -device piix4-ide,bus=pcie.0,id=piix4-ide  -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on -device vfio-pci,host=02:00.1,bus=pcie.0 \ -vnc :0 

but Its not working, when I launch the script, 2nd graphic card VGA screen lights up, displays ubuntu plymouth screen, and after nothing, the screen stays on, but displays a black screen.

My lspci -nnk :

[...] 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208B [GeForce GT 710] [10de:128b] (rev a1)     Subsystem: Gigabyte Technology Co., Ltd GK208B [GeForce GT 710] [1458:36f7]     Kernel driver in use: nvidia     Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia 01:00.1 Audio device [0403]: NVIDIA Corporation GK208 HDMI/DP Audio Controller [10de:0e0f] (rev a1)     Subsystem: Gigabyte Technology Co., Ltd GK208 HDMI/DP Audio Controller [1458:36f7]     Kernel driver in use: snd_hda_intel     Kernel modules: snd_hda_intel 02:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series] [1002:68f9]     Subsystem: Micro-Star International Co., Ltd. [MSI] Cedar [Radeon HD 5000/6000/7350/8350 Series] [1462:2127]     Kernel driver in use: vfio-pci     Kernel modules: radeon 02:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series] [1002:aa68]     Subsystem: Micro-Star International Co., Ltd. [MSI] Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series] [1462:aa68]     Kernel driver in use: vfio-pci     Kernel modules: snd_hda_intel [...] 

My former 2017 script :

echo '0000:02:00.1' | sudo tee /sys/bus/pci/devices/0000:02:00.1/driver/unbind  modprobe vfio modprobe vfio_pci  echo 1002 68f9 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id echo 1002 aa68 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id  qemu-system-x86_64 -enable-kvm -M q35 -m 2048 -cpu host -smp 2,sockets=1,cores=2,threads=1 \ -bios /usr/share/qemu/bios.bin \ -vga none -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \ -device piix4-ide,bus=pcie.0,id=piix4-ide  -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on -device vfio-pci,host=02:00.1,bus=pcie.0 \ -soundhw ac97 \ -drive file=/home/user/ubuntuimage,id=disk,format=raw,if=none -device ide-hd,bus=piix4-ide.0,drive=disk 

I think the problem comes from the “x-vga=on” option, but it not works on the new versions, I have got this error :

qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio 0000:02:00.0: failed getting region info for VGA region index 8: Invalid argument device does not support requested feature x-vga 

I have try use a “fresh” version of qemu (4.0.0) and OVMF (compiled from the GIT sources) but It does not changes anything…

So thanks by advance for your aswers

PS : sorry for my bad english, I am french

Errors during QEMU build: expected ‘)’

I am trying to build Qemu 4.0 (also tried 3.1.0 which resulted in the same behaviour) on a Ubuntu 18.04 machine. All necessary dependancies should be installed and I simply follow the instructions on Qemu’s website, being:

1) Download 2) Unpack 3) ./configure 4) make -j

The configure step works without problem, however the actual make is running into problems. I am getting the following errors:

qga/main.c: In function ‘init_dfl_pathnames’: qga/main.c:128:30: error: expected ‘)’ before ‘G_DIR_SEPARATOR_S’        QGA_STATE_RELATIVE_DIR G_DIR_SEPARATOR_S "qemu-ga.pid");                               ^~~~~~~~~~~~~~~~~ qga/main.c: In function ‘config_load’: qga/main.c:61:46: error: expected ‘,’ or ‘;’ before ‘G_DIR_SEPARATOR_S’  #define QGA_CONF_DEFAULT CONFIG_QEMU_CONFDIR G_DIR_SEPARATOR_S "qemu-ga.conf"                                               ^ qga/main.c:970:48: note: in expansion of macro ‘QGA_CONF_DEFAULT’      const char *conf = g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT;                                                 ^~~~~~~~~~~~~~~~ In file included from /usr/include/glib-2.0/glib.h:62:0,                  from /home/user/qemu/qemu-3.0.1/include/glib-compat.h:32,                  from /home/user/qemu/qemu-3.0.1/include/qemu/osdep.h:122,                  from qga/main.c:14: qga/main.c:61:46: error: expected ‘)’ before ‘G_DIR_SEPARATOR_S’  #define QGA_CONF_DEFAULT CONFIG_QEMU_CONFDIR G_DIR_SEPARATOR_S "qemu-ga.conf"                                               ^ /usr/include/glib-2.0/glib/gmessages.h:336:32: note: in definition of macro ‘g_critical’                                 __VA_ARGS__)                                 ^~~~~~~~~~~ qga/main.c:1025:20: note: in expansion of macro ‘QGA_CONF_DEFAULT’                     QGA_CONF_DEFAULT, gerr->message);                     ^~~~~~~~~~~~~~~~ qga/main.c:1024:20: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]          g_critical("error loading configuration from path: %s, %s",                     ^ /usr/include/glib-2.0/glib/gmessages.h:336:32: note: in definition of macro ‘g_critical’                                 __VA_ARGS__)                                 ^~~~~~~~~~~ /home/user/qemu/qemu-3.0.1/rules.mak:69: recipe for target 'qga/main.o' failed make: *** [qga/main.o] Error 1 

I am not sure how I can deal with the “missing ‘)'” errors. Checking the code everything seems fine. Anyone have an idea?

qemu kvm permission denied error despite running as root

I have qemu/kvm working perfectly. Recently it started throwing permission errors – all I can think of is I installed apache, mysql, php recently.

log:

Domain id=6 is tainted: high-privileges Domain id=6 is tainted: custom-argv Domain id=6 is tainted: host-cpu shm_open() failed: Permission denied Failed to create secure directory (/root/.config/pulse): Permission denied 2019-04-25T07:19:02.354161Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: error opening /dev/vfio/1: Permission denied 2019-04-25T07:19:02.354175Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: failed to get group 1 2019-04-25T07:19:02.354183Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device initialization failed 2019-04-25 07:19:02.433+0000: shutting down 

Everything is run as root, so not sure why permissions are suddenly a problem and I can’t find anyone with a similar error. I checked my graphics card outside of KVM on the same machine and it works fine. PCI stub works perfectly in dmesg, vfio –

dmesg |grep stub

[    5.486267] pci-stub: add 10DE:1B06 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000 [    5.486275] pci-stub 0000:01:00.0: claimed by stub [    5.486286] pci-stub: add 10DE:10EF sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000 [    5.486290] pci-stub 0000:01:00.1: claimed by stub 

dmesg |grep vfio

[   85.099879] vfio-pci 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=none 

lspci -v

01:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1) (prog-if 00 [VGA controller])     Subsystem: NVIDIA Corporation Device 120f     Flags: fast devsel, IRQ 11     Memory at de000000 (32-bit, non-prefetchable) [disabled] [size=16M]     Memory at c0000000 (64-bit, prefetchable) [disabled] [size=256M]     Memory at d0000000 (64-bit, prefetchable) [disabled] [size=32M]     I/O ports at e000 [disabled] [size=128]     Expansion ROM at df000000 [disabled] [size=512K]     Capabilities: <access denied>     Kernel driver in use: vfio-pci     Kernel modules: nvidiafb, nouveau 

Any ideas?

Unraid Virtualization: gpu is in use by driver QEMU and Windows 10 “shutting down, reason=destroyed”

I am a total noob to the world of vm but I have gotten past creating an unraid array and I am beginning to create vm’s

My pc contains an i7 8700k, GTX 1080, and a GTX 980 ti.

My problem is that whenever I try to launch a windows vm I created it looks fine until I check out the logs. I keep getting this:

2019-04-23 01:59:46.696+0000: starting up libvirt version: 4.7.0, qemu version: 3.0.0, kernel: 4.18.20-unRAID, hostname: Tower 2019-04-23 01:59:46.696+0000: Domain id=1 is tainted: high-privileges 2019-04-23 01:59:46.696+0000: Domain id=1 is tainted: host-cpu 2019-04-23T01:59:46.726907Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/0 (label charserial0) 2019-04-23T02:10:46.942420Z qemu-system-x86_64: terminating on signal 15 from pid 2972 (/usr/sbin/libvirtd) 2019-04-23 02:10:48.343+0000: shutting down, reason=destroyed 2019-04-23 02:12:53.617+0000: starting up libvirt version: 4.7.0, qemu version: 3.0.0, kernel: 4.18.20-unRAID, hostname: Tower 2019-04-23 02:12:53.617+0000: Domain id=8 is tainted: high-privileges 2019-04-23 02:12:53.617+0000: Domain id=8 is tainted: host-cpu 2019-04-23T02:12:53.647026Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/0 (label charserial0) 2019-04-23T02:18:55.352186Z qemu-system-x86_64: terminating on signal 15 from pid 2972 (/usr/sbin/libvirtd) 2019-04-23 02:18:56.753+0000: shutting down, reason=destroyed 2019-04-23 02:21:07.385+0000: starting up libvirt version: 4.7.0, qemu version: 3.0.0, kernel: 4.18.20-unRAID, hostname: Tower 2019-04-23 02:21:07.385+0000: Domain id=10 is tainted: high-privileges 2019-04-23 02:21:07.385+0000: Domain id=10 is tainted: host-cpu 2019-04-23T02:21:07.414616Z qemu-system-x86_64: -chardev pty,id=charserial0: char device redirected to /dev/pts/0 (label charserial0) To me it looks like the startup is attempted many times until it gives me “shutting down, reason=destroyed” if anyone has any experience with this let me know.

My other problem is with my second vm giving me this error code:

PCI device 0000:01:00.0 is in use by driver QEMU, domain Vr Computer 1 My understanding is that because unraid is using my first gpu and not allowing my second vm to use the second gpu in my computer.

If anyone has experience with gpu vm issues help would be much appreciated.

QEMU: qcow2 and RAM…..which filesystem combi (avoid writing journal twice)?

Let’s say my host disk is using EXT4, I place an image-file for my virtual machine in either QCOW2 or RAW format which again is formatted with EXT4 inside. Wouldn’t journal data be written twice? First in the guest drive and then on the host? Can I safely disable journal in one of them? Or should I use a combination of two different filesystems on host and guest (if both are Linux). If guest is Windows using NTFS, which also seem to be a journal-like filesystem, could I safely disable journal on host EXT4 FS?