Score:0

QEMU - (Index=0) exists

us flag

I'm getting this index=0 exists error when I try to run qemu with this specific lines:

Command:

qemu-system-x86_64 `
-cpu "Penryn-v1" `
-boot order=c,once=d `
-m 4096 `
-smp 2,sockets=2,cores=2,threads=2,maxcpus=8 `
-drive file="F:\Maquinas Virtuais\VMs\Kali.img",media=disk `
-drive file="F:\Maquinas Virtuais\ISOs\kali-linux-2021.4a-installer-amd64.iso",media=cdrom

Output:

WARNING: Image format was not specified for 'F:\Maquinas Virtuais\VMs\Kali.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
F:\qemu\qemu-system-x86_64.exe: ,media=disk: drive with bus=0, unit=0 (index=0) exists
PS F:\Maquinas Virtuais\VMs>

If I'd remove the part of the media=, then QEMU starts but it's looks like it can't find the files ( the .img and .iso files do not load on QEMU)

Command:

qemu-system-x86_64 `
-cpu "Penryn-v1" `
-boot order=c,once=d `
-m 4096 `
-smp 2,sockets=2,cores=2,threads=2,maxcpus=8 `
-drive file="F:\Maquinas Virtuais\VMs\Kali.img" `
-drive file="F:\Maquinas Virtuais\ISOs\kali-linux-2021.4a-installer-amd64.iso"

I tried to explicit tell qemu the bus,unit and index on the -drive flag, but the error is the same everytime

I managed to start QEMU by removing the -drive line and issuing the -hda for the .img disk and -cdrom for the .iso cdrom.

Command:

qemu-system-x86_64 `
-cpu "Penryn-v1" `
-boot order=c,once=d `
-m 4096 `
-smp 2,sockets=2,cores=2,threads=2,maxcpus=8 `
-hda "F:\Maquinas Virtuais\VMs\Kali.img" `
-cdrom "F:\Maquinas Virtuais\ISOs\kali-linux-2021.4a-installer-amd64.iso"

Anyone knows why QEMU issue the error that index=0 exists when trying to run QEMU with the -drive flag with the specific atribute of the media= being passed? Even without the media=, QEMU do not starts as intended, as it can't find the files to boot the cdrom or HD.

Score:0
za flag

Read the error message carefully. For instance,

         Specify the 'raw' format explicitly to remove the restrictions.

If you know for certain this is RAW image, tell that QEMU for it to not to try autodetection: file=...,format=raw. The warning will go away together with restrictions on block 0.

The media attribute has nothing to do with this. It tells QEMU how to present the storage into the VM, not how it is backed in the host.

Gabriel Jefferson avatar
us flag
Thank you. It helped me to solve the problem with the index= I still got the error, even with the format=raw. So i realized that maybe the full path to the IMG/ISO could be causing problems, so I got into the directory and started QEMU just with the name of the files. Maybe the spaces or quotes on the declaration of the file= can't be read... Maybe it is a bug?
Nikita Kipriyanov avatar
za flag
Are you still getting the exact same error?
Gabriel Jefferson avatar
us flag
No, after adding the "index=" and changing the path to the files it is working fine. Also,renaming the directory structure so that there are no spaces in the name of the directories solved the problem in the "file=" value part, as that part doesn't seem to understand spaces in the value.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.