The Linux Page

SANE cannot find any scanners

Drawing of the Wolf Susie.Jinx

Problem since Ubuntu 13.10

As I upgrade to 13.10 of Ubuntu, I'm having to do work to get my system back to normal...

Today I stumble on the fact that USB ports are now not accessible by everyone by default. So when I tried to scan a document, it told me that I had no scanners. Panic... and then I found out that the permissions were changed, widely, so only users who are root (by default) can access the scanners.

I changed the group to a group I'm in and it worked without having to reboot or relog in. However, it is not unlikely that the group won't stick... Ah! Correct! But I have the solution below.

List Scanners

To find the USB port that has your scanner, use the following command:

sudo sane-find-scanner

When you are root, it can scan all the USB ports in read and write mode so it will be capable of finding the port. You will get an entry such as:

found USB scanner (vendor=0x04b8 [EPSON], product=0x011d [EPSON Scanner]) at libusb:003:002

Here we see that the USB port in question is 003 / 002. You should know the name of the vendor which should help you find the correct port.

Fixing the Group Ownership

The port definition is found under /dev/bus/usb, in my case I could do:

ls -l /dev/bus/usb/003

The entry of interest showed up in the list:

crw-rw-r--  1 root root 189, 256 Mar  4 19:43 001
crw-rw-r--+ 1 root root 189, 257 Mar  4 19:43 002

As we can see, the owner and group are set to root. Also you may notice a + next to the standard Unix flags. I'm not sure what that is though. Maybe a "signal" that something is connected on that port.

So to change the group I used the chgrp command:

sudo chgrp lpadmin /dev/bus/usb/003/002

Again you have to use sudo. Here I used lpadmin which is a group I am defined in. To see the list of group you pertain to use the groups command:

groups

If you'd like to add your user to a group, see the adduser command. For example, you can add yourself to the lpadmin group like this:

adduser alexis lpadmin

Then you will be able to make the change of group work for your user.

WARNING: adding a user to a group is not effective immediately in a console. You have to close and reopen the console.

List as You Instead of root

Once that is done, the sane-find-scanner should work as you, instead of root. This mean you should be able to do that and see your scanner in the list:

sane-find-scanner

If so, then you are back in business. But only until the next time you restart your computer or disconnect / reconnect your scanner (I unplug the power of my scanner when I don't use it, less electricity!) Thus we need a way to have that lpadmin stick around.

Get the Group to Stick Around

To get the assigned group to stick around between reboots, I use the following udev definition:

# Make my EPSON accessible without having to sudo chgrp each time I use it
SUBSYSTEM=="usb|usb_device",ATTRS{idVendor}=="04b8",ATTRS{idProduct}=="011d",GROUP="lpadmin"

Make sure to change the vendor number (04b8 for my Epson) and the product number (011d for my Epson) to your device numbers. If you look closely, they are shown when you run the sane-find-scanner tool. For additional features available in the udev rule files, check the system files under /lib/udev/rules.d, there are many there.

These two lines of code are put in a file under /etc/udev/rules.d/... The name of the file should start with a 2 digits number. For example:

50-epsonusb.rules

Just like with other things under /etc, you'll need to use sudo to edit that file:

sudo vim /etc/udev/rules.d/50-epsonusb.rules

One cool thing about this newer version, though, now I can run the scans in the background process and it works! In 12.10 that used to fail...

Re: SANE cannot find any scanners

"sane-find-scanner" is capable of finding more scanners than "scanimage -L" which is limited to scanners that are compatible with the SANE libraries. In other words, if your scanner is really old then "scanimage -L" should not list it. At least that's what I understand. Mine works... so I don't have an instance as you describe. It could also be that you have some sort of scanner which is not SANE compatible. Some manufacturers do that sort of thing (i.e. specialized hardware that is to work only with their specialized driver.)

To make sure I would search about my scanner and see whether others have been able to make it work under Linux. If it's not brand new then you should be able to find quite a few entries about it. If it's an Epson, then I would imagine that it should work right out of the box, though. It may depend on the model... I only have had just one model of Epson flat bed scanner.

Re: SANE cannot find any scanners

Good guide for sane permissions, 'sane-find-scanner' now finds my Epson scanner from root or user. However I still cannot get 'scanimage -L' to find it. Have any thoughts?

jwillar