LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-24-2012, 08:17 AM   #1
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Rep: Reputation: Disabled
Scanner permissions


Grr! I thought this one had been fixed years ago, but it seems to be back in 14.....!

Its the usual problem, a USB scanner that can only be seen as root. The sane documentation tells you to install a rules file from the tools/udev directory in the source package - but there is no tools/udev directory in the source package, either in slackware or a freshly downloaded source.

Slackware has its own rules /lib/udev/rules.d/80-libsane.rules that includes a line with the correct ids for my scanner. According to this list, the group permission should be set to lp - of which I am a member - but it remains stubbornly set at root!

However, if I plug the scanner in *after* booting, it all works perfectly!

The last time I came across this was in the bad old days of hotplug, and it took a lot of digging to find the cure! I thought with udev it was all sorted - and indeed it has been until I upgraded to 14!

Please, someone put me out of my misery while I still have some hair left.....!

--
Pete
 
Old 10-24-2012, 04:26 PM   #2
ljb643
Member
 
Registered: Nov 2003
Posts: 269

Rep: Reputation: Disabled
Sorry I can't help with the problem, except to say that it works for me. On Slackware-14 my USB scanner is detected and the group on its device /dev/bus/usb/###/### changed to "lp" correctly , at boot time. (I wanted to go back to using the "scanner" group, though, so I copied the line for my scanner from /lib/udev/rules.d/80-libsane.rules into /etc/udev/rules.d/95-local.rules and changed the group there.)

I think you are going to have to turn up udevd logging to see what rule file is or isn't working. The fact that it happens a boot time only, and not when you replug it, will make it harder.
 
Old 10-25-2012, 01:17 AM   #3
kingbeowulf
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.1, Slackware 14.1
Posts: 519

Rep: Reputation: 137Reputation: 137
AFAIK, if you want to run a scanner (USB, network, etc), you have to be a member of group "scanner"

For ages, I just added my user thusly and, making no other changes, scanning just worked.
 
Old 10-25-2012, 10:27 AM   #4
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: Disabled
Thanks for the replies, guys.

ljb643: Knowing that it works for you tells me that it is something unique to me, which is helpful indirectly. One thing I should have added is that this is a 64-bit system, so it *may* be unique to 64 bit.

kingbeowulf: Yes, the scanner group used to be the case, but its now lp. In any case, I'm a member of both groups, but the device only shows up with root/root permissions.

If I unplug and re-plug it, the permissions get set correctly. It just fails on boot!

--
Pete
 
Old 10-25-2012, 11:32 AM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Quote:
Originally Posted by pchristy View Post
...
kingbeowulf: Yes, the scanner group used to be the case, but its now lp. In any case, I'm a member of both groups, but the device only shows up with root/root permissions.
Afaik the lp and scanner groups are now default for any new user in Slackware.
Quote:
If I unplug and re-plug it, the permissions get set correctly. It just fails on boot!
...
Could you please try the following: instead of unpluging and pluging the device, only restart udev or reload the rules. Reloading the rules is done with
Code:
udevadm control --reload
Markus

Last edited by markush; 10-25-2012 at 11:33 AM. Reason: typo
 
Old 10-25-2012, 06:38 PM   #6
shotswell21
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Rep: Reputation: 6
I had the same problem even as a member of the lp and scanner groups so to get around it id did the following.

As a quick hack you can run lsusb and find the bus and device for the scanner and add a line like this to /etc/rc.d/rc.local

My scanner

shotsy@workstation [ ~/Desktop ]$ lsusb
Bus 001 Device 002: ID 04b8:0131 Seiko Epson Corp. GT-F720 [GT-S620/Perfection V30/V300 Photo]

entry in rc.local

/usr/bin/chmod a+w /dev/bus/usb/001/002

Taaa Daaa :-)
 
Old 10-25-2012, 07:59 PM   #7
ljb643
Member
 
Registered: Nov 2003
Posts: 269

Rep: Reputation: Disabled
Quote:
Originally Posted by shotswell21 View Post
As a quick hack you can run lsusb and find the bus and device for the scanner and add a line like this to /etc/rc.d/rc.local...
I don't think those numbers from lsusb are necessarily stable. Before doing that, I suggest making a local udev rules file that runs very late (/etc/udev/rules.d/99-local.rules for example), with your scanner idVendor and idProduct, and have it set MODE and GROUP.

But I suspect a new rule won't help in this case. I wonder if the scanner is really ready when udevd starts during bootup, and whether it provides the right information about what it is. I can't think why else it would work on re-connection but not at boot. (Boot-up messages from dmesg and /var/log/something should show if the scanner was identified at boot time.)
 
Old 10-26-2012, 01:10 AM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Quote:
Originally Posted by ljb643 View Post
...
But I suspect a new rule won't help in this case. I wonder if the scanner is really ready when udevd starts during bootup, and whether it provides the right information about what it is. I can't think why else it would work on re-connection but not at boot. (Boot-up messages from dmesg and /var/log/something should show if the scanner was identified at boot time.)
This is a good hint. I remember some weeks ago I had a similar problem with a scanner (an older Umax) connected to a Windows-computer. The scanner could not come up from sleeping on it's own, one had at least to press one of the buttons or disconnect/connect the powerplug.

Maybe if the OP has another scanner available and checks if another scanner works properly with udev.

Markus
 
