The file /etc/hotplug/usb/usbcam which libgphoto2 installs is responsible to set correct permissions on the USB camera device, however, this only works if the system is using PAM (USE=PAM). If this is not the case, the permissions are not set correctly. I solved the problem by using an example usbcam file from the gphoto documentation: #!/bin/bash # $Id: usbcam.group,v 1.3 2003/09/16 16:42:44 hun Exp $ # # /etc/hotplug/usb/usbcam # # Sets up newly plugged in USB camera so that only members of the # group GROUP=usb # can access it from user space. (Replace camera with the name of the # group you want to have access to the cameras.) # # Note that for this script to work, you'll need all of the following: # a) a line in the file /etc/hotplug/usermap that corresponds to the # camera you are using. You can get the correct lines for all cameras # supported by libgphoto2 by running "print-usb-usermap". # b) a group "camera" where all users allowed access to the # camera are listed # c) a Linux kernel supporting hotplug and usbdevfs # d) the hotplug package (http://linux-hotplug.sourceforge.net/) # # In the usermap file, the first field "usb module" should be named # "usbcam" like this script. # if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then chmod o-rwx "${DEVICE}" chgrp "${GROUP}" "${DEVICE}" chmod g+rw "${DEVICE}" fi Maybe this should be changed in the ebuild? Reproducible: Always Steps to Reproduce: 1.Use a system without PAM support 2.Install libgphoto2 3.Plugin camera
Additionnaly, with PAM-0.78-r2 and pam_console in USE, the script usbcam in /etc/hotplug/usb don't look at the right place for console.lock. the script look for /var/{run,lock}/console.lock but it is in /var/run/console/console.lock The fixe is easy and work well, just changing the path in the file !
I believe I suffer the same malady. Only I don't have anything in my /var/run/console/ dir.
Of course I have -pam_console in USE. :p Anyway the script in portage is fubar.
Yes the user-provided script works great. Is this what we used to do? Just wondering when it stopped working.
Obviously using pam_console to set the permissions is not a good idea, as udev should be in charge of setting device permissions. pam_console is really bad because not everyone is using it. Now, IMO the example brought here is also not optimal because again the permissions are set by hotplug instead of udev. And especially now that udev is the default in gentoo ...
don't quite follow what is needed. does this mean we need a udev rule for cameras in libgphoto2?
I am having the same problem after upgrading to the latest stable pam: gphoto2 won't set the right permissions any more. What's especially strange is the following comment in the current script: # b) a setup using pam_console creates the respective lock files # containing the name of the respective user. You can check for that # by executing "echo `cat /var/{run,lock}/console.lock`" and # verifying the appropriate user is mentioned somewhere there. I don't have these files...
"Obviously using pam_console to set the permissions is not a good idea, as udev should be in charge of setting device permissions. pam_console is really bad because not everyone is using it." Is this accurate here? USB devices have their permissions set on not on their dev node, but rather their entry in usbfs. From what I understand, udev maintains /dev, not USB file systems nodes. I do find it weird that gentoo installs libgphoto's usbcam.console version instead of the .group. Why would/should the console user be required to use the camera. Plus combine that with the confusion of pam_console being disabled by default it's kinda odd.
I would agree that this is definitly frustrating. media-libs/libgphoto2 and media-gfx/gphoto2 have absolutely no dependencies on PAM, but the default script put in /etc/hotplub/usb/usbcam requires pam... While the above given script may not be perfect, it at least works for those of us who do not use PAM... Maybe the ebuild should have a pam use flag to allow people to choose?
Maybe that's a good solution. Use the same pam_console USE flag. If it's set, do what's currently done (copy usbcam.console). If it's not set, use usbcam.group. This would require that a camera group be added and user's be added to that group to get permissions to access it, but it's consistent with how gentoo handles usb scanners.
*** Bug 99736 has been marked as a duplicate of this bug. ***
I'm trying out a small modification of the ebuild to add a pam_console USE flag. So far things seem to emerge fine using usbcam.console with +pam_console and usbcam.group otherwise. I looked at the sane-backends ebuild to see how they added the "scanner" group, so I made this ebuild add a "camera" group. I'll try things out with my Canon PowerShot tomorrow (batteries charging) and if it works I'll post the ebuild here. There are a number of questions I'm wondering right now (though it's quite late): - Are there any Gentoo policies regarding creating new groups, should someone be contacted/notified about this ? - Should the group be created even if a user activates pam_console, in which case the "camera" group is irrelevant ? (<= my biggest concern right now :) - I saw that the pam_console flag was only present in /usr/portage/profiles/use.local.desc and so far only pam uses this flag. Again can this flag be used without upsetting anyone or causing mayhem about Gentoo policies I may not be aware of ? - Should I add PAM as a dep if pam_console is activated ? - ... R
I'm trying out a small modification of the ebuild to add a pam_console USE flag. So far things seem to emerge fine using usbcam.console with +pam_console and usbcam.group otherwise. I looked at the sane-backends ebuild to see how they added the "scanner" group, so I made this ebuild add a "camera" group. I'll try things out with my Canon PowerShot tomorrow (batteries charging) and if it works I'll post the ebuild here. There are a number of questions I'm wondering right now (though it's quite late): - Are there any Gentoo policies regarding creating new groups, should someone be contacted/notified about this ? - Should the group be created even if a user activates pam_console, in which case the "camera" group is irrelevant ? (<= my biggest concern right now :) - I saw that the pam_console flag was only present in /usr/portage/profiles/use.local.desc and so far only pam uses this flag. Again can this flag be used without upsetting anyone or causing mayhem about Gentoo policies I may not be aware of ? - Should I add PAM as a dep if pam_console is activated ? - ... Rémi
Created attachment 65650 [details] ebuild with pam_console USE flag This ebuild works for me, it creates the "camera" group and gtkam works right out.
Created attachment 65651 [details, diff] patch for libgphoto2-2.1.5.ebuild diff instead of whole ebuild ... my bad
it's been a month ... anyone to take a look and possibly comment ?
It works like a charm for me :-) I changed your ebuild to use libgphoto2-2.1.6 as currently in portage. Your ebuild should definately go into portage.
Created attachment 68393 [details] based on the latest ebuild, but for version 2.1.6
This ebuild works nicely here. Certainly a much more elegant solution than the pam_console mess. Also more consistant with how the system handles other libusb devices.
what about proposing this ebuild through gentopia's overlay ? kinda fits their goals. I'm ready to keep working on this if necessary but it'd be nice to have some gentoo dev taking note of what's going on here. Is there anyway of poking them (friendly) with a stick ?
shoot this stuff to me in an email (steev@gentoo.org) and ill take a look at it tomorrow night after work (i only get an average of 2 hours online per day now) and ill look at it when I get offline and get it going against my digicam and add it to the overlay
Created attachment 70022 [details, diff] patch for libgphoto2-2.1.6.ebuild AllanonJL recommended to remove the pam_console flag altogether and default to the group hotplug script. Patch made against the latest 2.1.6 ebuild.
in CVS. Thanks!