You are not logged in.

#1 2012-05-22 13:42:36

tlvince
Member
Registered: 2010-07-06
Posts: 53
Website

gphoto2 USB permission denied

Similarly to this (old) thread, {lib,}gphoto2 refuses to work due to a permission error:

$ gphoto2 --summary 
                                                                               
*** Error ***              
An error occurred in the io-library ('I/O problem'): Could not open USB device (Permission denied).
*** Error (-7: 'I/O problem') ***   

The relevant lines in the debug log:

0.072237 gphoto2-camera(2): Setting port info for port 'Universal Serial Bus' at 'usb:002,006'...
0.078216 gphoto2-port(0): Could not open USB device (Permission denied).
0.078293 context(0): An error occurred in the io-library ('I/O problem'): Could not open USB device (Permission denied).

One workaround is giving world write permissions to that device:

sudo chmod o+w /dev/bus/usb/002/006

... causing gphoto2 to work as expected:

$ gphoto2 --summary
Camera summary:                                                                
Manufacturer: Canon Inc.
Model: Canon EOS 550D
...

The wiki mentions that being part of the camera group is irrelevant.

As per the package file list, udev rules have moved to /usr/lib/udev/rules.d/40-gphoto.rules. Does this need modifying?

Edit: I don't use a desktop environment, instead logging in via the console and starting dwm using xinit. I've tried launching console kit (in conjunction with dwm as per the wiki) to no avail.

Last edited by tlvince (2012-05-22 14:25:49)

Offline

#2 2012-05-23 00:24:21

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

I just updated the wiki a bit. Hope it helps.

Edit: to check if your consolekit sessions are set up correctly check "ck-list-sessions". You should have "active" and "is-local" both be TRUE for you to have access to the device.

Last edited by tomegun (2012-05-23 21:45:40)

Offline

#3 2012-06-23 20:35:35

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

tomegun wrote:

to check if your consolekit sessions are set up correctly check "ck-list-sessions". You should have "active" and "is-local" both be TRUE for you to have access to the device.

$ ck-list-sessions 
Session6:
	unix-user = '1000'
	realname = '(null)'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/tty7'
	display-device = ''
	remote-host-name = ''
	is-local = TRUE
	on-since = '2012-06-23T19:31:03.492852Z'
	login-session-id = '4294967295'

I have a number of digital cameras that are on the official gphoto2 support page but cannot access them unless I invoke the gphoto2 commands as the root user.  My desktop user is indeed in the storage group.

$ gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Fuji FinePix F40fd             usb:001,013
$ gphoto2 --list-files
                                                                               
*** Error ***              
An error occurred in the io-library ('I/O problem'): Could not open USB device (Permission denied).
*** Error (-7: 'I/O problem') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --list-files

Please make sure there is sufficient quoting around the arguments.

But, if I follow tlvince's advice and change the permissions, it works as expected:

Before:

$ ls -l /dev/bus/usb/001/013 
crw-rw-r-- 1 root root 189, 12 Jun 23 16:38 /dev/bus/usb/001/013

After:

# chmod o+w /dev/bus/usb/001/013

$ ls -l /dev/bus/usb/001/013 
crw-rw-rw- 1 root root 189, 12 Jun 23 16:38 /dev/bus/usb/001/013

Last edited by graysky (2012-06-23 20:41:31)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2012-06-23 20:39:08

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

By default you don't need to be in any particular group to make this work. Permission should be granted using ACL's (by consolekit/systemd). Did you read the wiki? https://wiki.archlinux.org/index.php/Gp … ion_issues

Offline

#5 2012-06-23 20:43:47

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

@tomegun - I sure did.  I am running systemd and consolekit.  I also believe that my users recognized -- I edited my post #3 while you wrote your reply, sorry for that.  Please have a look above and thank you for any advice you can offer.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2012-06-23 21:13:44

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

@graysky: only thing i can add is that if you have both CK and systemd running, then the latter will take precedence, so you should make sure that also systemd considers your user to be active: "loginctl session-status <your session id>" will tell you.

Offline

#7 2012-06-23 21:23:14

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

Thanks for the quick reply, tomegun... seems as though systemd does not consider ANY sessions active:

$ loginctl
   SESSION        UID USER             SEAT

hmm


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2012-06-23 21:28:20

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

@graysky: then that explains your problem smile

If you log in on a tty, does it work?

What DE do you use? You need the pam systemd module to be set up correctly. AFAIC KDE and Gnome work fine, but there might be work to do if you use something else.

Essentially you need a pam-session to be set up for you, and you need pam_systemd.so to be in the right file in /etc/pam.d/. I would assume that without an active session a lot of other things would also not work? E.g. sound, graphics....? Though I suppose most things can be worked around by being in the right group.

Offline

#9 2012-06-23 21:35:57

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

@tomegun - I use xfce4 and lxdm to login.

I dropped down to multi-user and entered X.  Now I am reconized by loginctl but both my 'active' and 'is-local' are now set to FALSE... ?

$ sudo systemctl isolate multi-user.target
$ xinit
$ ck-list-sessions 
Session1:
	unix-user = '1000'
	realname = '(null)'
	seat = 'Seat2'
	session-type = ''
	active = FALSE
	x11-display = ':0'
	x11-display-device = '/dev/tty3'
	display-device = '/dev/tty1'
	remote-host-name = ''
	is-local = FALSE
	on-since = '2012-06-23T21:32:29.710295Z'
	login-session-id = '1'

$ loginctl session-status 1
1 -facade (1000)
	   Since: Sat, 23 Jun 2012 17:30:22 -0400; 3min 34s ago
	  Leader: 628 (login)
	    Seat: seat0; vc1
	     TTY: /dev/tty1
	 Service: login; type tty; class user
	  Active: no
	  CGroup: name=systemd:/user/facade/1
		  ├  628 /bin/login --
		  ├  755 -bash
		  ├  991 /usr/bin/pulseaudio --start
		  ├ 1074 /usr/lib/pulse/gconf-helper
		  ├ 1653 xinit
		  ├ 1654 X :0
		  ├ 1659 ck-launch-session startxfce4
		  ├ 1670 /bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
		  ├ 1675 xfce4-session
		  ├ 1678 /usr/bin/dbus-launch --sh-syntax --exit-with-session xfce4-session
		  ├ 1679 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
		  ├ 1681 /usr/lib/xfce4/xfconf/xfconfd
		  ├ 1684 gnome-keyring-daemon --start
		  ├ 1687 xfwm4 --display :0.0 --sm-client-id 25f262281-e3e0-45d3-aacd-83aa74521e4b
		  ├ 1695 Thunar --sm-client-id 249b9a9e8-9464-4d04-829b-0c00d0d0d462 --daemon
		  ├ 1697 /usr/lib/gvfs/gvfsd
		  ├ 1699 /usr/lib/gvfs//gvfs-fuse-daemon -f /run/user/facade/gvfs
		  ├ 1704 xfce4-panel --display :0.0 --sm-client-id 255e6c99e-36fc-4418-9aa4-0f821747e16e
		  ├ 1706 xfsettingsd --display :0.0 --sm-client-id 25440d5a2-b56b-4148-ba5a-d7db28366557
		  ├ 1708 xfdesktop --display :0.0 --sm-client-id 2c46d64a6-7013-414a-95d7-e5a1d0abef5d
		  ├ 1709 /usr/lib/xfce4/panel-plugins/xfce4-mixer-plugin 7 16777247 xfce4-mixer-plugin Mixer Volume control for your sound card
		  ├ 1712 xscreensaver -no-splash
		  ├ 1713 /usr/lib/xfce4/panel/wrapper /usr/lib/xfce4/panel-plugins/libdatetime.so 4 16777248 datetime DateTime Date and Time plu...
		  ├ 1715 /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
		  ├ 1716 /usr/lib/xfce4/panel-plugins/xfce4-cpufreq-plugin 16 16777249 xfce4-cpufreq-plugin CPU Frequency Monitor Shows the cpu ...
		  ├ 1721 /usr/lib/xfce4/panel/wrapper /usr/lib/xfce4/panel/plugins/libcpugraph.so 17 16777250 cpugraph CPU Graph Graphical repre...
		  ├ 1724 bluetooth-applet
		  ├ 1725 /usr/lib/xfce4/panel-plugins/xfce4-netload-plugin 18 16777251 netload Network Monitor Show network traffic
		  ├ 1726 /usr/lib/xfce4/panel/wrapper /usr/lib/xfce4/panel/plugins/libsystray.so 6 16777252 systray Notification Area Area where...
		  ├ 1727 /usr/lib/xfce4/panel/wrapper /usr/lib/xfce4/panel/plugins/libactions.so 8 16777253 actions Action Buttons Log out, lock...
		  ├ 1740 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
		  ├ 1743 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
		  ├ 1745 /usr/lib/gvfs/gvfs-afc-volume-monitor
		  ├ 1748 /usr/lib/gvfs/gvfsd-trash --spawner :1.6 /org/gtk/gvfs/exec_spaw/0
		  ├ 1750 /usr/bin/terminal --geometry 112x32
		  ├ 1751 gnome-pty-helper
		  ├ 1752 bash
		  └ 2273 loginctl session-status 1

Last edited by graysky (2012-06-23 21:36:47)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2012-06-24 00:07:14

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

Hmmm... I guess the problem is that your graphical session does not get its own logind session. The session in the listing you have is the one associated with the tty where you did "xinit". However, you are currently on a new tty where X was started. Hence, the first (and only) session is not active.

It might be worth trying to use gdm/kdm as they should do the right thing and set up a proper session for you.

Offline

#11 2012-06-24 01:13:04

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

@tomegun - Thank you for the suggestion.  It appears as though the problem lies with lxdm unfortunately.  When I login with gdm, the camera is identified just fine without root permissions.  I would like to open a bug with lxdm upstream, but am not totally sure what to say.  Can you help me with the description?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#12 2012-06-24 11:42:34

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

@graysky: without looking at the code, I'm not sure what goes wrong. I'd just file a bug report saying that you don't get a systemd session when logging in with lxdm. You could possibly point to http://www.freedesktop.org/wiki/Softwar … y-managers as a reference to how it should work. I guess the problem should be clear to the lxdm devs.

Offline

#13 2012-06-24 11:43:18

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

Thanks tomegun.  I have also confirmed this behavior under lightdm as well.  It would be a crying shame to have to switch to gdm just for this.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#14 2012-06-24 11:55:32

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

Yeah, it would be awesome if all the dm's supported systemd smile I think the main issue is to make sure the dm's have pam support, then the rest is almost for free smile

Offline

#15 2012-06-24 12:00:04

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: gphoto2 USB permission denied

Bug reports filed:

Lightdm: https://bugs.launchpad.net/lightdm/+bug/1017126
LXDM: https://sourceforge.net/tracker/?func=d … tid=894869

Last edited by graysky (2012-06-24 12:04:57)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#16 2012-08-20 23:14:02

Roken
Member
From: UK
Registered: 2012-01-16
Posts: 731

Re: gphoto2 USB permission denied

Is this solved yet. I have exactly the same setup with lxdm, xfce4 and systemd, and can no longer use gtkam as a user ("Permission denied") though it works as root.

It worked fine pre-systemd.

Last edited by Roken (2012-08-20 23:15:07)


[img=Speedtest]http://www.speedtest.net/my-result/5145583518[/img]

Nvidia GTX 670 2Gb, AMD Phenom II X4 (965BE) @ 3.6 Ghz (Overclocked) 8GB RAM
Linux user #545703

Offline

#17 2012-08-21 02:44:40

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,058

Re: gphoto2 USB permission denied

Read the two bug reports by graysky. He posted the fix there.

Offline

#18 2012-08-21 06:49:04

Roken
Member
From: UK
Registered: 2012-01-16
Posts: 731

Re: gphoto2 USB permission denied

My bad. I'd seen the report and missed the comments. Thank you.


[img=Speedtest]http://www.speedtest.net/my-result/5145583518[/img]

Nvidia GTX 670 2Gb, AMD Phenom II X4 (965BE) @ 3.6 Ghz (Overclocked) 8GB RAM
Linux user #545703

Offline

#19 2012-10-04 10:33:14

4javier
Member
From: Italia
Registered: 2010-12-01
Posts: 89

Re: gphoto2 USB permission denied

Hoping this will not be considered necro-bumping. smile
I have the same original problem. With the difference that I don't use any DM, and let agetty perform the autologin. I have installed both consolekit both systemd, and they say my session is active, because /etc/pam.d/login sources /etc/pam.d/system-local-login, that sources /etc/pam.d/system-login that contains this statement

-session   optional   pam_systemd.so

consolekit

ck-list-sessions 
Session1:
	unix-user = '1000'
	realname = ''
	seat = 'Seat1'
	session-type = ''
	active = FALSE
	x11-display = ''
	x11-display-device = ''
	display-device = '/dev/tty1'
	remote-host-name = ''
	is-local = TRUE
	on-since = '2012-10-04T10:07:02.291602Z'
	login-session-id = '1'
	idle-since-hint = '2012-10-04T10:07:32.761442Z'
Session2:
	unix-user = '1000'
	realname = ''
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/tty2'
	display-device = '/dev/tty1'
	remote-host-name = ''
	is-local = TRUE
	on-since = '2012-10-04T10:07:11.102483Z'
	login-session-id = '1'

systemd

loginctl 
   SESSION        UID USER             SEAT            
         1       1000 javier           seat0           

1 sessions listed.


loginctl session-status 1
1 - javier (1000)
	   Since: Thu, 04 Oct 2012 12:07:02 +0200; 18min ago
	  Leader: 297 (login)
	    Seat: seat0; vc1
	     TTY: tty1
	 Service: login; type tty; class user
	   State: online
	  CGroup: name=systemd:/user/javier/1
		  ├  297 login -- javier
		  ├  376 -bash
		  ├  392 /bin/sh /usr/bin/startx
		  ├  416 xinit /home/javier/.xinitrc -- /etc/X11/xinit/xser...
		  ├  417 /usr/bin/X -nolisten tcp :0 -auth /tmp/serverauth....
		  ├  496 /bin/sh /home/javier/.xinitrc
		  ├  500 ck-launch-session dbus-launch openbox-session
		  ├  521 /usr/bin/openbox --startup /usr/lib/openbox/openbo...
		  ├  549 /usr/bin/dbus-daemon --fork --print-pid 5 --print-...
		  ├  573 cairo-compmgr
		  ├  574 cairo-dock -o
		  ├  576 tint2
		  ├  578 thunar --daemon
		  ├  579 roxterm --separate --profile=Desktop --role=rwterm...
		  ├  584 /usr/lib/polkit-gnome/polkit-gnome-authentication-...
		  ├  585 /usr/bin/python2 -O /usr/share/wicd/gtk/wicd-clien...
		  ├  586 conky -c /home/javier/conky/graph.conf
		  ├  587 conky -c /home/javier/conky/base.conf
		  ├  601 /usr/lib/gvfs/gvfsd
		  ├  603 /usr/lib/gvfs//gvfs-fuse-daemon -f /run/user/1000/...
		  ├  634 /usr/lib/gvfs/gvfsd-trash --spawner :1.5 /org/gtk/...
		  ├  635 gnome-pty-helper
		  ├  636 /bin/bash
		  ├  652 /usr/lib/notify-osd-customizable/notify-osd
		  ├  657 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
		  ├  668 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
		  ├  691 su
		  ├  692 bash
		  ├  716 firefox
		  ├  877 /usr/lib/firefox/plugin-container /usr/lib/mozilla...
		  ├ 1350 /usr/lib/xfce4/xfconf/xfconfd
		  ├ 1429 /bin/bash
		  ├ 1704 /bin/bash
		  └ 1711 loginctl session-status 1

Despite that, I obtain permission problem with gphoto2, this is the interesting part

0.242769 gphoto2-port(2): Opening USB port...
0.242786 libusb(2): gp_port_usb_open()
0.242813 gphoto2-port(0): Could not open USB device (Permission denied).
0.242852 context(0): An error occurred in the io-library ('I/O problem'): Could not open USB device (Permission denied).

*** Error ***              
An error occurred in the io-library ('I/O problem'): Could not open USB device (Permission denied).
*** Error (-7: 'I/O problem') ***       

0.243248 gp-camera(2): Freeing camera...
0.243264 gphoto2-port(2): Freeing port...
0.243278 gphoto2-port(2): Closing port...
0.243320 gphoto2-filesystem(2): resetting filesystem
0.243335 libgphoto2/gphoto2-filesys.c(2): Clearing fscache LRU list...
0.243348 libgphoto2/gphoto2-filesys.c(2): fscache LRU list already empty
0.243361 gphoto2-filesystem(2): Internally deleting all folders from '/'...
0.243374 gphoto2-filesystem(2): Lookup folder '/'...
0.243387 gphoto2-filesystem(2): Found! / is 0x968f148
0.243402 gphoto2-filesystem(2): Recurse delete folder 0x968f148//

As root user everything works.
Sorry for long post.

Offline

#20 2012-10-04 10:59:07

4javier
Member
From: Italia
Registered: 2010-12-01
Posts: 89

Re: gphoto2 USB permission denied

Ok, I found the problem. I thought state "online" was the same as "active", but it's not. An "online" session is considered not "active". Anybody knows how to solve?

Offline

#21 2012-10-04 11:02:04

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: gphoto2 USB permission denied

4javier wrote:

Ok, I found the problem. I thought state "online" was the same as "active", but it's not. An "online" session is considered not "active". Anybody knows how to solve?

If you are booting with systemd and not using a DE, then this is not really ideally implemented at the moment. In order to get it to work, you can follow Dave's advice here: http://blog.falconindy.com/articles/bac … stemd.html.

Offline

#22 2012-10-04 11:22:34

4javier
Member
From: Italia
Registered: 2010-12-01
Posts: 89

Re: gphoto2 USB permission denied

Perfect, launching Xserver on the same tty where I log into fixed everything. Thanks a lot. smile

Offline

Board footer

Powered by FluxBB