23

When I try to scan, using simple-scan, the UI says Failed to scan -- Unable to connect to scanner. When I run it from the command line I get:

joel@home:/usr/bin$ simple-scan -d
** (simple-scan:6554): DEBUG: Starting Simple Scan 2.32.0.1, PID=6554
** (simple-scan:6554): DEBUG: Restoring window to 600x400 pixels
** (simple-scan:6554): DEBUG: sane_init () -> SANE_STATUS_GOOD
** (simple-scan:6554): DEBUG: SANE version 1.0.22
** (simple-scan:6554): DEBUG: Requesting redetection of scan devices
** (simple-scan:6554): DEBUG: Processing request
** (simple-scan:6554): DEBUG: Requesting scan at 300 dpi from device '(null)'
** (simple-scan:6554): DEBUG: scanner_scan ("(null)", 300, SCAN_SINGLE)
** (simple-scan:6554): DEBUG: sane_get_devices () -> SANE_STATUS_GOOD
** (simple-scan:6554): DEBUG: Device: name="brother2:bus4;dev1" vendor="Brother" model="MFC-210C" type="USB scanner"
** (simple-scan:6554): DEBUG: Processing request
** (simple-scan:6554): DEBUG: sane_open ("brother2:bus4;dev1") -> SANE_STATUS_IO_ERROR

** (simple-scan:6554): WARNING **: Unable to get open device: Error during device I/O

FYI, I have already done:

joel@home:~$ sudo chmod a+rwx /dev/bus/usb
joel@home:~$ sudo chmod a+rwx /dev/bus/usb/*

If I run under sudo:

joel@home:~$ sudo simple-scan

it works.

How can I get simple-scan to work without sudo?

9 Answers 9

10

Chances are that saned doesn't think you're allowed to connect to it. See the Permissions Issues section of the Ubuntu Scanning How-to for details.

3
  • 2
    Seems that all user accounts aren't added to the scanner group. I used sudo adduser username scanner and then you need to log off and back in again for the group membership to be noticed by the OS.
    – KayEss
    Aug 1, 2013 at 3:03
  • Did not work for me. I seem to remember that the only way to do it was using sudo and a text version not simple scan. Will keep looking
    – Dennis
    Apr 3, 2015 at 5:17
  • KayEss's suggestion ("sudo adduser username scanner") worked for my Raspbian install.
    – smashuu
    Mar 4, 2017 at 22:32
5

I had a similar problem (Ubuntu 11.04 - Natty Narwhal): Scanning as root works fine, scanning as user – no go. scanimage -L and sane-find-scanner found and identified the the scanner correctly, even when run as normal user. `simple-scan -d both as root and normal user didn't show up anything useful in terms of missing group right, missing files or drivers.

Eventually this link worked for me.

The solution was editing these files:

  • /lib/udev/rules.d/40-libsane.rules
  • /etc/udev/rules.d/55-libsane.rules

Not sure if both needed to be edited, I applied all changes as described. Very important: REBOOT after editing.

3

sudo adduser YOURNONROOTUSERNAME lp

to make sure scanner belongs to lp group:

sudo sane-find-scanner

found USB scanner (vendor=0x04f9, product=0x02a5) at libusb:001:002

ls -al /dev/bus/usb/001/002

crw-rw-r-- 1 root lp 189, 1 Nov 24 12:43 /dev/bus/usb/001/002

2

I solved it by adding this line to /etc/rc.local (before exit 0):

chmod -R a+w /dev/bus/usb

and editing/creating the following 2 files:

/etc/xinetd.d/saned:

service saned 
{
socket_type = stream
server = /usr/sbin/saned
protocol = tcp
user = root
group = root
wait = no
disable = no
}

/etc/default/saned:

# Defaults for the saned initscript, from sane-utils

# Set to yes to start saned
RUN=yes

# Set to the user saned should run as
RUN_AS_USER=root

then rebooting.

It's working, but I still would like a more secure way of solving this.

2

Edit the following:

/etc/default/saned

And change the:

RUN_AS_USER=saned

to

RUN_AS_USER=root

Restart and test again – this should be working.

1
  • 3
    Something tells me this is not a desirable solution from a security standpoint.
    – Kazark
    Apr 12, 2014 at 1:35
0

I had the exact same problem and this work for me and it is as simple as that. I actually copied from the Brother Website that solved my scanner problems:

  1. Open /lib/udev/rules.d/40-libsane.rules file.

  2. Add the following two lines to the end of the device list. (Before the line # The following rule will disable ...):

    # Brother scanners

    ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"

0

You need to add your username to the lp group and then reboot (or sudo ldconfig). Everything should be working.

This worked for me because if you run lsusb to grab the USB bus number of your printer/scanner (mine was 005) and then ll /dev/bus/usb/005 you will see that root is the owner and lp is the group, both have read and write permissions.

1
  • how do you add your username to the lp group ?
    – user162573
    Mar 19, 2017 at 16:23
0

I also had the same problem with my Epson EcoTank 2500.  I went into the terminal and found the product id with lsusb. For the EcoTank 2500 it's 1105.

Then

Open /lib/udev/rules.d/40-libsane.rules file.

I then searched for that product id with gedit and couldn't find it. So I added onto the bottom (leaving a space and writing it in CAPS so I know that it was me that changed it!)

# MY EPSON ECOTANK ET-2500

ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="1105", ENV{libsane_matched}="yes"

I then did the same in 40-iscan.rules (it's in the same folder) Finally I rebooted. Hey presto....ahhhh! My work here is done.

0

All other solutions did not work for me. The issue for me (Xubuntu 18.04) was the fact, that the user was not allowed to access /dev/bus/usb/. Unfortunately, you won't really get a error message telling you this.

This can be tested by running strace xsane 2>&1 | grep EACCES | sort -u with the user account. After exiting xsane, you will get access errors. In contrast to other solutions, the devices ls -al /dev/bus/usb/001/002 belonged to root:root and not root:lp, so adding the user to lp did nothing.

Run sudo chmod -R a+w /dev/bus/usb to grant access and try again. If scanimage -L now works, you have to make sure to apply this after every reboot.

On newer Debian/Ubuntus you have to create the file /etc/rc.local since it might not exist. Set chmod +x /etc/rc.local, open the file as root and add the following:

#!/bin/sh -e
chmod -R a+w /dev/bus/usb
exit 0

Then, since modern Ubuntu/Debian uses Systemd, you can check the script with systemctl status rc-local.service. In case rc.local is not used, check this link. Reboot to test.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .