| Summary: | [poky] qemu running with KVM needs root permission | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Meta-yocto | Reporter: | Jiajun Xu <jiajun.xu> |
| Component: | meta-yocto | Assignee: | Edwin Zhai <edwin.zhai> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | High | CC: | edwin.zhai, kevin.tian, kunwei.tian, poky.bs.watcher, poky.watcher, richard.purdie, sgw |
| Version: | 1.0 | ||
| Target Milestone: | 1.0 M2 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Program Management | Documentation change: | --- |
|
Description
Jiajun Xu
2010-12-15 06:47:44 UTC
ubuntu required root privilege to access kvm module for security reason. One fix is to use "sudo" to run qemu. Another one is change the ownership of "/dev/kvm", which is more reasonable. Other distribution like RH and Debian seems has something similar, so step 1~3 are probably not needed. Jiajun, Can you have a try on following steps? I'll make documents for those in our wiki 1. As root to insert all modules # modprobe kvm-intel 2. Add a new group named "kvm", and add current user to it $sudo addgroup --system kvm $sudo adduser $USER kvm 3. Change the ownership and mod $ sudo chown root:kvm /dev/kvm $ sudo chmod 0660 /dev/kvm The output of "ls -l /dev/kvm" should be like this: crw-rw----+ 1 root kvm 10, 232 2010-07-02 09:27 /dev/kvm 4. to make it works, need logout then login with current user, now you can access kvm module as non-root user. I have created a howto @ https://oldwiki.pokylinux.org/wiki2/index.php/How_to_enable_KVM_for_Poky_qemu I have no edit right on the public wiki. Once I get it, I can move it to public wiki. Jiajun, It works on my part. Can you have a try with the ownership changing part. If it works, I can mark it as fix. Thanks, Edwin: Firstly, can we detect whether we have permission to access the kvm device and only use it if we have permission? If we don't have permission can we print a warning to the user about how to enable the speedup? Secondly, you can get edit permissions on the wiki by creating an account and confirming your email address. (In reply to comment #3) > Edwin: > > Firstly, can we detect whether we have permission to access the kvm device and > only use it if we have permission? If we don't have permission can we print a > warning to the user about how to enable the speedup? This was also what Ke suggested and I'm doing. The issue here is I have no idea of how to open the "/dev/kvm" with rw mode in bash to check if we have the right. I don't want to write a C program using "open" system call, or check the ownership and rw permission of "/dev/kvm" against current user in a complicated way. > > Secondly, you can get edit permissions on the wiki by creating an account and > confirming your email address. Done. Thanks (In reply to comment #4) > (In reply to comment #3) > > Edwin: > > > > Firstly, can we detect whether we have permission to access the kvm device and > > only use it if we have permission? If we don't have permission can we print a > > warning to the user about how to enable the speedup? > This was also what Ke suggested and I'm doing. The issue here is I have no idea > of how to open the "/dev/kvm" with rw mode in bash to check if we have the > right. I don't want to write a C program using "open" system call, or check the > ownership and rw permission of "/dev/kvm" against current user in a complicated > way. how about using "9<>/dev/kvm"? got fixed in poky/master @ 983bd9a77e4afdb2890245653f39d6c6d093a655 Kunwei, Could you help to verify the bug by following Edwin's BKM, https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu? According to Edwin's methods,this problem was resolved.So verified it as fixed. |