budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
9.56k stars 1.27k forks source link

[🐛 Bug ]: This user doesn't have permissions to use KVM (/dev/kvm) #369

Closed dxomg closed 1 year ago

dxomg commented 1 year ago

Operating System

Ubuntu 22.04

Docker Image

budtmo/docker-android:emulator_9.0

Expected behaviour

To start the thing and not throw the KVM permission error

Actual behaviour

It crashes saying the error This user doesn't have permissions to use KVM (/dev/kvm)

I tried fixing it following with what it was complaining about but found out there was no root user and that chmod 777 to /dev/kvm didn't work

egrep -c '(svm|vmx)' /proc/cpuinfo returns 2 so I have access to KVM

Logs

root@dxomg:~# docker exec android-container /usr/bin/emulator -avd samsung_galaxy_s10_9.0
INFO | Android emulator version 32.1.14.0 (build_id 10330179) (CL:N/A) INFO | Found systemPath /opt/android/system-images/android-28/google_apis/x86_64/ WARNING | Failed to process .ini file /home/androidusr/emulator/quickbootChoice.ini for reading. ProbeKVM: This user doesn't have permissions to use KVM (/dev/kvm). The KVM line in /etc/group is: [LINE_NOT_FOUND]

If the current user has KVM permissions, the KVM line in /etc/group should end with ":" followed by your username.

If we see LINE_NOT_FOUND, the kvm group may need to be created along with permissions: sudo groupadd -r kvm

Then ensure /lib/udev/rules.d/50-udev-default.rules contains something like:

# KERNEL=="kvm", GROUP="kvm", MODE="0660"
# and then run:
sudo gpasswd -a $USER kvm

If we see kvm:... but no username at the end, running the following command may allow KVM access: sudo gpasswd -a $USER kvm

You may need to log out and back in for changes to take effect.

ERROR | x86_64 emulation currently requires hardware acceleration! CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm). The KVM line in /etc/group is: [LINE_NOT_FOUND]

If the current user has KVM permissions, the KVM line in /etc/group should end with ":" followed by your username.

If we see LINE_NOT_FOUND, the kv More info on configuring VM acceleration on Linux: https://developer.android.com/studio/run/emulator-acceleration#vm-linux General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration. INFO | Storing crashdata in: /tmp/android-unknown/emu-crash.db, detection is enabled INFO | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.

budtmo commented 1 year ago

Hi @dxomg ,

the issue is not on docker image but on your host machine configuration. Please check if your used host user have access to kvm. I will close the ticket as it is not an issue on the project. Feel free to reopen if needed.

dxomg commented 1 year ago

Hi @dxomg ,

the issue is not on docker image but on your host machine configuration. Please check if your used host user have access to kvm. I will close the ticket as it is not an issue on the project. Feel free to reopen if needed.

I'm no longer using the project but anyways I just wanted to clarify that yes, KVM was accessible and was specified on the post

InkAndSteel commented 11 months ago

I have the exact same issue, KVM is available on host, and host user has the necessary permissions.... Its role however is not available inside the container and I am not able to add it manually.

dxomg commented 10 months ago

I have the exact same issue, KVM is available on host, and host user has the necessary permissions.... Its role however is not available inside the container and I am not able to add it manually.

I had KVM on my container and it still didn't work