Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] xsane only works as root
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
cfloeter
n00b
n00b


Joined: 29 Jul 2005
Posts: 12
Location: Germany

PostPosted: Fri Jan 06, 2006 12:33 pm    Post subject: [SOLVED] xsane only works as root Reply with quote

I admit this is an old one, the forums are full with it. :roll: I've read through many of them, consulted FAQs, HOWTOs and webpages, but still no success.... scanimage -L (and thus xsane or kooka) will only find my scanner as root, not as user.

My user is in the usb and scanner groups, and permissions in /proc/bus/usb/xxx/yyy are set correctly:

Quote:
cf@sakura ~ $ groups
wheel uucp audio cdrom games cdrw usb users portage qemu scanner

Quote:
cf@sakura ~ $ sane-find-scanner -q
found USB scanner (vendor=0x04a9 [Canon], product=0x2220 [CanoScan], chip=LM9832/3) at libusb:004:002

Quote:
cf@sakura ~ $ ls -l /proc/bus/usb/004
total 0
-rw-rw-r-- 1 root usb 43 6. Jan 12:58 001
-rw-rw---- 1 root scanner 57 6. Jan 12:58 002


But still, as user, scanimage -L gives me:
Quote:
cf@sakura ~ $ 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).

Whereas as root, it gives:
Quote:
sakura cf # scanimage -L
device `plustek:libusb:004:002' is a Canon LiDE25 USB flatbed scanner


My specs: kernel 2.6.15-rc7 vanilla, libusb 0.1.10a, udev 079. 'usb' and 'scanner' are set in my USE flags.

So WTF is going on?? Why is it still not recognizing my scanner as user? :cry:


Last edited by cfloeter on Tue Jan 10, 2006 11:16 am; edited 1 time in total
Back to top
View user's profile Send private message
Drunkula
Apprentice
Apprentice


Joined: 28 Jul 2003
Posts: 257
Location: Denton, TX - USA

PostPosted: Fri Jan 06, 2006 1:07 pm    Post subject: Reply with quote

Though I have a SCSI scanner I had the same problem. I found the answer here.
https://forums.gentoo.org/viewtopic-t-367857-highlight-scsi+scanner.html

However, take note, though the solution directly addresses SCSI you'll have to modify a command or two to work on a USB scanner.
_________________
Go away or I will replace you with a very small shell script.
Back to top
View user's profile Send private message
cfloeter
n00b
n00b


Joined: 29 Jul 2005
Posts: 12
Location: Germany

PostPosted: Fri Jan 06, 2006 1:55 pm    Post subject: Reply with quote

Is the creation of /dev/scanner necessary to solve the problem? Having a USB scanner using libusb, I don't know where I should link it to...
Back to top
View user's profile Send private message
Drunkula
Apprentice
Apprentice


Joined: 28 Jul 2003
Posts: 257
Location: Denton, TX - USA

PostPosted: Fri Jan 06, 2006 5:55 pm    Post subject: Reply with quote

cfloeter wrote:
Is the creation of /dev/scanner necessary to solve the problem? Having a USB scanner using libusb, I don't know where I should link it to...


I don't believe so - however the correct permissions get assigned to it (/dev/scanner). When I did that xsane found my scanner as a regular user. I haven't yet taken the time to learn the ins & outs of using udev. ;)
_________________
Go away or I will replace you with a very small shell script.
Back to top
View user's profile Send private message
cfloeter
n00b
n00b


Joined: 29 Jul 2005
Posts: 12
Location: Germany

PostPosted: Sat Jan 07, 2006 1:41 pm    Post subject: Reply with quote

Well, the sane-plustek manpage tells something about /dev/usbscanner, so I manually created it and linked it to /proc/bus/usb/xxx/yyy, just to see what would happen. But scanimage still don't find my scanner. I'm at my wits' end.

Ok, I can use my scanner as root. Probably many users do the same. However, I'm feeling like Gentoo has left me alone for the first time. Are other Canon LiDE owners experiencing the same problem, or did everyone manage to set it up and work as it should??

Btw..... "Scanner Access Now Easy" ??? 8O

Yeah, sure.
I'll laugh when I have time. :wink:
Back to top
View user's profile Send private message
Drunkula
Apprentice
Apprentice


Joined: 28 Jul 2003
Posts: 257
Location: Denton, TX - USA

PostPosted: Mon Jan 09, 2006 7:34 pm    Post subject: Reply with quote

I don't believe you should have linked it to something in /proc/usb.... Instead you should be linking to something like /dev/usb/scanner0. I don't know what a USB scanner would appear as in /dev. Just a guess but I think even some USB scanners use the SCSI Generic module (modprobe sg) so it should show up as /dev/sg[0-9]. Try modprobing sg (assuming it's built as a module) and check in /var/log/messages to see if it mentions the device name.

Have you checked http://www.linux-usb.org/USB-guide/book1.html ?
_________________
Go away or I will replace you with a very small shell script.
Back to top
View user's profile Send private message
cfloeter
n00b
n00b


Joined: 29 Jul 2005
Posts: 12
Location: Germany

PostPosted: Tue Jan 10, 2006 11:15 am    Post subject: [SOLVED] xsane only works as root Reply with quote

With the help of the newsgroups, I was able to resolve the problem.

The plustek driver needs a lock directory named /var/lib/lock/sane, and the permissions of /var/lib/lock had to be set to 775. After that, my scanner was correctly found as user. If the ebuild had done this in the first place, it would have saved me a lot of hassle... :P

Anyway, thanks for your answers Drunkula, I appreciate it.

FYI, the scanner is found with libusb - a special device node in /dev isn't needed.

C.
Back to top
View user's profile Send private message
My_World
Guru
Guru


Joined: 01 Sep 2003
Posts: 339
Location: Kalahari Desert

PostPosted: Wed Jan 11, 2006 8:44 pm    Post subject: Reply with quote

From the SANE F.A.Q page:
Quote:

9.2. How can I use a USB scanner with Linux 2.6?

With Linux 2.4.* you could either use the kernel scanner module or libusb to access USB scanners. In Linux 2.6.4 the kernel scanner module was removed. Therefore with this and later kernels libusb must be used. While SANE automatically uses libusb when the library and its header file were present during the build of sane-backends, setting permissions will require some attention.

The device files used by libusb are located in /proc/bus/usb/ (e.g. /proc/bus/usb/001/003). The exact file name can be found out by running sane-find-scanner which would print "libusb:001:003" in this case. While setting permissions with e.g. "chmod a+rw /proc/bus/usb/001/003" seems to work, this change is not permanent. The permissions will be reset when the scanner is replugged or Linux is rebooted.

One solution to set permissions on-the-fly are the Linux hot-plug tools that should come with any current distribution. SANE itsself comes with a hotplug script and related documentation in the tools/hotplug/ directory. Please refer to the README in that directory for the details.


Hmm, so it seems like the USB scanner thingy is not so easy as they would like us to think...

Anyway, I have the same problem as above mentioned, only his solution did not work for me, so lemme see if I can figure out how to configure this SANE hotplug to work...
:(
_________________
"Ubuntu" - an African word meaning "Gentoo is too hard for me".
Back to top
View user's profile Send private message
cfloeter
n00b
n00b


Joined: 29 Jul 2005
Posts: 12
Location: Germany

PostPosted: Thu Jan 12, 2006 10:43 am    Post subject: Reply with quote

My_World wrote:
Hmm, so it seems like the USB scanner thingy is not so easy as they would like us to think...

Anyway, I have the same problem as above mentioned, only his solution did not work for me, so lemme see if I can figure out how to configure this SANE hotplug to work...
:(


-Start with http://gentoo-wiki.com/HOWTO_Install_a_USB_scanner
-Make sure your user is in the usb and scanner groups
-Make sure your USE flags contain usb and scanner as well (if they didn't, set them and re-emerge xsane, sane-backends, sane-frontends (and probably libusb and udev as well)
-If your scanner doesn't seem to be supported by the stable versions of sane-backends, emerge the latest unstable version
-When using the plustek driver, make sure the permissions of the lock directory are correctly set:
Quote:
# mkdir /var/lib/lock
# chmod 775 /var/lib/lock
# mkdir /var/lib/lock/sane
# chmod 770 /var/lib/lock/sane
# chown root:scanner /var/lib/lock/sane
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1616
Location: USA

PostPosted: Sat May 27, 2006 4:57 am    Post subject: Reply with quote

I'm having same problem, none of these solutions fixed it for me
Back to top
View user's profile Send private message
razer
l33t
l33t


Joined: 08 Oct 2004
Posts: 893
Location: Paris - France

PostPosted: Thu Jul 20, 2006 1:29 pm    Post subject: Reply with quote

-=GGW=- $ol!d $n4>|e wrote:
I'm having same problem, none of these solutions fixed it for me


Same thing here, that's unbelievable
What answer can we give when Windows users tell you "Linux is too complex and not user friendly"
I'm using Linux since 10 years, and I can't use my scanner as normal user, even with 3 hours of searching...

/EDIT :
Fix the problem after a search on bugzilla : https://bugs.gentoo.org/show_bug.cgi?id=131756
Seems to be an libusb related bug
Quote:
Changing perms on /dev/bus/usb/appropriate/file allows non-root access again.
Don't have a pretty, general solution.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Jul 20, 2006 2:06 pm    Post subject: Reply with quote

Well, for a Canon Lide 30, I have in /etc/udev/rules.d/91-local.rules
Code:
BUS=="usb", SYSFS{product}=="CanoScan", GROUP="scanner", MODE="0660"

"91" means that this rule takes precedence over other udev rules in lower-numbered filenames.
Back to top
View user's profile Send private message
razer
l33t
l33t


Joined: 08 Oct 2004
Posts: 893
Location: Paris - France

PostPosted: Thu Jul 20, 2006 6:19 pm    Post subject: Reply with quote

PaulBredbury wrote:
Well, for a Canon Lide 30, I have in /etc/udev/rules.d/91-local.rules
Code:
BUS=="usb", SYSFS{product}=="CanoScan", GROUP="scanner", MODE="0660"

"91" means that this rule takes precedence over other udev rules in lower-numbered filenames.


Tried it doesn't work for me, udev sucks :(
Back to top
View user's profile Send private message
midget
n00b
n00b


Joined: 28 May 2005
Posts: 33

PostPosted: Thu Aug 31, 2006 9:08 pm    Post subject: Reply with quote

This is nuts 8O I must've tried people's suggestions from a squillion forum threads by now and I still can't solve it. DOH!
_________________
Now look here... Jo-LENE! I have an army to raise and I must get to Managua at once! I require a window seat and an in-flight Happy Meal. BUT NO PICKLES! OH, GOD HELP YOU IF I FIND PICKLES!
Back to top
View user's profile Send private message
Headrush
Watchman
Watchman


Joined: 06 Nov 2003
Posts: 5597
Location: Bizarro World

PostPosted: Sun Sep 03, 2006 1:48 am    Post subject: Reply with quote

PaulBredbury wrote:
Well, for a Canon Lide 30, I have in /etc/udev/rules.d/91-local.rules
Code:
BUS=="usb", SYSFS{product}=="CanoScan", GROUP="scanner", MODE="0660"

"91" means that this rule takes precedence over other udev rules in lower-numbered filenames.

I thought the first rule to match was used so "91" would NOT take precedence.
Back to top
View user's profile Send private message
alex
n00b
n00b


Joined: 20 Jun 2002
Posts: 36
Location: Netherlands

PostPosted: Wed Dec 27, 2006 12:32 pm    Post subject: Reply with quote

How can this thread be set to SOLVED, while there isn't a working solution and there are still so many users out there having the same problem? :(
Back to top
View user's profile Send private message
snorri_dj
n00b
n00b


Joined: 17 Nov 2004
Posts: 72
Location: Australia

PostPosted: Sun Jan 28, 2007 12:13 pm    Post subject: Reply with quote

The udev rule also worked for me. I put my local udev rules in /etc/udev/rules.d/10-locale.rules.

I also modified the udev rule a bit so a symlink is made

Code:
BUS="usb", SYSFS{product}="CanoScan", GROUP="scanner", MODE="0660", SYMLINK="scanner"


That will symlink /dev/scanner to /dev/bus/usb/<bus#>/<dev#> that corresponds to my CanoScan scanner. You could also identify it with idProduct numbers or idVendor numbers (obtain from lsusb) if you liked. Also, dev/scanner has root:scanner permissions, so as long as your user is in the scanner group, xsane will fire up no problem.[/code]
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Jan 28, 2007 12:27 pm    Post subject: Reply with quote

Headrush wrote:
I thought the first rule to match was used

True with NAME, but not true with MODE and GROUP I think. man udev explains about NAME.

Quote:
BUS=..., SYSFS{product}=...

That's wrong, in recent versions of udev - comparisons must be made with == rather than =.
Back to top
View user's profile Send private message
Erdie
Advocate
Advocate


Joined: 20 May 2004
Posts: 2656
Location: Heidelberg - Germany

PostPosted: Sat Feb 17, 2007 5:27 pm    Post subject: Reply with quote

My Medion USB Scanner worked fine but now, after upgrading udev to 104, i have the same problem. Only root has access although i have written a udev rule which worked before.

I i do
chmod a+rw /proc/bus/usb/xxx/xxx"

on the device which is shown by sane-find-scanner it works until the scanner is unplugged.

:evil:

-Erdie
_________________
Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sat Feb 17, 2007 6:00 pm    Post subject: Reply with quote

Erdie wrote:
udev rule which worked before.

Well, show it then. I bet it had "=" instead of "==".
Back to top
View user's profile Send private message
Erdie
Advocate
Advocate


Joined: 20 May 2004
Posts: 2656
Location: Heidelberg - Germany

PostPosted: Sat Feb 17, 2007 8:02 pm    Post subject: Reply with quote

I don´t think so, udev creates a device called /dev/scanner as it is supposed to but the permission on /proc/usb/... like described above prevent a normal user from using the device even the user is in the scanner group and the scanner device has read permission to this group. My udev rules are:
Code:

#digicam
BUS=="scsi", KERNEL=="sd?1", SYSFS{vendor}=="FUJIFILM", NAME="f700"
#Trekstore 40 Gig
BUS=="scsi", KERNEL=="sd?1", SYSFS{vendor}=="SAMSUNG ", NAME="trekstor40"
#Gmini 402
BUS=="scsi", KERNEL=="sd?1", SYSFS{model}=="Gmini402", NAME="gmini402"
#Trekstore Musikstick
BUS=="scsi", KERNEL=="sd?1", SYSFS{model}=="150 MusicStick  ", NAME="mp3stick"
#Medion Scanner
BUS=="usb", SYSFS{idVendor}=="05d8", NAME="%k", SYMLINK="scanner", GROUP="scanner", MODE="0660



I already adjusted the "=" to "==" without success. With "=" before nothing worked - even the device for the digicam and so on ..

-Erdie
_________________
Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Feb 18, 2007 11:13 am    Post subject: Reply with quote

Erdie wrote:
MODE="0660

The final quote is missing there.

Could be fixed with:

/etc/udev/rules.d/91-local.rules (make sure it's 91, so this rule overrides the standard udev rules for GROUP & MODE)

Code:
BUS=="usb", SYSFS{idVendor}=="05d8", ACTION=="add", NAME="%k", SYMLINK+="scanner", GROUP="scanner", MODE="0660", RUN+="/bin/chmod blah blah"

I've included NAME in this rule, although we don't care whether it's overruled by the standard udev rules, because it's the SYMLINK that is important.
Back to top
View user's profile Send private message
Erdie
Advocate
Advocate


Joined: 20 May 2004
Posts: 2656
Location: Heidelberg - Germany

PostPosted: Sun Feb 18, 2007 5:18 pm    Post subject: Reply with quote

... the missing final quote was an cut & past error. The quote exists.

Quote:

Code:
BUS=="usb", SYSFS{idVendor}=="05d8", ACTION=="add", NAME="%k", SYMLINK+="scanner", GROUP="scanner", MODE="0660", RUN+="/bin/chmod blah blah"

I've included NAME in this rule, although we don't care whether it's overruled by the standard udev rules, because it's the SYMLINK that is important.


Sorry for my stupid question: 1) How can i use "RUN+="/bin/chmod foobar" if i don´t know how the usb device is called? It could be sometimes /proc/bus/usb/foo/bar and the next time /proc/usb/usb/xxx/yyy and so on ..
2) What does the "+=" after "SYMLINK" mean?

BTW: My rule is called 10-local.rules, if i move it to 91, no device is working anymore (digicam etc.) so i changed it back to 10 ... again. I don´t know why it is so ..

thanks
Erdie
_________________
Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Feb 18, 2007 6:00 pm    Post subject: Reply with quote

Read man udev. Ensure that the file is /etc/udev/rules.d/91-local.rules and not some random variation.

Erdie wrote:
How can i use "RUN+="/bin/chmod foobar" if i don´t know how the usb device is called?

Good question. Thankfully, it's not required (also not required is /dev/scanner). Just get these right:

The filename. Setting GROUP and MODE in 10-local.rules is useless if they are overridden by a later rule. This is why the filename installed by media-gfx/sane-backends is 99-libsane.rules

The rule. Example:
Code:
BUS=="usb", SYSFS{product}=="CanoScan", GROUP="scanner", MODE="0660"
Back to top
View user's profile Send private message
Erdie
Advocate
Advocate


Joined: 20 May 2004
Posts: 2656
Location: Heidelberg - Germany

PostPosted: Tue Feb 20, 2007 11:41 am    Post subject: Reply with quote

PaulBredbury wrote:
Read man udev. Ensure that the file is /etc/udev/rules.d/91-local.rules and not some random variation.


Of course, I moved it to 91-local.rules but as I mentioned above, no rule worked anymore afterthat. I did not analyse the problem and moved it back to 10-local.rules. So I have to fix this issue at first.

thanks
Erdie
_________________
Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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