QEmu’s `-nodefaults` not working as expected to me

0

I expected QEmu’s -nodefaults to prevent the creation of default devices, but either I don’t use it correctly or it does not work as I expected.

I get this message, using the stripped down command line below, with QEmu 3.0.

The message:

    qemu-system-i386: warning: multiple floppy disk controllers 
    with iobase=0x3f0 have been found
    the one being picked for CMOS setup might not reflect your intent

Additional message in the VM’s terminal:

    could not read the boot disk

The command line:

    qemu-system-i386 \
       -machine type=isapc,usb=no \
       -nodefaults \
       -device isa-vga \
       -blockdev driver=file,node-name=fda-img,filename=fda.img \
       -blockdev driver=raw,node-name=fda,file=fda-img \
       -device isa-fdc,driveA=fda,fdtypeA=144,fdtypeB=none,bootindexA=0

I tried removing -machine type=isapc, but it changed nothing.

This is so, although the documentation says this:

-nodefaults

Don’t create default devices. Normally, QEMU sets the default devices like serial port, parallel port, virtual console, monitor device, VGA adapter, floppy and CD-ROM drive and others. The -nodefaults option will disable all those default devices.

I tried to add a --verbose option to the command line, with the hope it will request a dump of the full configuration QEmu creates, but such an option unfortunately does not exist.

My naive feeling is that it’s broken, but I must also consider I may be missing something … (hence this naive question).

— Update for more details —

Although there is no way to dump the created machine from the commande line, I found there is a info qtree in the monitor, which dumps the devices tree. Below, what it says:

    […]
    dev: isa-fdc, id ""
      iobase = 1008 (0x3f0)
      irq = 6 (0x6)
      dma = 2 (0x2)
      driveA = ""
      driveB = ""
      check_media_rate = true
      fdtypeA = "144"
      fdtypeB = "none"
      fallback = "288"
      isa irq 6
      bus: floppy-bus.1
        type floppy-bus
        dev: floppy, id ""
          unit = 0 (0x0)
          drive = "fda"
          logical_block_size = 512 (0x200)
          physical_block_size = 512 (0x200)
          min_io_size = 0 (0x0)
          opt_io_size = 0 (0x0)
          discard_granularity = 4294967295 (0xffffffff)
          write-cache = "auto"
          share-rw = false
          drive-type = "144"
    […]
    dev: isa-fdc, id ""
      iobase = 1008 (0x3f0)
      irq = 6 (0x6)
      dma = 2 (0x2)
      driveA = ""
      driveB = ""
      check_media_rate = true
      fdtypeA = "auto"
      fdtypeB = "auto"
      fallback = "288"
      isa irq 6
      bus: floppy-bus.0
        type floppy-bus
    […]

It creates two floppy controllers, ignoring -nodefaults. Am I still missing something?

Also, surprisingly, for the first controller, which is the one I create, driveA and driveB are empty strings while driveA is assigned in the command line.

qemu
asked on Stack Overflow Oct 20, 2018 by Hibou57 • edited Oct 20, 2018 by Hibou57

1 Answer

0

I finally believe the documentation is unclear and that’s rather -machine none which does not create any device. However, doing so, there is no way to add a bus which would be required to attach any device. I guess in this particular case, the isapc cannot be created without some device and it must be used as‑is, as a starting point. Then, the backends are to be attached without creating the frontends (if the wording is correct).

Here is an example command line snippet:

[…]
-blockdev driver=file,node-name=fda-img,filename=dos-6-22/Dos622-1.img \
-blockdev driver=raw,node-name=fda,file=fda-img \
-global isa-fdc.driveA=fda \
[…]

Note the -global isa-fdc.driveA=fda, which the important part in this snippet ; this is how the backend is attached to the forcefully created frontend.

Update:

Devices created by -machine <model> seems to be a special case not taken into account by -nodefaults ; this is what the actual documentation forget to mention.

Update 2:

Submitted as a documentation bug, here: https://bugs.launchpad.net/qemu/+bug/1799768

answered on Stack Overflow Oct 22, 2018 by Hibou57 • edited Oct 24, 2018 by Hibou57

User contributions licensed under CC BY-SA 3.0