The image used by GitHub-hosted runners changed the default kvm device
permissions recently rendering us no longer able to start guest VMs. The
error message:
Could not access KVM kernel module: Permission denied
qemu-system-x86_64: failed to initialize kvm: Permission denied
Working run: https://github.com/fiotestbot/fio/actions/runs/
14186873066
Failed run: https://github.com/fiotestbot/fio/actions/runs/
14211189491
Explicitly give the GitHub Actions runner user permission to access the
/dev/kvm device following the guide at
https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
- name: install wait-for-it
shell: bash
run: sudo apt update && sudo apt-get -qq install wait-for-it
+ - name: Enable KVM group perms
+ shell: bash
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
- name: Start VM in background
shell: bash
run: |