Qemu built from source doesn't work with --enable-kvm flag on RHEL-7 but suprisingly works on CentOS-7

Latest response

I am trying to build and run QEMU from its source with --enable-kvm flag. The suprising fact is qemu with --enable-kvm flag works like a charm on CentOS 7 (Server as well as on workstation) but it hangs terribly on RHEL 7 server.

I am using Linux From sratch guide to build the system link : http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/qemu.html

I have tested the vmx flag using the script

grep -E "(vmx|svm)" /proc/cpuinfo | wc -l
4

On Rhel as well as centos I have downloaded the dependencies using following script.

!/bin/sh

yum install gcc
yum install zlib-devel
yum install gnutls-devel
yum install libgcrypt-devel
yum install glibc-devel
yum install glib2-devel
yum install pixman-devel

Then I used following script to compile the build

if [ $(uname -m) = i686 ]; then
QEMU_ARCH=i386-softmmu
else
QEMU_ARCH=x86_64-softmmu
fi

sed -i 's/ memfd_create/ qemu_memfd_create/' util/memfd.c &&

mkdir -vp build &&
cd build &&

../configure --target-list=$QEMU_ARCH \
--enable-gnutls \
--enable-gcrypt &&

unset QEMU_ARCH &&
make &&
make-install

After this I am trying to boot an encrypted virtual disk using the command.

qemu-system-x86_64 --enable-kvm -daemonize -display none \
-net user,hostfwd=tcp::3000-:22,hostfwd=tcp::8080-:8080,hostfwd=tcp::80-:80,hostfwd=tcp::443-:443 -net nic \
-object secret,id=secmaster0,format=base64,file=key.b64 \
-object secret,id=sec0,keyid=secmaster0,format=base64,\
data=$SECRET,iv=$(<iv.b64) \
-drive if=none,driver=luks,key-secret=sec0,\
id=drive0,file.driver=file,\
file.filename=prod.luks \
-device virtio-blk,drive=drive0 -m 5120

Then, I just ssh in the daemonised kvm. The point is everything works like a charm in CentOS but in RHEL 7 I am not able to ssh in the machine.

If I remove --enable-kvm flag I am able to ssh in.

I have already spent a lot of time experimenting over it and I simply don't understand what is going wrong. I am no pro on this topic just trying to find a fix for a niche problem. Any guidance on debuging the qemu or any guidance or reference to documents/mailing-list thread/forum is deeply appreciated.

Peace.

Responses