[Hardy]Xsane needs root to operate scanner

Bug #205496 reported by Yao Wei
48
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Fix Released
High
Martin Pitt
sane-backends (Ubuntu)
Fix Released
High
Martin Pitt
xsane (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: xsane

I am using the scanning function of HP Deskjet F4185, a combo machine.
What I found was that I need to run xsane with sudo to scan my document, or it says "no device available."

Tags: hardy sudo xsane
Yao Wei (medicalwei)
description: updated
Revision history for this message
James Westby (james-w) wrote :

Hi,

Can you please go to System->Administration->Users and Groups,
then click on your user and click "Properties", then go to the
"User privileges" tab and check that "Use scanners" is checked for
your user?

Thanks,

James

Revision history for this message
Yao Wei (medicalwei) wrote :

OK, thanks.
However, it is inconvenient for a single user want to scan a document without knowing the existence of this option.
Could the option be enabled by default?

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 205496] Re: [Hardy]Xsane needs root to operate scanner

On Sun, 2008-03-23 at 12:28 +0000, Medical-Wei wrote:
> OK, thanks.
> However, it is inconvenient for a single user want to scan a document without knowing the existence of this option.
> Could the option be enabled by default?
>

Hi,

Are you saying that this option was not enabled for you? If you
enable it do you no longer need to scan as root?

If so, can you answer a couple of questions please? Are you the first
user created on this machine? What version of Ubuntu was installed on
the machine first (that has been upgraded to the current version,
not that has been re-installed)?

Thanks,

James

Revision history for this message
Chak Man Yeung (dasunst3r) wrote :

I am also experiencing this issue with a Canon LiDE 30. The command scanimage -L returns a "No scanner found" message when running as a normal user, but it does return something when run as root. I am the first user to be created, and I am already in the scanners group.

My output of scanimage -L when run as root: device `plustek:libusb:003:002' is a Canon CanoScan N1240U/LiDE30 flatbed scanner

Revision history for this message
Herman Kremer (hkrem001) wrote :

I have the same problem.
My output of scanimage -L when run as root:device `niash:libusb:002:002' is a Hewlett-Packard ScanJet 3400C flatbed scanner

Revision history for this message
Hans Spaans (hspaans) wrote :

Please sync this package with Debian Lenny/Sid, because there is a new working udev rules file (z60_libsane.rules) to solve this issue.

Revision history for this message
Mario Limonciello (superm1) wrote :

The udev rules file is generated dynamically at package build time. What in the changelog between our package and debian's latest fixes it?
 sane-backends (1.0.19-3) unstable; urgency=low

   * debian/patches/01_disable_epson2.dpatch:
     + Removed; reenable the epson2 backend.
   * debian/patches/03_snapscan_usb_ftok_fix.dpatch:
     + Added; work around the usage of ftok() in the snapscan backend. See
       the patch description for details (closes: #466855).

 -- Julien BLACHE <email address hidden> Sat, 15 Mar 2008 16:16:38 +0100
sane-backends (1.0.19-2) unstable; urgency=low

   * debian/patches/02_pixma_update.dpatch:
     + Added; update pixma backend from CVS, adding support for
        - Pixma MP210, MP470, MP520, MP610, MultiPASS MP710
        - MP140, MP220, MultiPASS MP740 (untested)
        - MP970 (experimental, untested)
       (closes: #468270).
   * debian/rules:
     + Generate and install HAL fdi file (closes: #466540).
   * debian/control:
     + Add update-inetd dependency for sane-utils.
   * debian/sane-utils.postinst, debian/sane-utils.postrm:
     + Add support for update-inetd (closes: #426514).
   * debian/sane-utils.README.Debian:
     + Document update-inetd usage.

 -- Julien BLACHE <email address hidden> Sat, 01 Mar 2008 14:11:29 +0100

Revision history for this message
James Westby (james-w) wrote :

On Mon, 2008-03-24 at 18:26 +0000, Mario Limonciello wrote:
> The udev rules file is generated dynamically at package build time. What in the changelog between our package and debian's latest fixes it?
>

I see

  debian/rules: Do not install the udev rules, since hal now provides
  dynamic ACLs on device nodes. (See hardy-hardware-detection spec.)

in the sane-backends changelog, which leads me to

https://wiki.ubuntu.com/DesktopTeam/Specs/HardyHardwareDetection

and

Device ownership: Make removable USB devices (scanners, cameras,
external hard disks, etc.) accessible to the user on the current
foreground console instead of providing static udev rules and using
group membership based access control.

Then the current set of fine-tuned udev rules and large lists of
autogenerated udev rules for model-based vendor/product ID matching can
disappear entirely, and the access control will work for e. g. future
scanners or cameras, too.

and

Drop the default system groups plugdev and scanner. Enable ConsoleKit
support in hal, which assigns read/write permission to removable USB
devices with dynamic ACLs.

      * As a followup to above, drop the long vendor/product ID based
        udev rules of libgphoto and libsane. Ensure that their preinsts
        remove the obsolete conffiles on upgrade.

      * Drop the default system groups netdev and powerdev, drop our
        in-house development libpam-foreground, drop the network-manager
        and gnome-power-manager patches to query libpam-foreground.
        Instead, do the "user is in foreground session" test with
        PolicyKit rules.

so I think this is actually something that should be fixed in hal.

Thanks,

James

Revision history for this message
narcan (narcan) wrote :

I have the same probleme with my canonscan lide 20
I can run xsane with root user, but not with my simply user
My user is in the scanner group.
the scanner worked fine on dapper, edgy and feisty, not tested on gutsy

with an sudo scanimage -L :
device `plustek:libusb:001:004' is a Canon CanoScan N670U/N676U/LiDE20 flatbed scanner

and without sudo :
No scanners were identified.

Revision history for this message
canucked (canucked) wrote :

I noticed this same problem yesterday and commented on this bug report:
https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/181129

I've also noticed other similar bug reports:
https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/205628
https://bugs.launchpad.net/ubuntu/+source/udev/+bug/121082

My scanner, HP Laserjet 3055 printer/scanner, worked fine in Gutsy. I did a clean install of Hardy beta and found that xsane required root.

This morning I installed HAL updates (hal/libhal-storage1/libhal1 0.5.11~rc2-1ubuntu2 to 0.5.11~rc2-1ubuntu3). I then went to System->Administration->Users and Groups. I found that my user (the first and only one) did not have Scanner privileges, so I enabled it. After rebooting, xsane no longer requires root to recognize the scanner. I was able to successfully save a scanned image.

However, xsane is giving a new error when closing:
Failed to create file: Permission denied.

Thanks!

Revision history for this message
canucked (canucked) wrote :

Please disregard the new error mentioned in my previous post. I fixed the "Permission denied" problem by deleting the /home/[username]/.sane/xsane directory which was created when I used xsane as root.

Now everything is working fine. Thanks!

Revision history for this message
Martin Pitt (pitti) wrote :

I get it as well, seems to be something that changed in hal recently.

Changed in xsane:
assignee: nobody → pitti
importance: Undecided → High
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Needs a small hal fix, too.

Changed in hal:
assignee: nobody → pitti
importance: Undecided → High
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hal - 0.5.11~rc2-1ubuntu4

---------------
hal (0.5.11~rc2-1ubuntu4) hardy; urgency=low

  * debian/{hal.init,rules}: Use /var/run/hald/ as PID file directory, not
    /var/run/hal/, since the former is needed for sockets, ACL caches, etc.
    (LP: #205496)

 -- Martin Pitt <email address hidden> Tue, 25 Mar 2008 16:50:58 +0100

Changed in hal:
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sane-backends - 1.0.19-1ubuntu3

---------------
sane-backends (1.0.19-1ubuntu3) hardy; urgency=low

  * Add 25_deprecated_hal_keys.dpatch: Replace the deprecated
  hal property "info.bus" with "info.subsystem" in the hal FDI generation
  tool. This fixes scanners to work with current hal without using deprecated
  keys. (LP: #205496)

 -- Martin Pitt <email address hidden> Tue, 25 Mar 2008 16:56:42 +0100

Changed in sane-backends:
status: In Progress → Fix Released
Revision history for this message
narcan (narcan) wrote :

thank you,
it's running fine now after the last upgrade

Revision history for this message
Hans Spaans (hspaans) wrote :

Proposed package updates also solved this issue in my situation.

Revision history for this message
Bruce Crowther (bwucie) wrote :

I am having this problem also. Brother scanner runs with "sudo xsane" but not otherwise.
I read above about "This bug was fixed in the package sane-backends - 1.0.19-1ubuntu3", so I figured to check if I had the latest and greatest, with this result:
us@Linfred:~$ sudo apt-get install sane-backends - 1.0.19-1ubuntu3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package sane-backends
us@Linfred:~$
???????????????
Regards,
Bruce.

Revision history for this message
naught101 (naught101) wrote :

it's called sane-utils in ubuntu, I think

Revision history for this message
Bruce Crowther (bwucie) wrote :

It is called sane-utils, and I uninstalled the Brother drivers before putting in sane-utils, then installed the driver, which Brother say is the way to do it. Still need to use "sudo": that's okay, if the wife can't work it she can't forge banknotes, eh? It's not a big problem to launch via the terminal, or I guess I could make a "gksudo "gnome-open %u" launcher on my Desktop.

Revision history for this message
naught101 (naught101) wrote :

A better way to do it is to add "scanner" to your user's groups (in teh
user control panel, giver scanner permissions), however, udev creates
the scanner device with the owner:group root:root, when it should have
been "root:scanner".

The solution is to add your user to the scanner group, then find what
bus your USB scanner is on with "lsusb" (you get a number like 002:004),
then

sudo chown root:scanner /dev/bus/usb/002/004 (or what ever the numbers are)

I have to do this every time I plug in the scanner, or turn on the computer.

Revision history for this message
Herman Kremer (hkrem001) wrote :

thank you,
it's running fine now after the last upgrade

Revision history for this message
Chak Man Yeung (dasunst3r) wrote :

Works with udev and sane-backends upgrades. Thanks!

Revision history for this message
Bruce Crowther (bwucie) wrote :

"The solution is to add your user to the scanner group, then find what
bus your USB scanner is on with "lsusb" (you get a number like 002:004),
then

sudo chown root:scanner /dev/bus/usb/002/004 (or what ever the numbers are)"

User WAS in the scanner group, and I have added the latest updates available for Hardy Beta, still have to user "sudo xsane". I thought that was not a problem, until I went to work with a scanned image. Which is owned by root, of course. I can manipulate and print it via "sudo gimp", but I can't email it or put it on my website. I need to know how to change the permissions on the image file, or bbetter still, get the scanner working without sudo.

Revision history for this message
Bruce Crowther (bwucie) wrote :

I have now got the latest version of Hardy installed, with all current updates, User is in the scanner group, and I still have to use "sudo xsane".
Does anyone have any bright ideas as to what I can do to sort this out?
Could this be because some setting is being carried over in my home partition each time I do an install of the operating system?
8.04 has caused me more hassle so far than any previous version has: definitely not yet a system for non-techies like me.
Regards,
Bruce.

Revision history for this message
Martin Pitt (pitti) wrote :

Hi Bruce,

Bruce Crowther [2008-05-16 3:33 -0000]:
> I have now got the latest version of Hardy installed, with all
> current updates, User is in the scanner group, and I still have to
> use "sudo xsane".

The scanner group does not help any more, we have a more dynamic
system now. Can you please open a terminal and copy&paste the output
of

  ck-list-sessions
  lshal > /tmp/hal.txt

and attach /tmp/hal.txt here?

Revision history for this message
Bruce Crowther (bwucie) wrote :

Bruce Crowther [2008-05-16 3:33 -0000]:
> I have now got the latest version of Hardy installed, with all
> current updates, User is in the scanner group, and I still have to
> use "sudo xsane".

The scanner group does not help any more, we have a more dynamic
system now. Can you please open a terminal and copy&paste the output
of

  ck-list-sessions
  lshal > /tmp/hal.txt

and attach /tmp/hal.txt here?

Revision history for this message
oscar (garcia-unbc) wrote :

> Can you please open a terminal and copy&paste the output of
>
> ck-list-sessions
> lshal > /tmp/hal.txt
>
> and attach /tmp/hal.txt here?

I have the same problem with my Epson V500. Here is my output:

oscar@Dell-Linux:~$ ck-list-sessions
Session1:
 uid = '1000'
 realname = 'Oscar Garcia,,,'
 seat = 'Seat1'
 session-type = ''
 active = TRUE
 x11-display = ':0'
 x11-display-device = '/dev/tty7'
 display-device = ''
 remote-host-name = ''
 is-local = TRUE
 on-since = '2008-05-19T22:01:52Z'
oscar@Dell-Linux:~$ lshal > tmp/hal.txt

Revision history for this message
Martin Sander (forke) wrote :

Same here, Canon CanoScan N 650U.
Works if I change the permissions of the device node:

$ sudo chown root:scanner /dev/bus/usb/003/003

the output of lshal is attached (just the part about the scanner though.
ck-list-sessions gives no output. I guess this is because I don't use kdm or gnome. I use dwm as a windowmanager and use no loginmanager at all (just login on virtual terminal and do startx).

Revision history for this message
Ric Flomag (ricflomag) wrote :

Why does the status say "Fix released" ?

Revision history for this message
oscar (garcia-unbc) wrote :

I know that this does not fix the bug, but FWIW it may help somebody. For now, this works for me:

make a file /etc/udev/rules.d/50-scanner-kludge.rules, containing:
SYSFS{idVendor}=="04b8", SYSFS{idProduct}=="0130", MODE="664", GROUP="scanner"
(substitute your vendor and product numbers shown by sane-find-scanner)
Add yourself to the scanners group.

Unlike other suggestions on the web, I placed this in a new file so that it can be easily deleted when/if the root of the problem is fixed.

Revision history for this message
Martin Pitt (pitti) wrote :

Martin Sander [2008-05-22 23:38 -0000]:
> ck-list-sessions gives no output. I guess this is because I don't
> use kdm or gnome. I use dwm as a windowmanager and use no
> loginmanager at all (just login on virtual terminal and do startx).

That would be it then. I think the preferred option for this is to
install libpam-ck-connector, which should be able to create a session
for you then.

Revision history for this message
Martin Sander (forke) wrote :

Installing libpam-ck-connector, and

sudo sh -c 'echo session optional pam_ck_connector.so >> /etc/pam.d/login'

did it for me.
Took me some time to find out the second part, though..

Revision history for this message
Bruce Crowther (bwucie) wrote :

"I know that this does not fix the bug, but FWIW it may help somebody. For now, this works for me:

make a file /etc/udev/rules.d/50-scanner-kludge.rules, containing:
SYSFS{idVendor}=="04b8", SYSFS{idProduct}=="0130", MODE="664", GROUP="scanner"
(substitute your vendor and product numbers shown by sane-find-scanner)
Add yourself to the scanners group."

Tried it, Oscar, but I still have to use sudo. Something beyond my feeble grasp is still out of whack. I just change the ownership of the file once I have scanned with sudo chmod 666, but it is a pain having to do it all the time (just lately I have had an unusual need of the scanner, so it is wearing my sense of humour!)
Regards,
Bruce.

Revision history for this message
Bruce Crowther (bwucie) wrote :

Hooray!!
Latest updates which arrived minutes ago via Update Manager have Xsane running without sudo.
I have problems closing the app after I am finished: it tells me four times that "File is not created, Permission denied", but I care not about that. I can scan an image, save it, and re-open it without using sudo, the sun is shining and I am a happy camper..........................
Now, let's go see if my Palm will sync..............
Cheers,
Bruce

Revision history for this message
peter b (b1pete) wrote :

hello to all,

this is not about root to operate scanner, is about scanner port detection, just thought that it would be ok to post it here.

I'm running hardy amd64 with last upgrades/updates installed

uname -r
2.6.24-18-generic

. the scanner used to work ok with previous version 14, 16. didn't use it for a while; now I'm getting

error failed to open device 'snapscan:libusb:002:010':invalid argument

and this

lsusb

Bus 002 Device 010: ID 06bd:208f AGFA-Gevaert NV SnapScan e50
Bus 002 Device 007: ID 0d8d:0105 Promotion & Display Technology, Ltd
Bus 002 Device 004: ID 0ace:1215 ZyDAS WLA-54L WiFi
Bus 002 Device 003: ID 050d:0224 Belkin Components F5U224 USB 2.0 4-Port Hub
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 010: ID 050d:0980 Belkin Components
Bus 001 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 008: ID 0451:1446 Texas Instruments, Inc. TUSB2040/2070 Hub
Bus 001 Device 001: ID 0000:0000

and this

scanimage -L
device `snapscan:libusb:002:010' is a AGFA SNAPSCAN flatbed scanner

and this

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=0x06bd [AGFA ], product=0x208f [SNAPSCAN]) at libusb:002:009
found USB scanner (vendor=0x0ace, product=0x1215) at libusb:002:004
found USB scanner (vendor=0x067b, product=0x2303) at libusb:001:009

pls notice the diff --> 009 on last command output vs before last command 010 and the error message.

is there any fix to this or at least why it happens.

any help is appreciated.

best regards,
peter b

Revision history for this message
James Westby (james-w) wrote :

On Sat, 2008-06-14 at 03:35 +0000, peter b wrote:
> hello to all,
>
> this is not about root to operate scanner, is about scanner port
> detection, just thought that it would be ok to post it here.

Hi Peter,

Could you please open a new bug report, as this one seems to be
a different issue.

Thanks,

James

Revision history for this message
peter b (b1pete) wrote :

hello James,

done that --> see # 239930.

best regards,
peter b

Revision history for this message
vonHutten13 (vonhutten13) wrote :

hej folks,

thru all SAR i could not find any good answer to get my epson perfection 3490 photo running on simple user rights. evrything is installed correctly, up-dated & graded, they group rights are set correct, even the pripro EPKOWA driver is installed. scanner is correctly recognized as epson epson under usb, but still it all scanner programs want ROOT to enter. seems that xsane changed the name ( insane )?
anyone a clue ?

Syst: AMD X2 +4600
          Ubuntu 8.04
          Gnome desktop

kind regards,

Ulrich von Hutten

Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

Ulrich, do you still experience this bug on Ubuntu? Thank you for telling us!

Changed in xsane (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.