Old 10-26-2012, 04:55 AM   #9
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: Disabled
Shotswell21: Yes, I've already done something similar as a temporary bodge: chgrp lp /dev/bus/usb/002/002 in rc.local

Markush: Thanks for the suggestion about restarting udev rules - I've got to go out soon, but I'll give it a try later today!

Cheers, folks!

--
Pete
 
Old 10-27-2012, 03:34 AM   #10
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: Disabled
OK, I've made some progress here.....

Neither re-loading udev rules, nor forcing a full re-start of udev did any good. My scanner (loaded at /dev/bus/usb/002/002) remained resolutely stuck with root/root permissions.

I therefore wrote a new udev rule 99-epsonscanner.rules containing:

ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="011d", MODE="0660", GROUP="lp", ENV{libsane_matched}="yes"

This line is copied exactly from the 80-libsane.rules

On rebooting, my scanner now had the correct permissions (root/lp).

This indicates to me that 80-libsane.rules is not being read correctly on startup. It does seem to contain a number of different entry points depending on kernel version, and I wonder if this is the cause of the issue. I am running a "home-brew" kernel-3.6.3, but the issue is still there with the standard Slackware huge-3.2.29 kernel. I will investigate further, but thanks for the clues which have put me on the right track!

--
Pete
 
Old 10-27-2012, 03:44 AM   #11
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Quote:
Originally Posted by pchristy View Post
...
This indicates to me that 80-libsane.rules is not being read correctly on startup.
udevrules reside in /lib/udev/rules.d/ and /etc/udev/rules.d/ as well, but the ones in /etc have a higher precedence.

Markus
 
Old 10-27-2012, 04:19 AM   #12
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: Disabled
The only items in /etc/udev/rules.d refer to cd drives and network devices. Everything else is in /lib/udev/rules.d, which is where I've been looking. I did wonder if something else was over-writing the libsane rules after that file had been read, but I can't see anything obvious. And in any case, if that were happening, it should also apply to the new rule I've written, which has an even lower priority!

I've convinced myself that its something to do with the obfuscated entry points in libsane rules, and will be investigating later today.....

--
Pete
 
Old 10-27-2012, 04:26 AM   #13
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
you could append anything "visible" to the udevrule for the scanner. For example I have a rule for my USB-memorysticks:
Code:
SUBSYSTEMS=="usb", KERNEL=="sd?1", ACTION=="add", RUN+="/pathtomyscript/myscript.sh"
only append a similar "RUN+=" to your rule.
And in the script
Code:
username=`who | head -n 1 | cut -d " " -f 1`
export DISPLAY=:0.0 
su $username -c "notify-send 'Udevrule recognized'"
slightly adapted to your needs. If it shows something, the rule is recognized but did not work, if nothing happens the scanner was not recognized.

I know that there may be better solutions for troubleshooting.

Markus
 
Old 10-27-2012, 06:56 AM   #14
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: Disabled
Well, the kernel definitely finds the scanner at boot time:

usb 2-7: new full-speed USB device number 2 using ohci_hcd
usb 2-7: New USB device found, idVendor=04b8, idProduct=011d
usb 2-7: New USB device strings: Mfr=64, Product=77, SerialNumber=0
usb 2-7: Product: EPSO￿￿￿￿￿￿￿￿￿￿￿￿￿￿
usb 2-7: Manufacturer: EPSON

but this doesn't seem to get picked up by the udev rules.

The 80-libsane.rules says:

ACTION!="add", GOTO="libsane_rules_end"
ENV{DEVTYPE}=="usb_device", GOTO="libsane_create_usb_dev"
SUBSYSTEMS=="scsi", GOTO="libsane_scsi_rules_begin"
SUBSYSTEM=="usb_device", GOTO="libsane_usb_rules_begin"
SUBSYSTEM!="usb_device", GOTO="libsane_usb_rules_end"

# Kernel >= 2.6.22 jumps here
LABEL="libsane_create_usb_dev"

# For Linux >= 2.6.22 without CONFIG_USB_DEVICE_CLASS=y
# If the following rule does not exist on your system yet, uncomment it
ENV{DEVTYPE}=="usb_device", MODE="0660", OWNER="root", GROUP="root"

# Kernel < 2.6.22 jumps here
LABEL="libsane_usb_rules_begin"

CONFIG_USB_DEVICE_CLASS is deprecated, and doesn't exist in 3.6.3 (or if it does, I can't find it!), so I've tried both un-commenting and commenting that line (it is commented out as standard) to no effect.

Something seems to be making the rules jump right to the end, and the only thing that looks like it could do that is that first line (ACTION!="add").

But why?

--
Pete
 
Old 10-27-2012, 07:30 AM   #15
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Could you (temporarily) install the stock-Slackware-kernel (3.2.29) and try out if it works?

This line
Code:
usb 2-7: Product: EPSO￿￿￿￿￿￿￿￿￿￿￿￿￿￿
looks odd. Which language are you using?

Markus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scanner root permissions icecubeflower Slackware 15 11-14-2009 04:58 PM
[SOLVED] Need to change permissions for scanner lunardragon Linux - General 1 05-29-2009 09:12 AM
Can't find scanner: need to change permissions Tomermory Debian 4 06-17-2007 10:11 AM
Canon scanner permissions Olle Gladso Mandriva 3 03-01-2006 07:31 PM
Coldplugging scanner permissions? eagle862 Linux - Hardware 2 02-11-2005 01:36 AM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration