1
votes

I use Gitlab CI to build an Android app and automatically run tests on an Android Virtual Device (AVD).
I would like to use the x86 version of this emulator instead of the ARM one.
But an x86 AVD currently requires virtualization (VT) and KVM properly installed and loaded.

All this runs in a Docker container on a DigitalOcean host.

'lscpu' shows VT is enabled for an Intel processor :
Model name: Intel(R) Xeon(R) CPU E5-2650L v3 @ 1.80GHz
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full

I therefore installed qemu-kvm and other related debian packages :
export DEBIAN_FRONTEND=noninteractive
apt-get --quiet update --yes
apt-get --quiet install --yes qemu-kvm libvirt-bin virtinst bridge-utils
adduser 'id -un' libvirt

Then 'virt-host-validate' shows kvm-intel is not loaded :
$ virt-host-validate
QEMU: Checking for hardware virtualization : PASS
QEMU: Checking for device /dev/kvm : FAIL (Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization)
QEMU: Checking for device /dev/vhost-net : PASS
QEMU: Checking for device /dev/net/tun : PASS
LXC: Checking for Linux >= 2.6.26 : PASS
ERROR: Job failed: exit code 1

But, adding 'modprobe kvm-intel' fails :
$ modprobe kvm-intel
modprobe: ERROR: ../libkmod/libkmod.c:557 kmodsearchmoddep() could not open moddep file '/lib/modules/4.9.16-coreos-r1/modules.dep.bin'

And neither :
$ depmod
depmod: ERROR: could not open directory /lib/modules/4.9.16-coreos-r1: No such file or directory depmod: FATAL: could not search modules: No such file or directory ERROR: Job failed: exit code 1

Nor :
$ apt-get install --reinstall linux-image-'uname -r'
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package linux-image-4.9.16-coreos-r1
E: Couldn't find any package by regex 'linux-image-4.9.16-coreos-r1'

...does solve the problem. Any idea on how I can get kvm-intel loaded ?

Kind regards,

Laurent Le Moux

1
How comes there is no '/lib/modules/4.9.16-coreos-r1' directory ? Nor does '/lib/modules' exist... Is this specific to a Linux container ? From what I read, I need to install linux headers but 'apt-get --quiet install linux-headers-uname -r --yes' fails with the following error : E: Unable to locate package linux-headers-4.9.16-coreos-r1 I tried to use another image/header. 'kvm-intel.ko' is then installed but can not be loaded. Using 'insmod -f' fails because of an 'invalid module format'. I'm stuck. I would really appreciate if anyone could help.Laurent Le Moux

1 Answers

2
votes

Finally I got an answer here : https://groups.google.com/d/topic/coreos-user/mvmOhDMiwsU/discussion

Basically, the virtualization packages must be installed from outside the Docker instance. And - unfortenately - I have no control / access on it as it is automatically started by Gitlab CI runner.

I may (kindly) ask for these packages to be installed by default : https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/2242