kvm permission denied on Android Studio emulator
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
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
sudo adduser <username> kvm If you are getting permission denied, try following command. Cannot launch AVD in emulator in android studio .Invalid argument. 132.
Had same problem, it worked when you restart the program.
sudo chmod 777 -R /dev/kvm
Ubuntu18.04에서 Android Studio의 Emulator가 동작안하는 문제가 있었습니다. 실행하려고 하면 아래와 같이 '/dev/kvm device: permission denied.'라는 에러가 계속 떴습니다.
Permissions for kernel virtual machine can be updated with the command
sudo chmod 777 -R /dev/kvm in ubuntu system.
Under Ubuntu, the permissions of /dev/kvm usually look like this: $ ls -l /dev/kvm crw-rw---- 1 root kvm 10, 232 May 24 09:54 /dev/kvm The user that runs the Android emulator (i.e. your user) needs to get access to this device.
How to Fix /dev/kvm Permission Denied The easiest dan quickest way to fix the issue is installing qemu-kvm and add your user to kvm group. Ah ya, this solution should work in Debian and Ubuntu based distributions.
Menyelesaikan Masalah Emulator Android Studio /dev/kvm device permission denied di Linux Ubuntu 18.04 Ditulis oleh Bagus Aji Santoso , dipublikasi pada 27 Jun 2018 dalam kategori Tutorial Jika pembaca menggunakan Linux (Ubuntu atau yang lainnya) dalam menggunakan Android Studio, bisa jadi pembaca di awal menemukan masalah saat akan menggunakan
The Android Emulator lets you develop and test Android apps without using a physical device. This page describes command-line features that you can use with the Android Emulator. For information about using the Android Emulator UI, see Run Apps on the Android Emulator .
- Is your user in kvm group?
- yes, my user are on the kvm group and I already treid the 777 permission too...
- 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/Installation
- yes, the problems is: The folder permission and user/group are changin to root every time I logout/turn off my computer
- Can you try this and tell if it works for you: sudo setfacl -m u:$USER:rwx /dev/kvm
- it not worked, if I restart my computer, the permission return.
- Is package qemu-kvm installed?
- 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.
- ok, it worked if I put on .bashrc, I think it have other better things to fix that... But ok...