Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing permission errors really implicate udev issues with /dev/kvm #2

Open
nealmcb opened this issue Jun 9, 2021 · 8 comments
Open

Comments

@nealmcb
Copy link
Contributor

nealmcb commented Jun 9, 2021

Thanks for making it easier to run fushcia!

I was puzzled by a variety of confusing kvm permission errors trying to get configured on Ubuntu 18.04. E.g.

$ ./fimage-headless 2048
...
cannot add library /home/usr/fuchsia/fimage-210528/linux-x64/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so
cannot add library /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so.1: full
Could not access KVM kernel module: Permission denied
qemu-system-x86_64-headless: failed to initialize KVM: Permission denied
./fimage-headless: line 2: 27139 User defined signal 1   linux-x64/emulator -feature VirtioInput,GLDirectMem,VirtioMouse,KVM,Vulkan -window-size 1280x800 -gpu swiftshader_indirect -no-location-ui -no-window -no-hidpi-scaling -fuchsia -kernel default/multiboot.bin -initrd init/fuchsia-ssh.zbi -m $1 -serial stdio -vga none -device virtio-keyboard-pci -smp 4 -device virtio-mouse-pci -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -enable-kvm -cpu host,migratable=no,+invtsc -netdev type=tap,ifname=qemu,id=net0,script=scripts/start-unsecure-internet.sh,downscript=no -device virtio-net-pci,vectors=8,netdev=net0,mac=52:54:00:63:5e:7a -drive file=init/fvm_raw.blk,format=raw,if=none,id=vdisk -device virtio-blk-pci,drive=vdisk -append 'TERM=xterm-256color zircon.nodename=fuchsia_fimage kernel.serial=legacy kernel.entropy-mixin=ec98e395c5dd4771931a91dfe7e044a651c3b8b0be2828c8bf6544d151f62e2f kernel.halt-on-panic=false '

I had my account properly set up for kvm, since it tells me that the KVM line in /etc/group should end with ":" followed by your username. and that's true...

That file /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so.1 exists, but I don't know what full means in that context and don't see good tips on the web.

That problem turned out to be incorrect permissions on /dev/kvm itself. But note you can't just change the permissions with chmod. You need to configure udev, as described concisely in Gerd's answer at Android Studio: /dev/kvm device permission denied.

Since the error is misleading, it would help to have the shell scripts check for that explicitly and give better hints.

@carbonatedcaffeine
Copy link
Member

Hey ma dude, did you install qemu-kvm and add your user to the kvm group?

@carbonatedcaffeine
Copy link
Member

Cause thats what you need to do to get KVM working correctly.

@nealmcb
Copy link
Contributor Author

nealmcb commented Jun 9, 2021

If you read the link I pointed to, you'll see that qemu-kvm is not actually required, but the udev rule it includes is required.

@carbonatedcaffeine
Copy link
Member

The Fuchsia emulator needs KVM. It won't work unless you enable it.

@nmcain
Copy link
Member

nmcain commented Jun 10, 2021

@EnderNightLord-ChromeBook I think thats understood, the issue here is that Ubunut 18.04 doesnt configure the permissions correctly, although i'm not able to reproduce this, seems to run out of the box on every other system I have.

@carbonatedcaffeine
Copy link
Member

I see

@nealmcb
Copy link
Contributor Author

nealmcb commented Jun 10, 2021

Ahh - linking to this from the README or some other documentation might help people diagnose kvm issues. I found it in
Set up and start the Fuchsia emulator (FEMU).

To verify that KVM is configured correctly, run the following command:

if [[ -r /dev/kvm ]] && grep '^flags' /proc/cpuinfo | grep -qE 'vmx|svm'; then echo 'KVM is working'; else echo 'KVM not working'; fi

@nmcain
Copy link
Member

nmcain commented Jun 10, 2021

I'll be sure to implement that command into the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants