linux – Android Studio 2.3使用来自控制台的模拟器,“/ dev / kvm device:permission denied”适用于root用户

前端之家收集整理的这篇文章主要介绍了linux – Android Studio 2.3使用来自控制台的模拟器,“/ dev / kvm device:permission denied”适用于root用户前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用 Android Studio 2.3的avdmanager(通过命令行)创建虚拟android设备

所有命令都以root用户身份执行

当我尝试通过$〜/ Android / Sdk / tools /./ emulator @ Nexus_5X_Api_23_x86启动模拟器时输出为:

模拟器:错误:x86_64仿真当前需要硬件加速!
请确保KVM已正确安装和使用.
cpu加速状态:此用户无权使用KVM(/ dev / kvm)

我正在使用64位的Ubuntu 16.04服务器,Android Studio是通过x11转发启动的,因此使用了我的桌面环境(这也是ubuntu 16.04,64位!)

当我输入$kvm-ok时它给了我:

信息:/ dev / kvm存在
可以使用KVM加速

要证明我尝试访问的.avd存在:
$〜/ Android / Sdk / tools / bin /./ avdmanager list avd

给出输出
März15,20174:30:53 NACHM. sun.util.PropertyResourceBundleCharset $PropertiesFileDecoder decodeLoop
信息:检测到无效或不可映射的UTF-8序列.将编码从UTF-8切换到ISO-8859-1
可用的Android虚拟设备:
名称:Nexus_5X_Api_23_x86
设备:Nexus 5X(谷歌)
路径:/root/.android/avd/Nexus_5X_Api_23_x86.avd
目标:Google API(Google Inc.)
基于:Android 6.0(Marshmallow)标签/ ABI:google_apis / x86_64
标签:800M

进一步,/ dev / kvm的权限是:

root @ h2627852:〜#ls -l / dev / kvm
crwxrwxrwx 1 root kvm10,232Mär1510:48 / dev / kvm
root @ h2627852:〜#groups root
root:root kvm libvirtd libvirt

执行模拟器检查给了我:

root @ h2627852:〜#〜/ Android / Sdk / tools /./ emulator-check accel hyper-v cpu-info window-mgr desktop-env
加速度:
11
用户无权使用KVM(/ dev / kvm)
加速度
Hyper-V的:
0
Hyper-V仅在Windows上运行
Hyper-V的
cpu-信息:
146
Intel cpu |支持虚拟化| 64位cpu |
cpu-信息
debug1:client_input_channel_open:ctype x11 rchan 3 win 65536 max 16384
debug1:client_request_x11:来自:: 1 36346的请求
debug1:channel 1:new [x11]
debug1:确认x11
debug1:通道1:FORCE输入漏极
窗口经理:
0
GNOME Shell
窗口经理
桌面ENV:
0
伴侣
桌面ENV

我真的不知道该怎么做,在整个论坛上搜索但没有找到我的系统的这个问题的复制品,其他系统上同样问题的修复对我来说不起作用,已经尝试完全清除并重新安装所有qemu,libvirt,libvirtd和kvm软件包,但没有成功.

任何帮助表示赞赏!!

编辑:
〜/ Android / Sdk / tools /./ emulator @ Nexus_5X_Api_23_x86 -verbose给我,

以下输出

emulator:Android emulator version 25.3.0.0 (build_id 3394391)
emulator:Found AVD name 'Nexus_5X_Api_23_x86'
emulator:Found AVD target architecture: x86_64
emulator:argv[0]: '/root/Android/Sdk/tools/./emulator'; program directory: '/root/Android/Sdk/tools'
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:Probing for /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu: file exists
emulator:Auto-config: -engine qemu2 (based on configuration)
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:try dir /root/Android/Sdk/tools
emulator:try dir /root/Android/Sdk/tools/./
emulator:try dir /root/Android/Sdk/emulator
emulator:Found target-specific 64-bit emulator binary: /root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64'
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64/libstdc++'
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:GPU emulation is disabled
emulator: Adding library search path for Qt: '/root/Android/Sdk/emulator/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/root/Android/Sdk/emulator/lib64/qt/plugins
emulator: Running :/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator: qemu backend: argv[00] = "/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
emulator: qemu backend: argv[01] = "@Nexus_5X_Api_23_x86"
emulator: qemu backend: argv[02] = "-verbose"
emulator: Concatenated backend parameters:
 /root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 @Nexus_5X_Api_23_x86 -verbose
emulator: Android virtual device file at: /root/.android/avd/Nexus_5X_Api_23_x86.ini
emulator: virtual device content at /root/.android/avd/Nexus_5X_Api_23_x86.avd
emulator: virtual device config file: /root/.android/avd/Nexus_5X_Api_23_x86.avd/config.ini
emulator: using core hw config path: /root/.android/avd/Nexus_5X_Api_23_x86.avd/hardware-qemu.ini
emulator: Found AVD target API level: 23
emulator: Read property file at /root/Android/Sdk/system-images/android-23/google_apis/x86_64//build.prop
emulator: No boot.prop property file found.
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: autoconfig: -skin HVGA
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu
emulator: Target arch = 'x86_64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /root/Android/Sdk/system-images/android-23/google_apis/x86_64//ramdisk.img
emulator: Using initial system image: /root/Android/Sdk/system-images/android-23/google_apis/x86_64//system.img
emulator: autoconfig: -data /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata-qemu.img
emulator: autoconfig: -initdata /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata.img
emulator: autoconfig: -cache /root/.android/avd/Nexus_5X_Api_23_x86.avd/cache.img
emulator: autoconfig: -sdcard /root/.android/avd/Nexus_5X_Api_23_x86.avd/sdcard.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: GPU emulation is disabled
emulator: Found 2 DNS servers: 85.214.7.22 81.169.163.106
emulator: skin name 'HVGA' aliased to '320x480'
emulator: found magic skin width=320 height=480 bpp=16

emulator: cpu Acceleration: DISABLED
emulator: cpu Acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
emulator: ERROR: x86_64 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)

解决方法

试试吧.
这对我有用
$sudo chown username -R /dev/kvm

有时您还需要运行此代码

$cd Android/Sdk/emulator/lib64/libstdc++
$mv libstdc++.so.6 libstdc++.so.6.bak
$ln -s /usr/lib64/libstdc++.so.6
原文链接:/linux/394641.html

猜你在找的Linux相关文章