kvm permission denied on Android Studio emulator
Asked Answered
M

5

11

When I try to run an AVD, I get this erros:

/dev/kvm device permission denied

Yeah, I know, I don't have the permission to access /dev/kvm, I know that I can "solve" it by changing the /dev/kvm permission to my user, and set my user to kvm group, it is working but when I restart my user session, the /dev/kvm permission return to root user and root group, and I need to set the permission to my group again and again...

How to set this permission and prevent that when I reboot my computer my permission are not changed anymore?

SO: Ubuntu 18.04.01

Mokpo answered 5/10, 2018 at 20:27 Comment(7)
Is your user in kvm group?Devastating
yes, my user are on the kvm group and I already treid the 777 permission too...Mokpo
Did you install all required dependencies as mentioned in official guide? developer.android.com/studio/run/emulator-acceleration#vm-linux and help.ubuntu.com/community/KVM/InstallationDevastating
yes, the problems is: The folder permission and user/group are changin to root every time I logout/turn off my computerMokpo
Can you try this and tell if it works for you: sudo setfacl -m u:$USER:rwx /dev/kvmDevastating
That worked @AndreiVinogradov :) ... What does command do exactly?Grover
I posted this comment as answer with a little explanation. Please, accept it. )Devastating
D
33

This command should help you:

sudo setfacl -m u:$USER:rwx /dev/kvm

Using it you will grant to current user rwx permissions to /dev/kvm. Or just replace $USER to any user you need.

As mentioned in setfacl manpages "This utility sets Access Control Lists (ACLs) of files and directories." It's a little bit different from chmod and chown. Using it you can grant required permissions to specific user. It's a bit more powerful tool and much more fine-grained. If you want to dive deeper, read about Access Control Lists. For example, in ubuntu docs: https://help.ubuntu.com/community/FilePermissionsACLs

Devastating answered 12/10, 2018 at 6:39 Comment(4)
it not worked, if I restart my computer, the permission return.Mokpo
Is package qemu-kvm installed?Devastating
I see two options here. 1) Completely remove qemu-kvm using command "sudo apt autoremove qemu-kvm --purge" and then reinstall it. 2) Add command to set permissions on /dev/kvm to any boot-time script like .bashrc.Devastating
ok, it worked if I put on .bashrc, I think it have other better things to fix that... But ok...Mokpo
T
2

Had same problem, it worked when you restart the program.

sudo chmod 777 -R /dev/kvm

Tehuantepec answered 24/10, 2019 at 21:27 Comment(0)
G
0

Permissions for kernel virtual machine can be updated with the command sudo chmod 777 -R /dev/kvm in ubuntu system.

Governess answered 14/5, 2020 at 19:17 Comment(0)
V
0

Update system BIOS Setting Assus

  1. Power on the system and press[delete] key to enter BIOS [EZ Mode]
  2. Press [F7] key to enter BIOS [Advance Mode] as below picture: (If press [delete] key to enter [Advanced Mode] directly and then no need to press [F7] key any more)
  3. Select [Advanced] page and click [CPU Configuration] item
  4. Select [Intel(VMX) Virtualization Technology] item and set to [Enabled]
  5. Press [F10] key and click [OK] ,the system will auto reboot

enter image description here

Vogt answered 23/11, 2022 at 6:15 Comment(0)
T
-1

The right permissions are:

sudo chmod 666 /dev/kvm
Tracitracie answered 22/6, 2020 at 19:5 Comment(1)
Please make sure to explain your solution and how it is different from the previous answers. Also if you're stating something (as a fact) you should usually include at least one source.Cracknel

© 2022 - 2024 — McMap. All rights reserved.