Fixed
Created: Apr 1, 2024
Updated: Sep 4, 2024
Resolved Date: Aug 29, 2024
Found In Version: 10.22.33.14
Fix Version: 10.22.33.18
Severity: Standard
Applicable for: Wind River Linux LTS 22
Component/s: Build & Config, Kernel
An user reported they were using "libvirt" package just fine, but they also needed to add "virsh" so they added the WR template "feature/libvirt".
After building a Linux image they ran the validation command "virt-host-validate" and noticed that device file "/dev/kvm" file did not existed causing the host validation to fail.
He reproduced this behavior in BSP NXP-LS1046.
It also can't be reproduced the described behavior using a zynqmp board in simics.
When adding the template "feature/libvirt", the kernel configuration is modified, and "Virtualization" and "Virtualization/KVM" are disabled, causing the device file to disappear.
To make it work, add the template, build and image, and then run the kernel "menuconfig" command to re-enable virtualization and KVM manually. Then build another image and this one includes the template changes plus the "/dev/kvm" device file.
+*Output of "virt-host-validate" after adding "feature/libvirt" to local.conf*+
QEMU: Checking if device /dev/kvm exists : FAIL (Check that CPU and firmware supports virtualization and kvm module is loaded)
QEMU: Checking if device /dev/vhost-net exists : PASS
QEMU: Checking if device /dev/net/tun exists : PASS
QEMU: Checking for cgroup 'cpu' controller support : PASS
QEMU: Checking for cgroup 'cpuacct' controller support : PASS
QEMU: Checking for cgroup 'cpuset' controller support : PASS
QEMU: Checking for cgroup 'memory' controller support : PASS
QEMU: Checking for cgroup 'devices' controller support : PASS
QEMU: Checking for cgroup 'blkio' controller support : PASS
QEMU: Checking for device assignment IOMMU support : WARN (Unknown if this platform has IOMMU support)
QEMU: Checking for secure guest support : WARN (Unknown if this platform has Secure Guest support)
LXC: Checking for Linux >= 2.6.26 : PASS
LXC: Checking for namespace ipc : PASS
LXC: Checking for namespace mnt : PASS
LXC: Checking for namespace pid : PASS
LXC: Checking for namespace uts : PASS
LXC: Checking for namespace net : PASS
LXC: Checking for namespace user : PASS
LXC: Checking for cgroup 'cpu' controller support : PASS
LXC: Checking for cgroup 'cpuacct' controller support : PASS
LXC: Checking for cgroup 'cpuset' controller support : PASS
LXC: Checking for cgroup 'memory' controller support : PASS
LXC: Checking for cgroup 'devices' controller support : PASS
LXC: Checking for cgroup 'freezer' controller support : PASS
LXC: Checking for cgroup 'blkio' controller support : PASS
LXC: Checking if device /sys/fs/fuse/connections exists : PASS
CH: Checking for hardware virtualization : PASS
CH: Checking if device /dev/kvm exists : FAIL (Check that CPU and firmware supports virtualization and kvm module is loaded)
The steps to reproduce
1) Clone the latest version of Wind River Linux LTS22. (Ideally for LS1046 BSP, I tested with Zynqmp because that is what I have available).
git clone --branch WRLINUX_10_22_LTS_RCPL0015 https://gateway.delivers.windriver.com/git/linux-lts/release/wrlinux-lts.22/WRLinux-lts-22-Core/wrlinux-x
./wrlinux-x/setup.sh --machine xilinx-zynqmp --dl-layers=1
source environment-setup-x86_64-wrlinuxsdk-linux
source oe-init-build-env
2) Enable "Virtualization" and "Virtualization/KVM" in kernel config. Save and exit.
bitbake -c menuconfig virtual/kernel
# Virtualization is located in the kernel config menu root
# KVM is located inside the Virtualization menu
3) Add libvirt package to local.conf and build "wrlinux-image-small".
DISTRO_FEATURES:append = " virtualization pam"
IMAGE_INSTALL:append = " python3 qemu libvirt dmidecode"
4) Build Linux Image
bitbake wrlinux-image-small
5) Run the image and execute "virt-host-validate" command. Device file "/dev/kvm" should exist.
h3. *Second Part (Adding feature/libvirt)*
6) Add "feature/libvirt" to local.conf and rebuild Linux image
WRTEMPLATE += "feature/libvirt"
DISTRO_FEATURES:append = " virtualization pam"
IMAGE_INSTALL:append = " python3 qemu libvirt dmidecode"
bitbake wrlinux-image-small
7) Run image and run "virt-host-validate" command. Device file "/dev/kvm" will not exist (virtualization and kvm were disabled). Validation fails.
Note: This also fails when using kernel configuration fragments. As soon as the feature is added to the local.conf the kernel config fragment is read but it does not seem to be applied or used.
h3. *Third Part (Kernel manual re-configuration)*
8) Repeat step 2. Run kernel menuconfig, re-enable "Virtualization" and "Virtualization/KVM" in kernel config, save and exit, and rebuild linux image.
{*}Note: this is the current workaround the customer is using{*}.
bitbake -c menuconfig virtual/kernel
bitbake wrlinux-image-small
9) Run image and run "virt-host-validate" command. The Image will include everything from the feature + /dev/kvm device file. Validation will pass.
Manual reconfiguration of the Linux kernel after building an image that includes the changes of the "feature/libvirt"
See "Third Part" of the Steps To Reproduce.
1) Clone the latest version of Wind River Linux LTS22. (Ideally for LS1046 BSP, I tested with Zynqmp because that is what I have available).
git clone --branch WRLINUX_10_22_LTS_RCPL0015 https://gateway.delivers.windriver.com/git/linux-lts/release/wrlinux-lts.22/WRLinux-lts-22-Core/wrlinux-x
./wrlinux-x/setup.sh --machine xilinx-zynqmp --dl-layers=1
source environment-setup-x86_64-wrlinuxsdk-linux
source oe-init-build-env
2) Enable "Virtualization" and "Virtualization/KVM" in kernel config. Save and exit.
bitbake -c menuconfig virtual/kernel
# Virtualization is located in the kernel config menu root
# KVM is located inside the Virtualization menu
3) Add libvirt package to local.conf and build "wrlinux-image-small".
DISTRO_FEATURES:append = " virtualization pam"
IMAGE_INSTALL:append = " python3 qemu libvirt dmidecode"
4) Build Linux Image
bitbake wrlinux-image-small
5) Run the image and execute "virt-host-validate" command. Device file "/dev/kvm" should exist.
h3. *Second Part (Adding feature/libvirt)*
6) Add "feature/libvirt" to local.conf and rebuild Linux image
WRTEMPLATE += "feature/libvirt"
DISTRO_FEATURES:append = " virtualization pam"
IMAGE_INSTALL:append = " python3 qemu libvirt dmidecode"
bitbake wrlinux-image-small
7) Run image and run "virt-host-validate" command. Device file "/dev/kvm" will not exist (virtualization and kvm were disabled). Validation fails.
Note: This also fails when using kernel configuration fragments. As soon as the feature is added to the local.conf the kernel config fragment is read but it does not seem to be applied or used.
h3. *Third Part (Kernel manual re-configuration)*
8) Repeat step 2. Run kernel menuconfig, re-enable "Virtualization" and "Virtualization/KVM" in kernel config, save and exit, and rebuild linux image.
{*}Note: this is the current workaround the customer is using{*}.
bitbake -c menuconfig virtual/kernel
bitbake wrlinux-image-small
9) Run image and run "virt-host-validate" command. The Image will include everything from the feature + /dev/kvm device file. Validation will pass.