问题描述
当我尝试在模拟器上运行我的 Android 应用程序时,我收到此错误:
When I try to run my Android app on an emulator I get this error:
/dev/kvm 权限被拒绝.
我检查了权限并将我当前登录的用户添加到 kvm 组.怎么了?
I checked the permissions and added the user I am currently logged in with to the kvm group. What is wrong?
推荐答案
如评论中所述,从 Ubuntu 18.04 和 Linux Mint Tara 开始,您需要首先 sudo apt install qemu-kvm.
As mentioned in the comments, starting with Ubuntu 18.04 and Linux Mint Tara you need to first sudo apt install qemu-kvm
.
检查/dev/kvm
的所有权使用
ls -al /dev/kvm
用户是root
,组kvm
.要检查哪些用户在 kvm
组中,请使用
The user was root
, the group kvm
. To check which users are in the kvm
group, use
grep kvm /etc/group
这个回来了
kvm:x:some_number:
在我的系统上:由于最后的 :
右侧没有任何内容,kvm
组中没有用户.
on my system: as there is nothing rightwards of the final :
, there are no users in the kvm
group.
要将您的用户添加到 kvm 组,您可以使用
sudo adduser $USER kvm
将用户添加到组中,然后使用 grep kvm/etc/group
再次检查.
which adds the user to the group, and check once again with grep kvm /etc/group
.
正如@marcolz 提到的,命令 newgrp kvm
应该为您更改群组成员资格.如果这不起作用,@Knossos 提到您可能想要注销并重新登录(或重新启动),以使权限生效.或者按照提到的@nmirceac并通过 su - $USER
重新登录同一个 shell.
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
.
这篇关于Android Studio:/dev/kvm 设备权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!