[CentOS] qemu-system-x86_64 does not support fw_cfg option

Wed Jul 26 10:44:55 UTC 2017
Gianluca Cecchi <gianluca.cecchi at gmail.com>

On Wed, Jul 26, 2017 at 12:20 PM, Steve Rubie-Todd <steve at rubie-todd.com>
wrote:

> Hi
>
> I am trying to run CoreOS (Container Linux) as a guest OS using KVM/QEMU.
> One of their suggestions is to pass config info into the VM using the
> "fw_cfg" option . When I try this I get the error "-fw_cfg invalid option".
> If I run the vm with the help option it does not list the fw_cfg option.
> However, according to the qemu documentation, see here <
> https://qemu.weilnetz.de/doc/qemu-doc.html#Debug_002fExpert-options>,
> they support this option.
>
> The command used to run the vm is:
>
>    /usr/bin/qemu-system-x86_64 -name CL-IGN-1 -m 1024 \
>         -net nic,vlan=0,model=virtio \
>         -net user,vlan=0,hostfwd=tcp::2222-:22,hostname=CL-IGN-1 \
>         -drive if=virtio,file=./coreos_production_qemu_image.img \
>         -fw_cfg name=opt/com.coreos/config,file=./CL-IGN-1.ignconfig
>
>    qemu-system-x86_64: -fw_cfg: invalid option
>
> I also tried using /usr/libexec/qemu-kvm but got the same error.
>
> I am running::
>
>    CentOS Linux release 7.3.1611 (Core)
>
>    qemu-system-x86-2.0.0-1.el7.6.x86_64
>    qemu-kvm-1.5.3-126.el7.x86_64
>
>
> Thanks.
>

Hello,
I think (based also on your qemu-kvm version man page), that the feature is
not present in qemu-kvm version provided by base CentOS.
But you can use packages provided by the Virtualization SIG
Good idea especially if virtualization is core service for your server.
See here the announcement:
https://lists.centos.org/pipermail/centos-announce/2015-October/021445.html

So you can follow what detailed there:
yum install centos-release-qemu-ev
yum install qemu-kvm-ev

I reproduced a situation on a CentOS 7.3 server where qemu-kvm is already
present and you can do

yum install centos-release-qemu-ev

and then

yum update qemu-kvm-ev
...
Dependencies Resolved

====================================================================================================
 Package                   Arch          Version
 Repository             Size
====================================================================================================
Installing:
 qemu-img-ev               x86_64        10:2.6.0-28.el7.10.1
centos-qemu-ev        1.0 M
     replacing  qemu-img.x86_64 10:1.5.3-126.el7_3.10
 qemu-kvm-common-ev        x86_64        10:2.6.0-28.el7.10.1
centos-qemu-ev        516 k
     replacing  qemu-kvm-common.x86_64 10:1.5.3-126.el7_3.10
 qemu-kvm-ev               x86_64        10:2.6.0-28.el7.10.1
centos-qemu-ev        2.5 M
     replacing  qemu-kvm.x86_64 10:1.5.3-126.el7_3.10

Transaction Summary
====================================================================================================
Install  3 Packages

so it seems it automatically obsoletes the "standard" packages, because
they overlap in filesand you can have only one installed

And now you should have the -fw_cfg option.

BTW: the version of the hypervisor used by Virtualization SIG is the same
used by the Virtualization Platform project named oVirt (
http://www.ovirt.org), upstream for commercial RHEV solution, so rock
solid, I'm currently using it extensively ;-)

HIH,
Gianluca