Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 680674 - app-cdr/cdemu - cdemu0: Kernel I/O: failed to open control device /dev/vhba_ctl: Permission denied!
Summary: app-cdr/cdemu - cdemu0: Kernel I/O: failed to open control device /dev/vhba_c...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-17 09:49 UTC by Pavel Kozlov
Modified: 2020-04-11 14:25 UTC (History)
0 users

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 Pavel Kozlov 2019-03-17 09:49:18 UTC
When I am trying to start cdemu-daemon, I see the following error message.

Starting CDEmu daemon with following parameters:
 - num devices: 1
 - control device: /dev/vhba_ctl
 - audio driver: null
 - bus type: session

cdemu0: Kernel I/O: failed to open control device /dev/vhba_ctl: Permission denied!
cdemu: Daemon: failed to start device #0!
cdemu: Daemon: failed to create device!
Daemon initialization and start failed!

Indeed I don't have permissions to this device file.

  File: /dev/vhba_ctl
  Size: 0               Blocks: 0          IO Block: 4096   character special file
Device: 6h/6d   Inode: 19713       Links: 1     Device type: a,39
Access: (0600/crw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-03-17 09:30:11.576666732 +0000
Modify: 2019-03-17 09:30:11.576666732 +0000
Change: 2019-03-17 09:30:11.576666732 +0000
 Birth: -

Udev rule is the following:
 cat /lib/udev/rules.d/69-vhba.rules
# do not edit this file, it will be overwritten on update
#
KERNEL=="vhba_ctl", SUBSYSTEM=="misc", TAG+="uaccess"

How does it suppose to work? I thought I may have to add my user to the special group, but file is accessible for root only.

udev-239, vhba tried 20170610 and 20190302.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-17 16:29:26 UTC
$ getfacl /dev/vhba*
getfacl: Removing leading '/' from absolute path names
# file: dev/vhba_ctl
# owner: root
# group: root
user::rw-
user:mgorny:rw-
group::---
mask::rw-
other::---

$ udevadm info /dev/vhba_ctl
P: /devices/virtual/misc/vhba_ctl
N: vhba_ctl
L: 0
E: DEVPATH=/devices/virtual/misc/vhba_ctl
E: DEVNAME=/dev/vhba_ctl
E: MAJOR=10
E: MINOR=58
E: SUBSYSTEM=misc
E: USEC_INITIALIZED=5177453611
E: TAGS=:seat:uaccess:


I guess it's logind taking care of enabling access to currently logged in user.  Don't know if there are non-logind ways to get it working out of the box.
Comment 2 BT 2020-04-11 11:24:57 UTC
The udev rules needs to be changed to the following:

KERNEL=="vhba_ctl", SUBSYSTEM=="misc", TAG+="uaccess", TAG+="udev-acl"

TAG+="uaccess" is for logind while TAG+="udev-acl" is for ConsoleKit. Tested and working for me.
Comment 3 BT 2020-04-11 11:44:24 UTC
Non logind/ConsoleKit systems can create /etc/udev/rules.d/69-vhba.rules with the following:

KERNEL=="vhba_ctl", SUBSYSTEM=="misc", MODE="0660", GROUP="cdrom"

and add their user to the cdrom group.
Comment 4 Pavel Kozlov 2020-04-11 13:03:20 UTC
Does it mean that I have to install elogind package (and start daemon) to make it work?.. Why not to add this as a dependency?
Comment 5 BT 2020-04-11 14:25:32 UTC
The current udev rule only works when logind is available. You can install elogind but that is overkill if you don't need it for anything else. It's much simpler to add the rule from comment #3 and add your user to the cdrom group.

logind is not a dependency because it's not required for cdemu to function. The udev rule is provided by the package maintainer as a courtesy to the user. Unfortunately it currently doesn't work for all users.