Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
openrc/VHBA udev rules & cdemu-daemon&Co... [ebuild]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Mon Sep 04, 2017 10:59 pm    Post subject: openrc/VHBA udev rules & cdemu-daemon&Co... [ebuild] Reply with quote

Hi,
Something seemed wrong when gcdemu was 1st installed, because to have it working I had to push a rule in /etc/udev/rules.d. i.e. to allow cdemu group against /dev/vhba_ctl.

After stable upgrade, it seems like this rule is gone and all I can see is
Code:
/lib/udev/rules.d/69-vhba.rules:KERNEL=="vhba_ctl", SUBSYSTEM=="misc", TAG+="uaccess"


New stable vhba doesn't show
Code:
Log: postinst
Don't forget to add your user to the cdemu group if you want to
be able to use virtual cdemu devices.
anymore. So should cdemu group be deleted???

But the main question is: Since it doesn't work out of the upgrade box what is the correct way to have it working?

Restoring my udev rule for vhba? (This is what I did for a fix, but I'd rather like things to be as right as possible.)

How is it supposted to work from
Code:
KERNEL=="vhba_ctl", SUBSYSTEM=="misc", TAG+="uaccess"
to user:users profile, or even user:cdemu?

Maybe out of scope: eudev here, not systemd.

Thanks 4 ur attention, interest & support.


Last edited by CaptainBlood on Wed Sep 08, 2021 5:39 pm; edited 4 times in total
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Wed Sep 27, 2017 12:44 pm    Post subject: Reply with quote

Thanks for the heads up.

Personally, I'm not sure how tightly 'uaccess' tag is bound with systemd, given that technically it's an udev builtin.

For quite awhile instead of that main repo group rule, I've been using following (obviously combined with udev-acl (from consolekit))
Code:

KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu", TAG+="udev-acl"
KERNEL=="vhba_ctl", TEST=="/var/run/ConsoleKit/database", RUN+="udev-acl --action=\$env{ACTION} --device=\$env{DEVNAME}"


There's a bit of redundancy there, but it worked reasonably well. No idea, if uaccess can be used for something similar outside systemd.

PS: to clarify, while I was leaving the GROUP bit, I never bothered to add my user to cdemu group - with these rules, things worked as with any normal removable drive.
Back to top
View user's profile Send private message
cameta
Veteran
Veteran


Joined: 04 Aug 2004
Posts: 1320

PostPosted: Sat Sep 30, 2017 7:52 am    Post subject: Reply with quote

With the new stable vhba I can't start the cdemu-daemon

Code:
 uname -r
4.12.12-gentoo

Code:
cdemu-daemon
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!With the
cdemu: Daemon: failed to start device #0!
cdemu: Daemon: failed to create device!
Daemon initialization and start failed!

Only the user root can read and write the /dev/vhba_ctl .
_________________
Si algo falla LEE el jodido manual, Si sigue fallando LEE BIEN el jodido manual.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Sat Sep 30, 2017 9:47 am    Post subject: Reply with quote

Here:
Code:
cat  /etc/udev/rules.d/60-vhba.rules
KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu"
Code:
grep cdemu /etc/group
cdemu:x:981:<USERNAME>
which may work without acl.
Thks 4 ur attention, interest & support.
Back to top
View user's profile Send private message
cameta
Veteran
Veteran


Joined: 04 Aug 2004
Posts: 1320

PostPosted: Sat Sep 30, 2017 12:37 pm    Post subject: Reply with quote

Thank You very much
Code:
grep cdemu /etc/group
cdemu:x:981:<USERNAME>

I have done it this way
Code:
gpasswd -a username cdemu

I think that It would be necessary to open a bug for the ebuild.
_________________
Si algo falla LEE el jodido manual, Si sigue fallando LEE BIEN el jodido manual.
Back to top
View user's profile Send private message
Ambrevar
n00b
n00b


Joined: 11 Jul 2017
Posts: 11

PostPosted: Sat Nov 25, 2017 3:37 pm    Post subject: Reply with quote

I ran into the same issue and the aforementioned fix works.

Has anyone reported the issue?
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Jul 01, 2018 2:19 pm    Post subject: Reply with quote

Code:
cat  /etc/udev/rules.d/60-vhba.rules
KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu"

I don't have "cdemu" group in my system (seems to be it wasn't created at install). I that normal?
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Fri Oct 25, 2019 6:39 am    Post subject: Reply with quote

