CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm) in docker
Asked Answered
S

1

8

I have built a docker with appium, java8, android sdk, node 8.11.0, cucumber and ruby Once I have created the device I check kvm-ok

getting

   root@994d47ae73ce:/opt/android-sdk/emulator# kvm-ok                                                        
   INFO: /dev/kvm exists
   KVM acceleration can be used

when I execute

root@994d47ae73ce:/opt/android-sdk/emulator# emulator 
@Nexus_5X_API_24 -verbose -no-window -skin 1080x1920

then

emulator: autoconfig: -kernel /opt/android-sdk/system-images/android-24/google_apis/x86//kernel-ranchu
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /opt/android-sdk/system-images/android-24/google_apis/x86//ramdisk.img
emulator: Using initial system image: /opt/android-sdk/system-images/android-24/google_apis/x86//system.img
emulator: No vendor image
emulator: autoconfig: -data /root/.android/avd/Nexus_5X_API_24.avd/userdata-qemu.img
emulator: autoconfig: -initdata /root/.android/avd/Nexus_5X_API_24.avd/userdata.img
emulator: autoconfig: -cache /root/.android/avd/Nexus_5X_API_24.avd/cache.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 0MB is below hardware specified minimum of 256MB,setting it to that value
emulator: System image is read only
emulator: Found 2 DNS servers: 8.8.8.8 8.8.4.4
emulator: found magic skin width=1080 height=1920 bpp=16

statvfs('/root/.android/avd/Nexus_5X_API_24.avd/snapshots/default_boot/ram.img') failed: No such file or directory
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'qemu.cmdline' = 'androidboot.logcat=v:* androidboot.consolepipe=qemu_pipe,pipe:logcat'
emulator: Adding boot property: 'qemu.logcat' = 'start'
emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
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.

it isn't work the tipical solutions

sudo apt install qemu-kvm
sudo adduser $USER kvm
sudo chown $USER /dev/kvm

Thanks in advance

Specify answered 17/9, 2019 at 16:3 Comment(2)
Have you tried running the Docker container with the --privileged option?Criss
That's was the key the --privileged option when I run the docker. Thanks GracefulRestartSpecify
C
0

On your host machine in the powershell run the below command by replacing with the name of virtual machine, While the virtual machine is in the OFF state

Set-VMProcessor -VMName -ExposeVirtualizationExtensions $true

Now start the virtual machine and Head over to your terminal and run the following command to install qemu-kvm: sudo apt install qemu-kvm

Next, you need to add the user your-username to the kvm group using the following command: sudo adduser username kvm

Next, in some cases, you also need to run the following command: sudo chown username /dev/kvm

You can get your username using the following command: whoami

Now, you can verify if your username is added to kvm group using the following command: grep kvm /etc/group

Clepsydra answered 23/1, 2024 at 4:8 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.