LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
LinkBack Search this Thread
Old 04-23-2009, 01:38 AM   #1
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Rep: Reputation: 45
only can scan as root: usb scanner & ubuntu 8.10


Hi,

I have seen many similar complaints around on the web but no suggestion which actually works.

I have ubuntu 8.10 amd64 2.6.27-11 kernel, xsane & friends installed. Everything works perfectly when I scan as root. Scanner is detected as non-root as well:

Code:
siim@Shiva:~$ sane-find-scanner 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04a9, product=0x2213, chip=GL841?) at libusb:002:010
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.
but scanimage does not work:

Code:
siim@Shiva:~$ scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
when i strace the process, I see a lot of messages like:

Code:
open("/dev/bus/usb", O_RDONLY|O_NONBLOCK|O_DIRECTORY|0x80000) = 4
open("/dev/bus/usb/002", O_RDONLY|O_NONBLOCK|O_DIRECTORY|0x80000) = 4
open("/dev/bus/usb/002/010", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/010", O_RDONLY)  = 6
open("/dev/bus/usb/002/006", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/006", O_RDONLY)  = 6
open("/dev/bus/usb/002/001", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/001", O_RDONLY)  = 6
open("/dev/bus/usb/002/010", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/010", O_RDONLY)  = 4
open("/dev/bus/usb/002/006", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/006", O_RDONLY)  = 4
open("/dev/bus/usb/002/001", O_RDWR)    = -1 EACCES (Permission denied)
open("/dev/bus/usb/002/001", O_RDONLY)  = 4
ie I have read-only access to usb, usb belongs to root:

Code:
siim@Shiva:~$ ll /dev/bus/usb/002/
kokku 0
crw-rw-r-- 1 root root 189, 128 2009-04-20 08:44 001
crw-rw-r-- 1 root root 189, 133 2009-04-20 08:44 006
crw-rw-r-- 1 root root 189, 137 2009-04-23 09:26 010
I am member of the scanner group if this means anything. I am user #2 (id 1001) on this computer.

lsusb:
Code:
Bus 002 Device 010: ID 04a9:2213 Canon, Inc. CanoScan LiDE 50/LiDE 35/LiDE 40
Ideas?
 
Old 04-23-2009, 04:06 AM   #2
Lee_Ball
Member
 
Registered: Jul 2005
Location: Manchester (UK)
Distribution: Fedora CentOS
Posts: 132

Rep: Reputation: 18
There is a letter about something very similar in this months Linux Format. My copy is at home at the moment, I can post their reply tonight though.
 
Old 04-29-2009, 04:26 PM   #3
Lee_Ball
Member
 
Registered: Jul 2005
Location: Manchester (UK)
Distribution: Fedora CentOS
Posts: 132

Rep: Reputation: 18
Here is the letter from Linux Format May 2009 Issue 118:

"It sounds like your scanner device is being created with unsuitable permissions A simple test is to run these two commands, both as root and a normal user.

sane-find-scanner -q
scanimage -L

The first should discover the scanner no matter who runs it, whereas the second can only access the scanner if it has permission. If this one fails as your user, you definatly have a permission problem.
With USB scanners, the device name varies each time you connect it, so you cannot simply run a chown or chmod command from your startup scripts. You'll have to get dirty with udev, but its not really that hard. First you need to identify your scanner - you can do this with dmesg, which will include something like this:

usb 2-1: New USB device found,
idVendor=04a9, idProduct=221c
usb 2-1: New USB device strings: Mfr=1,
Product=2, SerialNumber=0
usb 2-1: Product: CanoScan
usb 2-1: Manufacturer: Canon

Or you can use lsusb

Bus 002 Device 002: ID 04a9:221c Canon, Inc.
CanoScan LiDE 60

Or the tool that comes with Sane

sane-find-scanner -q

All of these will give you the vendor and product codes of the scanner. These examples are with a Canon scanner, so you should expect to get different values with your HP. Now you create a udev rule in /etc/udev/rules.d/10-scanner.rules

The name must end in .rules and the leading 10 ensures its processed before default rules. Substitute your own numbers in here:

ATTR{idVendor}=="04a9",
ATTR{idProduct}=="221c",
GROUP:="scanner", Mode:="660"

This makes the scanner device node readable and writeable by members of the scanner group. You then need to create the group and add yourself to it, as root, with:

groupadd -r scanner
gpasswd -a YOUR_USERNAME scanner

Alternatively, if you're the only user of the computer, put your own group name in the udev rule instead of scanner. Udev will pick up the changes immediatly; you only need to reconnect or power-cycle your scanner. If you made group changes you will need to logout and back in."


Hope that helps, that was a lot of typing, many thanks to Linux Format, if it works, why not buy their next issue
 
Old 05-06-2009, 04:42 AM   #4
Lee_Ball
Member
 
Registered: Jul 2005
Location: Manchester (UK)
Distribution: Fedora CentOS
Posts: 132

Rep: Reputation: 18
What a miserable bugger, don't expect me to copy that amount of data for you again.
 
Old 05-06-2009, 12:07 PM   #5
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Quote:
don't expect me to copy that amount of data for you again.
We all (and I certainly include myself!) have our off-days

Copying all of that stuff was thoughtful of you, but if you click otoomet's link at left and "Search for more posts by otoomet", you'll see he hasn't been back to LQ since his OP to this thread.

It's possible he is busy with that annoying thing called "real life"

So, don't be too dispirited, I'm sure he'll be back to say "thanks" sometime.
 
Old 09-02-2009, 11:37 AM   #6
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Original Poster
Rep: Reputation: 45
Oh, man, it works!! Thanks!!

There were left a few annoying messages like 'cannot create file' or like that, probably related to stuff in ~/.sane/xsane/ belonging to root. I removed those but did not test later.

And sorry for the long delay, I was working elsewhere, were on holiday, and cannot test the scanner.

Best,
Ott
 
Old 09-04-2009, 03:24 AM   #7
Lee_Ball
Member
 
Registered: Jul 2005
Location: Manchester (UK)
Distribution: Fedora CentOS
Posts: 132

Rep: Reputation: 18
Don't worry, I think my fingers were still sore after the typing

Glad it worked though, was worthwhile. Apologies for the moodyness, my gf would vouch for that.
 
Old 10-22-2009, 03:36 AM   #8
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Original Poster
Rep: Reputation: 45
Hmm...

seems like there is a bit more than that. After a reboot I started to get weird errors, related to wrong device permissions (e.g. /dev/null was owned by scanner and not allowed to write to for the world). So I modified the rules

Code:
# scanners

ACTION!="add", GOTO="iscan_rules_end"
SUBSYSTEM!="usb_device", GOTO="iscan_rules_end"

ATTR{idVendor}=="04a9",
ATTR{idProduct}=="2213",
GROUP:="scanner", Mode:="660"

LABEL="iscan_rules_end"
I also renamed it to '50-scanner.rules' instead of '10-scanner.rules'.

Seems like the device ownership is OK now, but I still cannot log on via nx... We'll see.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Scanner Runs Root Only liakos Slackware 1 01-21-2009 09:14 AM
Hp all in one printer/scanner Will not scan - Ubuntu - Edgy. maxvonseibold Linux - Hardware 2 03-22-2007 08:34 AM
two usb issues, digital camera only as root and scanner module not found nedwardss Debian 2 10-20-2004 06:23 AM
Usb Modem & Scanner Not Detected By Mandrake 9.1 Sincou Linux - Hardware 0 11-15-2003 05:39 AM
USB Printer & Scanner, need help Viper Slackware 5 05-20-2003 09:37 PM


All times are GMT -5. The time now is 09:42 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