Same here after rebuild of the whole system.
I've set it to cdrom instead, which works. accordingly to Official site link

Thks 4 ur attention, interest & support.


Last edited by CaptainBlood on Sat Oct 26, 2019 1:48 am; edited 3 times in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Fri Oct 25, 2019 6:41 am    Post subject: Reply with quote

Doesn't seem to work with any of 3.7.x gentoo-sources here, which where all migrated from working 3.2.x by applying
Code:
make oldconfig
Thks 4 ur attention, interest & support.

Last edited by CaptainBlood on Sat Oct 26, 2019 1:53 am; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Sat Oct 26, 2019 1:37 am    Post subject: Reply with quote

vhba-20190831 fixes 3.7.x kernel series issue, 20190827 doesn't.
Wouldn't be surprised 20190827 being useless.:?

Thks 4 ur attention, interest & support
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Wed Jun 02, 2021 5:35 pm    Post subject: Reply with quote

It's being working fine here along with openrc/elogind since,
as
Code:
cat 69-vhba.rules
# do not edit this file, it will be overwritten on update
#

KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdrom"
Code:
grep cdrom /etc/group
cdrom:x:19:<USERNAME>
until today, where trying to mount iso image which triggers
Code:
Daemon autostart failed. Error:
g-io-error-quark: 'Error  while calling StartServiceByName for net.sf.cdemu.CDEmuDaemon : Time-out reached (24)' <Translated>
Code:
echo 'KERNEL=="vhba_ctl", SUBSYSTEM=="misc", TAG+="udev-acl"' | sudo tee /etc/udev/rules.d/vhba-dkms.udev ; sudo udevadm control --reload-rules ; sudo udevadm trigger ; cdemu-daemon &
gcdemu
from Github works fine.

Accordingly I guess there is an integration issue I hav'ent figured out a fix for yet.

Moreover the above working command only loads GUI interface for cdemu.
An additional manual step is required to load an iso, whereas iso image were mountable from user file browser session.

Any idea is welcome.

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Jun 02, 2021 6:13 pm    Post subject: Reply with quote

If you want a rule to hang around, put it in /etc/udev/rules.d not /lib/udev/rules.d

Edit to add: https://bugs.launchpad.net/cdemu/+bug/1926303
Your problem is likely to be dbus related.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Wed Jun 02, 2021 6:56 pm    Post subject: Reply with quote

Anon-E-moose,
thks 4 the link.
I currently investigating accordingly.
udev rules have always been a brain killer here...

I've indeed forgot to provide file path:
Code:
cat /etc/udev/rules.d/69-vhba.rules
# do not edit this file, it will be overwritten on update
#

KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdrom"


As a workaround
Code:
cat /etc/portage/package.mask/monolithic.conf
#>sys-fs/vhba-20200106-r1
>=app-cdr/cdemu-daemon-3.2.5
>=app-cdr/cdemu-3.2.5
>=app-cdr/gcdemu-3.2.5
recovers feature here.

Issue could be somewhere in dbus related config or executable file in 3.2.5.

Another pain will be relocating 3.2.4 to local repo before deletion from the portage tree.

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Jun 02, 2021 7:11 pm    Post subject: Reply with quote

dbus is used to start the daemon.

a simple dbus-run-session -- cdemu would probably work (on the newer one)

OR

simply start the daemon yourself, ahead of using the gui.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Wed Jun 02, 2021 7:39 pm    Post subject: Reply with quote

Thks again,
will give it a assumption checking try.

Scarcely used background deamon launch be default is not wishable in the long run, though.

The main problem is likely that cdemu app stack seems designed for systemd, with udev rules designed accordingly.
IIRC when I tried to ask for help when not using systemd, my request was somehow rejected.

Cherry picking with google was my only salute for a fix then...

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Jun 02, 2021 7:48 pm    Post subject: Reply with quote

