mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-21 00:39:07 +08:00
Starting recently libbpf CI runs started failing with the following
error:
##[group]vm_init - Starting virtual machine...
Starting VM with 4 CPUs...
INFO: /dev/kvm exists
KVM acceleration can be used
Could not access KVM kernel module: Permission denied
qemu-system-x86_64: failed to initialize KVM: Permission denied
##[error]Process completed with exit code 2.
E.g. see here [0]. The error happens because CI user has not enough
rights to access /dev/kvm. On a regular machine the solution would be
to add user to group 'kvm', however that would require a re-login,
which is cumbersome to achieve in CI setting.
Instead, use a recipe described in [1] to make udev set 0666 access
permissions for /dev/kvm.
[0] https://github.com/libbpf/libbpf/actions/runs/6819530119/job/18547589967?pr=746
[1] https://stackoverflow.com/questions/37300811/android-studio-dev-kvm-device-permission-denied/61984745#61984745
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: libbpf-ci
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
schedule:
|
|
- cron: '0 18 * * *'
|
|
|
|
concurrency:
|
|
group: ci-test-${{ github.head_ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
vmtest:
|
|
runs-on: ${{ matrix.runs_on }}
|
|
name: Kernel ${{ matrix.kernel }} on ${{ matrix.runs_on }} + selftests
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- kernel: 'LATEST'
|
|
runs_on: ubuntu-20.04
|
|
arch: 'x86_64'
|
|
- kernel: '5.5.0'
|
|
runs_on: ubuntu-20.04
|
|
arch: 'x86_64'
|
|
- kernel: '4.9.0'
|
|
runs_on: ubuntu-20.04
|
|
arch: 'x86_64'
|
|
- kernel: 'LATEST'
|
|
runs_on: s390x
|
|
arch: 's390x'
|
|
steps:
|
|
# Allow CI user to access /dev/kvm (via qemu) w/o group change/relogin
|
|
# by changing permissions set by udev.
|
|
- name: Set /dev/kvm permissions
|
|
shell: bash
|
|
run: |
|
|
if [ -e /dev/kvm ]; then
|
|
echo "/dev/kvm exists, updating permissions"
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
|
|
| sudo tee /etc/udev/rules.d/99-kvm4all.rules > /dev/null
|
|
sudo udevadm control --reload-rules
|
|
sudo udevadm trigger --name-match=kvm
|
|
else
|
|
echo "/dev/kvm does not exist"
|
|
fi
|
|
- uses: actions/checkout@v3
|
|
name: Checkout
|
|
- uses: ./.github/actions/setup
|
|
name: Setup
|
|
- uses: ./.github/actions/vmtest
|
|
name: vmtest
|
|
with:
|
|
kernel: ${{ matrix.kernel }}
|
|
arch: ${{ matrix.arch }}
|