Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grant current user access to /dev/kvm

I'm completely new to android development. After installing android studio with an empty project and adding a pixel device from AVD. On running it shows me the error

07/15 09:33:42: Launching 'app' on Pixel 3a API 28.
Error while waiting for device: Could not start AVD

I opened AVD manager where i can see

/dev/kvm device: permission denied 

In troubleshooting options i can see Grant current user access to /dev/kvm

I've already tried many tricks and i'm the member of kvm after running following commands(found in answers on stack) in terminal i got the following output:

$ ls -al /dev/kvm:

crw-rw---- 1 root root 10, 232 Jul 15 09:19 /dev/kvm

$ grep kvm /etc/group:

kvm:x:1001:

sudo chown $devendra /dev/kvm: after entering password:

chown: missing operand after ‘/dev/kvm’
Try 'chown --help' for more information.

But after running the command :' $ sudo chown devendra /dev/kvm ' program runs but only for once. On re-run it again gives the same error:

07/15 09:33:42: Launching 'app' on Pixel 3a API 28.
Error while waiting for device: Could not start AVD

For every run of program i have to run the command ' $ sudo chown devendra /dev/kvm ' Why?

Now i don't understand where i'm wrong or what i'm missing. Please guide me.

like image 672
devspartan Avatar asked May 15 '26 11:05

devspartan


1 Answers

It's quite strange that group "root" have access to "/dev/kvm", in my case, it's group "kvm":

ls -l /dev/kvm
crw-rw---- 1 root kvm 10, 232 sept.   5 23:55 /dev/kvm

Adding current user to group "kvm" solved my problem:

usermod -a -G kvm yourUserName
reboot
like image 131
Edmond Avatar answered May 17 '26 03:05

Edmond