If running separately (because dbus not installed for example) then I'd wrap it in shell script, first start the daemon then the client side and pass all arguments sent to the script.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Sun Aug 08, 2021 5:32 pm    Post subject: Reply with quote

Anon-E-moose,
Thks 4 ur support, as it gave me courage enough to catch the source of the issue:
3.2.5 fails to install:
Code:
ll /usr/libexec/cdemu-daemon-session.sh
-rwxr-xr-x 1 root root 521 janv.  6  2020 /usr/libexec/cdemu-daemon-session.sh
which 3.2.4 version contains
Code:
cat /usr/libexec/cdemu-daemon-session.sh
#!/bin/sh
# Starts the CDEmu daemon instance on D-Bus *session* bus. Optional
# configuration (number of devices, audio driver, log file) are read
# from ~/.cdemu-daemon

# Default settings
NUM_DEVICES=1
AUDIO_DRIVER=default
LOG_FILE=~/.cdemu-daemon.log

# Read the settings
CONFIG_FILE=~/.cdemu-daemon

if [ -f ${CONFIG_FILE} ]; then
    . ${CONFIG_FILE};
fi

# Start the daemon
exec cdemu-daemon --ctl-device=/dev/vhba_ctl --bus=session --num-devices=${NUM_DEVICES} --audio-driver=${AUDIO_DRIVER} --logfile=${LOG_FILE}
Guess it's time for setting a local ebuild release version.

That solves the underlying 3.2.4 issue <=python3_8

Thks 4 ur attention, interest & support
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Tratkazir_the_1st
n00b
n00b


Joined: 18 Feb 2020
Posts: 16

PostPosted: Tue Aug 10, 2021 5:31 am    Post subject: Reply with quote

(Correct me pls if I'm writing to wrong topic)

Pls check UID\GID of file /dev/vhba_ctls. Mine were root:root. After changing them to root:cdrom & manual startup of cdemu daemon - everything works :). (The very idea of UID\GID check I've got from secondary installed system, Devuan. Everything was working there right after package installation. Pls excuse my bad English :) .)
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Tue Aug 10, 2021 11:55 am    Post subject: Reply with quote

Tratkazir_the_1st,
You're welcome here.
My guess is you're using systemd, isn't it, as the file you mentionned doesn't exist here on openrc.
I've clarified this constraint in the OP title.

Anyhow, thks for posting, as you forced me to revaluate my original fix which didn't work after a reboot. :oops:

Indeed, additionally to restoring /usr/libexec/cdemu-daemon-session.sh from 3.2.4,one existing 3.2.5 file has to be edited from 3.2.5 version:
Code:
cat /usr/share/dbus-1/services/net.sf.cdemu.CDEmuDaemon.service
DEmuDaemon.service
[D-BUS Service]
Name=net.sf.cdemu.CDEmuDaemon
SystemdService=cdemu-daemon.service
Exec=/bin/true
back to its 3.2.4 version:
Code:
cat /usr/share/dbus-1/services/net.sf.cdemu.CDEmuDaemon.service
[D-BUS Service]
Name=net.sf.cdemu.CDEmuDaemon
Exec=/usr/libexec/cdemu-daemon-session.sh
I've tested after a cold reboot.
Working fine here.

The ebuild.log warns about the issue:
Code:
As of 3.2.5, cdemu-daemon no longer supports autoloading
on non-systemd systems.  OpenRC users have to start it manually.
 
We install /etc/modules-load.d/vhba.conf to load the module
automatically, and D-BUS autolaunch will start cdemu-daemon user
service.
Guess it's time to patch 3.2.5 ebuild with a openrc or a systemd USE flag.

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Tratkazir_the_1st
n00b
n00b


Joined: 18 Feb 2020
Posts: 16

PostPosted: Thu Aug 12, 2021 8:55 am    Post subject: Reply with quote

CaptainBlood wrote:
Tratkazir_the_1st,

My guess is you're using systemd, isn't it, as the file you mentionned doesn't exist here on openrc.


Wrong assumtion because I hate systemd & that was the cause of my switch from Debian to Gentoo :D.
The mentioned file exists when module vhba.ko is loaded someway (manually or by .conf in /etc/modprobe.d). At last one guy from other forum (russian, where I read\write alot) advised me to check groups. My user wasn't in group "messagebus". After adding & relogin & manual start of cdemu-daemon - all works. (As for now, added command "cdemu-daemon &" to ~/.xprofile)
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Thu Aug 12, 2021 10:53 am    Post subject: Reply with quote

OK, :lol:
Here may be a different use case scenanrio/environment:

/etc/conf.d/modules
Code:
modules_5_13_9_gentoo="${modules_5_13_9_gentoo}vhba "
/etc/udev/rules.d;
Code:
cat /etc/udev/rules.d/*vhba.rules
KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdrom"
/etc/group
Code:
grep 'cdrom\|messagebus' /etc/group
cdrom:x:19:user
messagebus:x:249:
So no cdemu daemon permanently loaded.
My way for trying to be minimalistic.

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3586

PostPosted: Sun Dec 19, 2021 10:28 pm    Post subject: Reply with quote

3.2.6 is out...
liberty taken here to set things altogether... well as much as possible:
Code:
cat /var/db/repos/local-repo/app-cdr/cdemu-daemon/cdemu-daemon-3.2.6-r0.ebuild
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake systemd

DESCRIPTION="Daemon of the CDEmu optical media image mounting suite"
HOMEPAGE="https://cdemu.sourceforge.io"
SRC_URI="https://download.sourceforge.net/cdemu/cdemu-daemon/${P}.tar.xz"

LICENSE="GPL-2+"
SLOT="0/7" # subslot = CDEMU_DAEMON_INTERFACE_VERSION_MAJOR in CMakeLists.txt
KEYWORDS="~amd64 ~x86"

IUSE="systemd"

DEPEND=">=dev-libs/glib-2.38:2
   >=dev-libs/libmirage-3.2.0:=
   >=media-libs/libao-0.8.0:="
RDEPEND="${DEPEND}
   sys-apps/dbus
   >=sys-fs/vhba-20130607"
BDEPEND="
   dev-util/intltool
   sys-devel/gettext
   virtual/pkgconfig"

DOCS=( AUTHORS README )

src_install() {
   cmake_src_install
   use systemd || eapply "${FILESDIR}/${P}-001-force-openrc.patch"

   insinto /etc/modules-load.d
   newins - vhba.conf <<<"vhba"
   if use systemd ; then
      systemd_douserunit service-example/cdemu-daemon.service
   else
      insinto /etc/udev/rules.d
      newins - 69-vhba.rules <<<"KERNEL==\"vhba_ctl\", MODE=\"0660\", OWNER=\"root\", GROUP=\"cdrom\""
   fi
   insinto /usr/share/dbus-1/services
   doins service-example/net.sf.cdemu.CDEmuDaemon.service

}

pkg_postinst() {
   elog "As of 3.2.5, cdemu-daemon no longer supports autoloading"
   elog "on non-systemd systems.  OpenRC users have to start it manually."
   elog
   elog "We install /etc/modules-load.d/vhba.conf to load the module"
   elog "automatically, and D-BUS autolaunch will start cdemu-daemon user"
   elog "service."
}
Code:
cat /var/db/repos/local-repo/app-cdr/cdemu-daemon/files/cdemu-daemon-3.2.6-001-force-openrc.patch
--- a/service-example/net.sf.cdemu.CDEmuDaemon.service   2021-12-18 14:18:52.000000000 +0300
+++ b/service-example/net.sf.cdemu.CDEmuDaemon.service   2021-12-19 20:13:23.929786814 +0300
@@ -1,4 +1,3 @@
 [D-BUS Service]
 Name=net.sf.cdemu.CDEmuDaemon
-SystemdService=cdemu-daemon.service
-Exec=/bin/true
+Exec=/usr/bin/cdemu-daemon --config-file "%h/.config/cdemu-daemon"
Unfortunately the --config-file option doesn't work... Neither does any harm :wink:
Any idea in this respect is more than welcome.
USE=systemd is there to keep initial install settings, untested though.
First iso mount request works out of the box here.
gcdemu must be used to increase the amount of possible mounts.

Thks 4 ur attention, interest & support.
_________________
USE="-*" in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum