Android Studio: /dev/kvm device permission denied

后端 未结 27 3122
鱼传尺愫
鱼传尺愫 2020-12-02 03:12

When I try to run my Android app on an emulator I get this error:

/dev/kvm permission denied.

I checked the permissions and ad

相关标签:
27条回答
  • 2020-12-02 03:52

    If you open your ide with sudo. You are not going to have this problem.

    0 讨论(0)
  • 2020-12-02 03:55

    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 your user to the kvm group, you could use

    sudo adduser $USER kvm
    

    which adds the user to the group, and check once again with grep kvm /etc/group.

    As mentioned by @marcolz, the command newgrp kvm should change the group membership live for you. If that did not work, @Knossos mentioned that you might want to log out and back in (or restart), for the permissions to take effect. Or do as @nmirceac mentioned and re-login in the same shell via su - $USER.

    0 讨论(0)
  • 2020-12-02 04:00

    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.

    0 讨论(0)
  • 2020-12-02 04:02

    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
    
    0 讨论(0)
  • 2020-12-02 04:03

    I am using linux debian, and i am facing the same way. In my AVD showing me a message "/dev/kvm permission denied" and i tried to find the solution, then what i do to solve it is, in terminal type this :

    sudo chmod -R 777 /dev/kvm
    

    it will grant an access for folder /dev/kvm,then check again on your AVD , the error message will disappear, hope it will help.

    0 讨论(0)
  • 2020-12-02 04:04

    Have you also tried following, it should work:

    sudo chown <username> /dev/kvm
    sudo chmod o+x /dev/kvm
    
    0 讨论(0)
提交回复
热议问题