Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 680674

Summary: app-cdr/cdemu - cdemu0: Kernel I/O: failed to open control device /dev/vhba_ctl: Permission denied!
Product: Gentoo Linux Reporter: Pavel Kozlov <pkozlov.vrn>
Component: Current packagesAssignee: Michał Górny <mgorny>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

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

$ 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: 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.