Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 580436 - app-emulation/qemu: /dev/kvm has wrong permission until a reboot is performed
Summary: app-emulation/qemu: /dev/kvm has wrong permission until a reboot is performed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo QEMU Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-18 14:50 UTC by Agostino Sarubbo
Modified: 2016-04-20 02:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2016-04-18 14:50:33 UTC
In a fresh installed system, after the installation of qemu, I have:

horizon ~ # ls -la /dev/kvm 
crw------- 1 root root 10, 232 apr 18  2016 /dev/kvm


In this way I have permission denied when I try to start a vm.

after a reboot I have:

horizon ~ # ls -la /dev/kvm
crw-rw---- 1 root kvm 10, 232 apr 18  2016 /dev/kvm


A workaround is set by hand chmod 660 and chown root:kvm


Is there a way that the ebuild can do this to avoid reboot or manually operations?
Comment 1 Mike Gilbert gentoo-dev 2016-04-18 15:00:29 UTC
If you want to trigger the udev rule from pkg_postinst, here's some code:

if [[ ${ROOT} == / ]] && type -p udevadm >/dev/null; then
    udevadm trigger -c add /dev/kvm
fi
Comment 2 Doug Goldstein (RETIRED) gentoo-dev 2016-04-18 22:02:28 UTC
(In reply to Mike Gilbert from comment #1)
> If you want to trigger the udev rule from pkg_postinst, here's some code:
> 
> if [[ ${ROOT} == / ]] && type -p udevadm >/dev/null; then
>     udevadm trigger -c add /dev/kvm
> fi

We used to do that and then it was deemed not cool to poke udev from an ebuild so it was in an einfo but that might have been swallowed by the bit bucket at some point.
Comment 3 SpanKY gentoo-dev 2016-04-19 22:49:44 UTC
(In reply to Doug Goldstein from comment #2)

yeah, i'm not keen on that sort of thing.  if we do want to go that route, seems like the udev eclass should own most of it.  that way the qemu ebuild would only hold something like:
  udev_trigger -c add /dev/kvm

looking at the history in the tree, i'm not seeing any calls to udevadm.  we have udev_reload right now already, and we still have a kvm related elog (for the first install, but that's what we're discussing here).

maybe the simple fix is to just extend the DOC_CONTENTS to mention this initial perm reset/reload issue and leave it up to users to read/react/run that command themselves ?
Comment 4 Doug Goldstein (RETIRED) gentoo-dev 2016-04-19 23:23:56 UTC
(In reply to SpanKY from comment #3)
> (In reply to Doug Goldstein from comment #2)
> 
> yeah, i'm not keen on that sort of thing.  if we do want to go that route,
> seems like the udev eclass should own most of it.  that way the qemu ebuild
> would only hold something like:
>   udev_trigger -c add /dev/kvm
> 
> looking at the history in the tree, i'm not seeing any calls to udevadm.  we
> have udev_reload right now already, and we still have a kvm related elog
> (for the first install, but that's what we're discussing here).

Hmm. It could be I proposed it and got whacked with a clue-by-four before I committed it.

> 
> maybe the simple fix is to just extend the DOC_CONTENTS to mention this
> initial perm reset/reload issue and leave it up to users to read/react/run
> that command themselves ?

Yeah that's probably the best way forward. I don't know the trick to peek at history now days that we've left the old bits behind and I nuked CVS but I'd be willing to guess I wrote DOC_CONTENTS and its just a bit to minimal and needs to be more clear / extended.