Ubuntu

permission problems for sane devices

Reported by porzech on 2007-06-18
34
This bug affects 2 people
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Undecided
Unassigned
sane-backends (Ubuntu)
Medium
Unassigned
udev (Ubuntu)
Undecided
Unassigned

Bug Description

tried to configure sane to detect my USB scanner under Kubuntu 7.10 "Gutsy Gibbon" - Alpha i386 (20070606.1)
but it failed.
Under root scanner is detected OK

After some further experiments i figured out that Sane needs 0666 permissions for usb device that scanner is attached to but the devive has following permissions root,root 0664 so temporary solution for me was to change permissions to 0666
user account im trying to run sane is in scaner group

Rolf Leggewie (r0lf) wrote :

I ran into a similar issue. But when trying to do a network scan. The device for me was created 660 for root.scanner. I added a local user on the local machine to the scanner group and was able to scan successfully. Scanning over the network failed. It only started to work once I changed permission to 666.

Changed in sane-backends:
status: New → Confirmed
Rolf Leggewie (r0lf) wrote :

question 13580 has more information from me. Unfortunately, nobody turned up with a solution.

https://answers.launchpad.net/ubuntu/+source/sane-backends/+question/13580

Simon Oosthoek (simon-margo) wrote :

I'm trying hardy heron beta1 and I have this same problem.
(NB, commands below ran after changing permissions, so xsane is not running as root)

when I run lsusb, I can see the device is 004:004:
Bus 004 Device 006: ID 07cc:0501 Carry Computer Eng., Co., Ltd
>>>> Bus 004 Device 004: ID 04b8:011b Seiko Epson Corp. Perfection 2400 Photo
Bus 004 Device 002: ID 03f0:c602 Hewlett-Packard
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 046d:c03e Logitech, Inc. Premium Optical Wheel Mouse
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 045e:001d Microsoft Corp. Natural Keyboard Pro
Bus 002 Device 002: ID 045e:001c Microsoft Corp.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

"lsof |grep xsane |grep dev" also gives that xsane is using this device at /dev/bus/usb/004/004:
xsane 10068 simon 6r CHR 1,9 1804 /dev/urandom
xsane 10068 simon 8u CHR 189,387 5753 /dev/bus/usb/004/004

So when I changed
chgrp scanner /dev/bus/usb/004/004
and made sure my username (simon) is in the scanner group, I could run xsane as a normal user.

The bug is that my default user wasn't in the scanner group _and_ the device for the scanner wasn't in the scanner group.

I don't know what mechanism is used to set this...

Cheers

Simon

naught101 (naught101) wrote :

Simon - you solution worked for me to.. interesting to note the permissions of the relevant USB device:

$ ls -lah
crw-rw-r-- 1 root root 189, 134 2008-03-23 13:57 007

Should this bug be assigned to udev as well?

Simon Oosthoek (simon-margo) wrote :

yes, that is probably what sets the permissions, and also the "thing" that should put the user in the scanner group, but I don't know what that is ;-)

Cheers

Simon

der_vegi (m-may) wrote :

Same problem here on Hardy Beta, amd64 with a Canon LiDE 20 (usb). My user has not been in the scanner group, either. Adding the user to this group does not solve the problem, using xsane as root works.

this worked for me:

on terminal:
sudo adduser myusername scanner
afterwards re-login <-- !!!

Scanner permissions should be handled by ACL via ConsoleKit/HAL now.

Changed in udev:
status: New → Invalid
Simon IJskes (sim-nyx) wrote :

what worked for me was:

rm -r /dev/.udev/failed /dev/.udev/names /dev/.udev/db

/etc/init.d/udev stop

/etc/init.d/udev start

i guess this problem was caused because the system was upgraded from a previous system, instead of clean installed.

Simon IJskes (sim-nyx) wrote :

I'm lost. After inspection of the udev sources it looks like udev does not save state between restarts except for the /dev/.udev/rules.d directory.

So, it might be that the problem was cured by some update since last reboot 10 hours ago, or that the problem was fixed by unplugging and plugging back in of the USB scanner after restarting the udevd.

I will have to check after next reboot if the problem re-occurs.

Simon IJskes (sim-nyx) wrote :

Found it. When udev is started with the scanner plugged in, the device entry is created like:

crw-rw-r-- 1 root root 189, 389 May 8 11:03 /dev/bus/usb/004/006

after unplugging/replugging it is:

crw-rw-r--+ 1 root root 189, 390 May 8 11:05 /dev/bus/usb/004/007

notice the '+'.

Simon IJskes (sim-nyx) wrote :

Solved. Looks like there were some old config files in /etc/hal:
/etc/hal/hald.conf
/etc/hal/fdi/preferences.fdi.bak

as at least /etc/hal/hald.conf was mentioned in 'dpkg -L hal' i did:

dpkg --purge --force-depends hal
rm /etc/hal/hald.conf /etc/hal/fdi/preferences.fdi.bak
apt-get -f install

and after a reboot, the thing works fine.

Simon IJskes (sim-nyx) on 2008-05-08
Changed in hal:
status: New → Confirmed
Simon IJskes (sim-nyx) on 2008-05-08
Changed in hal:
status: Confirmed → New
Akkana Peck (akkzilla) wrote :

Sim: is that really apt-get -f install with no package names after it?

I'm having this problem too -- my scanner which worked fine under gutsy and earlier no longer works unless I figure out which USB device it is and sudo chmod 666 or sudo chgrp scanner. The udev rule

Copying the /etc/udev/rules.d/45-libsane.rules from my gutsy partition into hardy seems to cure the problem -- now the USB device is group scanner and I can access it. I'd rather not have my scanner depend on hal anyway.

Simon IJskes (sim-nyx) wrote :

Akkena:
'apt-get -f install' installs packages to fill the missing depencies. (like the hal you just removed).

And altough you might not like the permission management of hal, if you have a desktop system (not a server) you have no real choice.

Expect to see more and more subsystems to be dependend on hal provided services.

Rolf Leggewie (r0lf) on 2008-06-02
Changed in sane-backends:
importance: Undecided → Medium
status: Confirmed → Triaged
Simon IJskes (sim-nyx) wrote :

problem re-occured.

Ubuntu 4.08:

Linux titan 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686 GNU/Linux

unplugging usb scanner and pluggin it in again does not solve the problem.

maybe console-kit does not pick up the active console user.

restart of hal does not cure problem.

Simon IJskes (sim-nyx) wrote :

err: ubuntu 8.04

In Intrepid I had to create a new /etc/udev/rules.d/45-libsane.rules file with the following lines:

# Hewlett-Packard ScanJet 3570c
SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2005", MODE="664", GROUP="scanner"

Now udev set correct permissions and ownership at boot for my scanner.

RichB (trash1464) wrote :

I also am having permissions issues with an Epson Perfection 2450 Photo scanner.
I have two scanners attached, both are IEEE1394 interfaces. The Nikon Coolscan works fine and is seen by xsane and vuescan.
The problem is with an Epson Perfection 2450 Photo which is not seen by either app.

Executing "gksudo xsane" works with the both 2450 and Coolscan scanners.

Executing xsane from the menu under my userid does not work with the 2450.
Executing xsane from the menu under my userid works OK with the Coolscan

Executing "sudo sane-find-scanner" returns:
found SCSI processor "EPSON GT-9700 1.05" at /dev/sg5
found SCSI scanner "Nikon LS-4000 ED 1.10" at /dev/sg6

Executing "sane-find-scanner" returns only:
found SCSI scanner "Nikon LS-4000 ED 1.10" at /dev/sg6

RichB (trash1464) wrote :

I should add that I am running Jaunty 9.04 64bit

RichB (trash1464) wrote :

If anybody is still looking at this, you might like to know I got it working on Jaunty. The fix was too simple, it only took running the command:

sudo chown rich /dev/sg6

where "rich" is my login userid

Both scanners now work without requiring root. They work with Sane and Vuescan.

RichB (trash1464) wrote :

Just when you thought it was safe..............

This thing has taken a strange twist. After a reboot, the Epson scanner no longer works. If I rerun the command:

sudo chown rich /dev/sg6

Things work again. What makes it even more weird is that /dev/sg6 ti the port for the Nikon scanner which does not have the problem. Running the chown command against /dev/sg5, which is where the problem scanner lives, does not fix the problem. It was by blind luck that I discovered this. Hopefully one of you guru types will understand what it all means.

So, bottom line is that this is not a fix but possibly a workaround. Just run the chown command before using the scanner. Maybe there is a way to incorporate it into the object properties?

RichB (trash1464) wrote :

I upgraded to Karmic (9.10) yesterday and this problem is fixed in that release.

Akkana Peck (akkzilla) wrote :

Not working in Karmic for an HP Deskjet F4280 multifunction.

As any user, sane-find-scanner says
found USB scanner (vendor=0x03f0, product=0x2504) at libusb:001:003

but scanimage -L only works as root:
device `hpaio:/usb/Deskjet_F4200_series?serial=CN98Q5Z1XF05BR' is a Hewlett-Packard Deskjet_F4200_series all-in-one

xsane (from gimp or standalone) can't find any devices.

I've added a "scanner" group and made sure I'm in it. I also tried adding a line to /lib/udev/rules.d/40-libsane.rules that looked like all the others there now:
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2504", ENV{libsane_matched}="yes"
and restarting udev with service udev restart. No help.

It also didn't help to add this line to 40-libsane.rules:
SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2504", MODE="664", GROUP="scanner"

Any suggestions for the new way to fix it on karmic?

Dave T. Johnson (hedgefighter) wrote :

Got this to work on Karmic for an HP Officejet 5510. sudo sane-find-scanner returned:
found USB scanner (vendor=0x03f0 [hp], product=0x3a11 [officejet 5500 series]) at libusb:001:003

I added an line similar to the one already in /lib/udev/rules.d/40-libsane.rules as mine wasn't listed:
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3a11", ENV{libsane_matched}="yes"

I added the following line to the new file /etc/udev/rules.d/45-libsane.rules:
SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3a11", MODE="664", GROUP="scanner"

I created the group "scanner" and added my self to it:
sudo groupadd scanner
sudo usermod -a -G scanner dave

I also added the user "saned" to the scanners group so that I can access the scanner from another system using the sane daemon and xsane:
sudo usermod -a -G scanner saned

After a reboot, things seem to be working locally and with a different system. I'm not sure how necessary adding the line to /lib/udev/rules.d/40-libsane.rules was.

Akkana Peck (akkzilla) wrote :

Thanks, hedgefighter! Adding both udev rules, in the two different files as you describe, worked for me too. (And wow, is this scanner crappy. I think I'll keep my old Epson running.) I guess the key is that the rule has to be in /etc/udev/rules.d/45-libsane.rules, not in /lib/udev/rules.d/40-libsane.rules.

Anyone know the difference between /etc/udev/rules.d and /lib/udev/rules.d? Why do they both exist?

tifff (horst-fiedler) wrote :

Thank's very much, I had the same problem and added
# CanoScan FS4000US Film Scanner
ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="3042", ENV{libsane_matched}="yes"

to /etc/udev/rules.d/45-libsane.rules, otherwise vuescan will not detect that filmscanner (except when used as root). For sane it's useless as that scanner is not supported by sane.
In my case (karmic) /etc/udev/rules.d/45-libsane.rules did not even exists, therefore the only thing to do was to add that line and to reboot. No scanner group was necessary but I'm member of plugdev.

Dave T. Johnson (hedgefighter) wrote :

I just realized that my fix breaks the printer. Use something like this in /etc/udev/rules.d/45-libsane.rules:
SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3a11", MODE="664", USER="lp", GROUP="scanner"

The discussion so far deals with the permissions of the device. But I think what is more important is that by default, the user is not part of the group "scanner". In fact that group doesn't even exist after a fresh install of Ubuntu 10.04.
The user does not get an error message that points to the permission problem - the scanner just does not work (I have a canon canoscan lide 25, but I think this problem is for all scanner types).

I suggest, that every user that is created, should be added to the "scanner" group by default.

Thomas Hotz (thotz) on 2012-10-05
Changed in hal (Ubuntu):
status: New → Invalid
Rolf Leggewie (r0lf) wrote :

I believe the scanner group is no longer part of a Ubuntu installation. I'm running precise and couldn't locate it there.

Thomas Hotz (thotz) on 2013-04-12
Changed in sane-backends (Ubuntu):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions