When I try to run my Android app on an emulator I get this error:
/dev/kvm permission denied.
I checked the permissions and added the user I am currently logged in with to the kvm group. What is wrong?
When I try to run my Android app on an emulator I get this error:
/dev/kvm permission denied.
I checked the permissions and added the user I am currently logged in with to the kvm group. What is wrong?
As mentioned in the comments, starting with Ubuntu 18.04 and Linux Mint Tara you need to first sudo apt install qemu-kvm
.
To check the ownership of /dev/kvm
use
ls -al /dev/kvm
The user was root
, the group kvm
. To check which users are in the kvm
group, use
grep kvm /etc/group
This returned
kvm:x:some_number:
on my system: as there is nothing rightwards of the final :
, there are no users in the kvm
group.
To add the user yourname
to the kvm group, you could use
sudo adduser yourname kvm
which adds the user to the group, and check once again with grep kvm /etc/group
.
As mentioned by @Knossos, you might want to log out and back in (or restart), for the permissions to take effect.
To open a terminal, see https://askubuntu.com/questions/183775/how-do-i-open-a-terminal#183777.
To find out your username, see https://askubuntu.com/questions/333718/how-can-i-find-out-my-user-name#333832.
This is how I got it to work in Ubuntu 18.04
sudo apt install qemu-kvm
Add your user to kvm group using:
sudo adduser <Replace with username> kvm
If still showing permission denied:
sudo chown <Replace with username> /dev/kvm
Try it.
Have you also tried following, it should work:
sudo chown <username> /dev/kvm
sudo chmod o+x /dev/kvm
Try this, it worked for me:
sudo apt install qemu-kvm
sudo chown -R <username>:<username> /dev/kvm –
This is because /dev/kvm
is not accessible. To make is accessible from android studio run the below command
sudo chmod 777 -R /dev/kvm
It will ask for your password. After that restart Android Studio.
KVM
is required to rum emulator. If you have not install it yet then install it
sudo apt install qemu-kvm
I got this error after updating my ubuntu to 18.04.1. I just download new system image for emulator or you can say that download new emulator and it is worked for me.
Running the below command in Ubuntu 18.04 worked for me sudo chown -R /dev/kvm
I was in a similar situation with the same error of permissions on /dev/kvm I had done the necessary installations but not added the user to the kvm group All I had to do was
sudo adduser <Replace with username> kvm
and ofcourse DON'T forget to restart your Ubuntu instance.
If you open your ide with sudo. You are not going to have this problem.