Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve "Specify the 'raw' format explicitly to remove the restrictions." in qemu?

Tags:

qemu

macos

I am trying to run helloos.img on MACBOOK Pro, and even program works fine, it is showing

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

How to deal with this? Is this important?enter image description here

like image 472
LinconFive Avatar asked Nov 11 '17 07:11

LinconFive


1 Answers

The reason for this warning is that QEMU is automatically guessing the format of your disk image as raw. The problem with doing that is that if your guest was able to write to the whole of the raw image it could maliciously write (say) a QCOW2 disk header to the start of the raw image, which would mean that when the VM was restarted QEMU would guess the image type wrongly, possibly with bad results. To prevent this, QEMU refuses to allow the guest to write to the start of a probed raw format image. Mostly that won't hurt but if you try to for instance repartition the disk from within the guest it will fail.

To fix this you need to explicitly tell QEMU that the image is in raw format, but you can't do that with the convenience short options or with the "just pass a disk image filename which is assumed to be the harddisk" approach you're using. You need to use the 'long format' options to specify your disk image so that you can pass it format=raw. In this case that would be
-drive file=helloos.img,format=raw,index=0,media=disk
(This is documented in the QEMU manpage where it has "Instead of -hda, -hdb, -hdc, -hdd you can use:" and long format equivalents for the short options.)

See also https://unix.stackexchange.com/questions/276480/booting-a-raw-disk-image-in-qemu which is a similar query.

PS: your question would be easier to answer if you gave the command line you're running and the full error message in the text of the question, rather than just in a screenshot where the windows are overlapping.

like image 193
Peter Maydell Avatar answered Sep 17 '22 07:09

Peter Maydell