Difference between revisions of "SANE"

From ArchWiki
Jump to: navigation, search
m (Network scanning)
(Verification: re-add diagnostics as root)
 
(147 intermediate revisions by 47 users not shown)
Line 1: Line 1:
 
[[Category:Imaging]]
 
[[Category:Imaging]]
[[es:Sane]]
+
[[es:SANE]]
 
[[fr:Sane]]
 
[[fr:Sane]]
[[zh-CN:Sane]]
+
[[it:SANE]]
{{Article summary start|Summary}}
+
[[ja:Sane]]
{{Article summary text|Installing and configuring Sane}}
+
[[zh-cn:SANE]]
{{Article summary heading|Related}}
+
{{Related articles start}}
{{Article summary wiki|Scan print and save Script}}
+
{{Related|SANE/Scanner-specific problems}}
{{Article summary end}}
+
{{Related|Scanner Button Daemon}}
 +
{{Related articles end}}
  
Sane provides a library and a command-line tool to use scanners under GNU/Linux.
+
SANE ([[wikipedia:Scanner Access Now Easy|Scanner Access Now Easy]]) provides a library and a command-line tool to use scanners under GNU/Linux.
 
[http://www.sane-project.org/sane-supported-devices.html Here] you can check if sane supports your scanner.
 
[http://www.sane-project.org/sane-supported-devices.html Here] you can check if sane supports your scanner.
  
 
== Installation ==
 
== Installation ==
{{Ic|sane}} is available in the {{Ic|[extra]}} repository so:
+
[[Install]] the {{Pkg|sane}} package.
# pacman -S sane
+
  
== Configuration ==
+
== Verification ==
 
Now you can try to see if sane recognizes your scanner
 
Now you can try to see if sane recognizes your scanner
 
  $ scanimage -L
 
  $ scanimage -L
If that fails, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for {{ic|/etc/udev/rules.d/sane.rules}} to recognize your scanner.
+
If that fails, run the command again as root to check for permission problems. If that fails as well, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for {{ic|/etc/udev/rules.d/sane.rules}} to recognize your scanner.
  
 
Now you can see if it actually works
 
Now you can see if it actually works
 
  $ scanimage --format=tiff > test.tiff
 
  $ scanimage --format=tiff > test.tiff
  
=== For HP hardware ===
+
If the scanning fails with the message {{ic|scanimage: sane_start: Invalid argument}} you may need to specify the device.
For HP hardware you may also need to install the {{Ic|hplip}} and/or {{Ic|hpoj}} packages which are in the {{Ic|extra}} repository:
+
{{hc|$ scanimage -L|
# pacman -S hplip hpoj
+
device `v4l:/dev/video0' is a Noname Video WebCam virtual device
 +
device `pixma:04A91749_247936' is a CANON Canon PIXMA MG5200 multi-function peripheral}}
  
* Uncomment or add {{Ic|hpaio}} and {{Ic|hpoj}} to a new line in {{ic|/etc/sane.d/dll.conf}}.
+
Then you would need to run
* Running {{Ic|hp-setup}} as root may help you add your device.
+
$ scanimage --device "pixma:04A91749_247936" --format=tiff > test.tiff
* {{Ic|hp-plugin}} is the 'HPLIP Plugin Download and Install Utility'.
+
* {{Ic|hp-scan}} is the 'HPLIP Scan Utility'.
+
For Hewlett-Packard OfficeJet, PSC, LaserJet, and PhotoSmart printer multi-function peripherals, run ptal-init setup as root and follow instructions:
+
ptal-init setup
+
Then start the ptal-init daemon.
+
  
=== For Brother hardware ===
+
Sane provides many special backend options for numerous scanner types. To see what these are for your device:
In order to install a Brother Scanner or Printer/Scanner Combo you need the right driver (which can be found in the AUR).
+
$ scanimage -A
There are only four drivers to choose from (brscan1-4).  In order to find the right one you should search for your model at the [http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_scn.html brother linux scanner page].
+
  
After you installed the driver you need to run
+
== Installing a scanner driver ==
# /usr/local/Brother/sane/setupSaneScan1 -i
+
Most scanners should work out of the box. If yours does not, see [[SANE/Scanner-specific problems]] for installation instructions.
  
so the drivers/scanner are recognized by sane.
+
===Firmware===
 
+
For network scanners, Brother provides a configuration tool:
+
$ brsaneconfig2 -a name=<ScannerName> model=<ScannerModel> ip=<ScannerIP>
+
Example:
+
$ brsaneconfig2 -a name=SCANNER_DCP770CW model=DCP-770CW ip=192.168.0.110
+
 
+
=== For Epson hardware ===
+
For Wi-Fi and/or network scanners, you can use "Image Scan! for Linux".
+
 
+
Install {{AUR|iscan}} and {{AUR|iscan-plugin-network}} from the [[AUR]], then update {{ic|/etc/sane.d/epkowa.conf}} and add the line:
+
net {IP_OF_SCANNER}
+
 
+
=== For Samsung hardware ===
+
For some Samsung MFP printers you may need to edit /etc/sane.d/xerox_mfp.conf.
+
 
+
example entry:
+
#Samsung SCX-3200
+
usb 0x04e8 0x3441
+
 
+
Change the printer model as needed.  You can get the ipVendor and idProduct code with lsusb.  See [https://bbs.archlinux.org/viewtopic.php?id=123934 this thread].
+
 
+
=== For plustek scanners ===
+
Some plustek scanners (noticeably Canoscan ones), require a lock directory. Make sure that /var/lock/sane directory exists, that its permissions are 660, and that it is owned by <user>:scanner. If the directory permissions are wrong, only root will be able to use the scanner. Seems (at least on x86-64) that some programs using libusb (noticeably xsane and kooka) need scanner group rw permissions also for accessing /proc/bus/usb to work for a normal user.
+
 
+
==Firmware==
+
 
{{Note|This section is only needed if you need to upload firmware to your scanner.}}
 
{{Note|This section is only needed if you need to upload firmware to your scanner.}}
  
Line 80: Line 50:
 
*Make sure the firmware entry is uncommented and let the file-path point to where you put the firmware file for your scanner. Be sure that members of the group {{Ic|scanner}} can access the {{ic|/etc/sane.d/<backend-name>.conf}} file.
 
*Make sure the firmware entry is uncommented and let the file-path point to where you put the firmware file for your scanner. Be sure that members of the group {{Ic|scanner}} can access the {{ic|/etc/sane.d/<backend-name>.conf}} file.
  
If the backend of your scanner is not part of the sane package (such as hpaio.conf which is part of hplip), you need to uncomment the relevant entry in /etc/sane.d/dll.d/hplip.
+
If the backend of your scanner is not part of the sane package (such as hpaio.conf which is part of {{pkg|hplip}}), you need to uncomment the relevant entry in {{ic|/etc/sane.d/dll.conf}}.
  
 
==Install a frontend==
 
==Install a frontend==
XSane provides a GTK-based frontend to Sane. It is available in the {{Ic|extra}} repository.
+
Many frontends exist for SANE, a non-exhaustive list of which can be found on the [http://www.sane-project.org/sane-frontends.html sane-project website]. Another way to find them is to use {{ic|pacman}} to [[Pacman#Querying_package_databases|search the repositories]] for keywords such as "sane" or "scanner".
# pacman -S xsane
+
{{Note|Scanning directly to pdf using Xsane in 16bit color depth mode is known to produces [https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/539162 corrupted files]. 8bit mode should work.}}
+
  
Other frontends exist, to find them you can:
+
* {{App|[[Wikipedia:Scanner_Access_Now_Easy#gscan2pdf|gscan2pdf]]|A GTK2-based GUI to produce PDFs, TIFFs or DjVus from scanned documents. It is also able to apply OCR in the process using different engines.|http://gscan2pdf.sourceforge.net/|{{AUR|gscan2pdf}}}}
*use {{Ic|pacman -Ss}} to search for keywords such as "sane" or "scanner"
+
* {{App|[[Wikipedia:Scanner_Access_Now_Easy#Simple_Scan|Simple Scan]]|A simplified GUI that is intended to be easier to use and better integrated into the [[GNOME]] desktop than XSane. It was initially written for Ubuntu and is maintained by Robert Ancell of Canonical Ltd. for GNU/Linux.|http://launchpad.net/simple-scan|{{Pkg|simple-scan}}}}
*see the [http://www.sane-project.org/sane-frontends.html list of frontends] on the sane-project website
+
* {{App|[[Wikipedia:Skanlite|Skanlite]]|A simple image scanning application that does nothing more than scan and save images, based on the KSane backend.|https://www.kde.org/applications/graphics/skanlite|{{Pkg|skanlite}}}}
 +
* {{App|[[Wikipedia:Scanner_Access_Now_Easy#XSane|XSane]]| A full-featured GTK-based frontend looking a bit old but providing extended functionalities.|http://www.xsane.org/|{{Pkg|xsane}}}}
 +
{{Note|Scanning directly to PDF using XSane in 16bit color depth mode is known to produces [https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/539162 corrupted files] and a note in {{ic|pacman}} output warns so. 8bit mode is known to work.}}
  
 
==Network scanning==
 
==Network scanning==
==== Sharing Your Scanner Over a Network ====
+
=== Sharing your scanner over a network ===
  
You can share your scanner with other hosts on your network who use sane, xsane or xsane-enabled Gimp. To set up the server, first indicate which hosts on your network are allowed access.
+
You can share your scanner with other hosts on your network who use sane, xsane or xsane-enabled Gimp. To set up the server, first indicate which hosts on your network are allowed access.
  
Change the /etc/sane.d/saned.conf file to your liking, for example:
+
Change the {{ic|/etc/sane.d/saned.conf}} file to your liking, for example:
 
  # required
 
  # required
 
  localhost
 
  localhost
Line 102: Line 72:
 
  192.168.0.0/24
 
  192.168.0.0/24
  
Ensure xinetd is installed:
+
If you use iptables, [[Kernel_modules|insert]] the {{ic|nf_conntrack_sane}} module to let the firewall track saned connections.
# pacman -S xinetd
+
  
Next, make sure the a file called /etc/xinetd.d/sane exists and disabled is set to no:
+
Now start/enable {{ic|saned.socket}} [[systemd#Using units|using systemd]]. Your scanner is now available over the network. For more information, see {{man|8|saned|url=https://linux.die.net/man/8/saned}}.
service sane-port
+
{
+
    port        = 6566
+
    socket_type = stream
+
    wait        = no
+
    user        = root
+
    group      = scanner
+
    server      = /usr/sbin/saned
+
    disable    = no
+
}
+
  
Add the following line to /etc/services:
+
=== Accessing your scanner from a remote workstation ===
sane-port 6566/tcp
+
{{Note|Some network scanners require a different approach. See [[SANE/Scanner-specific problems]].}}
 
+
[[Daemons#Starting manually|Start]] xinetd.
+
 
+
Your scanner can now be used by other workstations, across your local area network.
+
 
+
It can also be [[Daemons#Starting on boot|started on boot]].
+
 
+
==== Accessing Your Scanner from a Remote Workstation ====
+
 
You can access your network-enabled scanner from a remote Arch Linux workstation.
 
You can access your network-enabled scanner from a remote Arch Linux workstation.
  
To set up your workstation, begin by installing xsane:
+
First, specify the server's host name or IP address in the {{ic|/etc/sane.d/net.conf}} file:
# pacman -S xsane
+
 
+
Next, specify the server's host name or IP address in the /etc/sane.d/net.conf file:
+
 
  # static IP address
 
  # static IP address
 
  192.168.0.1
 
  192.168.0.1
Line 138: Line 86:
 
  stratus
 
  stratus
  
Now test your workstation's connection, from a non-root login prompt:
+
Now test your workstation's connection:
$ xsane
+
 
+
or
+
 
  $ scanimage -L
 
  $ scanimage -L
  
After a short while, xsane should find your remote scanner and present you with the usual windows, ready for network scanning delight!
+
The network scanner should now also show up in any [[#Install a frontend|front-end]].
 
+
For HP All in one network printer/scanner/fax you need to configure it via:
+
$ hp-setup <printer ip>
+
  
 
==Troubleshooting==
 
==Troubleshooting==
 +
:See also: [[SANE/Scanner-specific problems]]
 +
 
===Invalid argument===
 
===Invalid argument===
 
If you get an "Invalid argument" error with xsane or another sane front-end, this could be caused by one of the following reasons:
 
If you get an "Invalid argument" error with xsane or another sane front-end, this could be caused by one of the following reasons:
  
 
==== Missing firmware file ====
 
==== Missing firmware file ====
No firmware file was provided for the used scanner (see above for details).
+
No firmware file was provided for the used scanner (see [[#Firmware]] for details).
  
 
==== Wrong firmware file permissions ====
 
==== Wrong firmware file permissions ====
Line 162: Line 106:
  
 
==== Multiple backends claim scanner ====
 
==== Multiple backends claim scanner ====
It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that doesn't do after all (the scanner won't be displayed by scanimage -L then). This has happend with older Epson scanners and the <code>epson2</code> resp. <code>epson</code> backends. In this case, the solution is to comment out the unwanted backend in <code>/etc/sane.d/dll.conf</code>. In the Epson case, that would be to change
+
It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that does not do after all (the scanner will not be displayed by scanimage -L then). This has happend with older Epson scanners and the {{ic|epson2}} resp. {{ic|epson}} backends. In this case, the solution is to comment out the unwanted backend in {{ic|/etc/sane.d/dll.conf}}. In the Epson case, that would be to change
  
 
   epson2
 
   epson2
Line 171: Line 115:
 
   #epson2
 
   #epson2
 
   epson
 
   epson
 +
 +
It may also be possible that the independant {{Pkg|iscan}} epkowa backend interferes with your snapscan backend (epson scanners). You may get this error right after using the {{ic|scanimage -L}} command. Starting the scanner app (like {{Pkg|xsane}}) twice can also solve the problem. Otherwise check your {{ic|/etc/sane.d/epkowa.conf}} for wrong configuations or remove the {{Pkg|iscan}} package.
 +
 +
==== Communication via xHCI not working (older scanner models) ====
 +
Some older scanner models do not work when connected via an USB3 port. This is not a big issue if USB2 ports are available. If only USB3 ports are available, there are several ways to resolve the issue:
 +
* Disable xHCI via BIOS/EFI. eHCI will consequently be used and communication with the scanner will work. On the downside, USB3 speed can not be reached on any port.
 +
* On (some) intel chipsets the 'setpci' command can be used to route specific usb ports to either the xHCI or the eHCI controller. See [https://forums.opensuse.org/showthread.php/507627-Suse-13-2-scanner-no-longer-working-on-64-bit-version?p=2714695#post2714695 Here] and [http://superuser.com/questions/812022/force-a-single-usb-3-0-port-to-work-as-usb-2-0 Here] (scroll down to where it says "setpci") for further information. With this it is possible to toggle single USB ports with a simple shell script.
 +
* Connect the scanner over the network instead if it is supported.
  
 
===Slow startup===
 
===Slow startup===
If you encounter slow startup issue (e.g. xsane or scanimage -L take a lot to find scanner) it may be that more than one driver supporting it is available.  
+
If you encounter slow startup issue (e.g. {{ic|xsane}} or {{ic|scanimage -L}} take a lot to find scanner) it may be that more than one driver supporting it is available.  
  
Have a look at /etc/sane.d/dll.conf and try commenting out one (e.g. you may have epson, epson2 and epkowa enabled at the same time, try leaving only epson or epkowa uncommented)
+
Have a look at {{ic|/etc/sane.d/dll.conf}} and try commenting out one (e.g. you may have epson, epson2 and epkowa enabled at the same time, try leaving only epson or epkowa uncommented)
  
===Permission problem===
+
You can also try to comment out "net" driver, if there are no network scanners.
If you see your scanner only when doing {{Ic|sudo lsusb}} you might get it working by adding your user to {{Ic|scanner}} and/or {{Ic|lp}} group.
+
# gpasswd -a username scanner
+
# gpasswd -a username lp
+
This is reported to work on HP all-in-one models (e.g., PSC 1315 and PSC 2355).
+
  
'''Also you could try to change permission of usb device''' but this is not recommended, a better solution is to fix the Udev rules so that your scanner is recognized.
+
Your webcam might also be listed as scanning device and slow down detection at startup. To blacklist webcam, try commenting out all the lines in {{ic|/etc/sane.d/v4l.conf}}.
  
Example:
+
===Device busy===
  
First, switch to root and check connected usb devices with command 'lsusb'
+
{{Accuracy|The user should not need to be in the scanner group (see [[Users and groups#Pre-systemd groups]])}}
  
#[root@archlinux ~]# lsusb
+
If your USB device is listed with {{ic|scanimage -L}} but launching the test {{ic|<nowiki>scanimage pixma:04A9173E_11DAD1 --format=tiff > test.tiff</nowiki>}} always return the 'Device busy' error, you might try to add your username to the scanner group {{ic|usermod -a -G scanner yourusername}} then blacklist the usblp kernel module by writing {{ic|blacklist usblp}} in {{ic|/etc/modprobe.d/no-usblp.conf}} (it prevents usblp from loading to support scanning, not needed by either CUPS or xsane and related tools). Reboot to finish. [http://cromwell-intl.com/linux/canon-pixma-printer-scanner.html]
#Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
#Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
#Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
#Bus 003 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc.  
+
#Bus 003 Device 002: ID 04fc:0538 Sunplus Technology Co., Ltd
+
#Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
#Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
#Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard
+
#Bus 001 Device 002: ID 046d:0802 Logitech, Inc. Webcam C200
+
#Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+
#[root@archlinux ~]#
+
  
In our example we see scanner - ''''Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard''''
+
===Permission problem===
 +
 
 +
After systemd, the {{ic|scanner}} and {{ic|lp}} groups are deprecated. No need to add your user to those groups. See [[Users and groups#Pre-systemd groups]] for detail.
 +
 
 +
You can also try to change permissions of usb device but this is not recommended, a better solution is to fix the Udev rules so that your scanner is recognized.
 +
 
 +
First check connected usb devices with {{ic|lsusb}}:
 +
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
Bus 003 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc.
 +
Bus 003 Device 002: ID 04fc:0538 Sunplus Technology Co., Ltd
 +
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard  
 +
Bus 001 Device 002: ID 046d:0802 Logitech, Inc. Webcam C200
 +
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  
Now edit the file vi /lib/udev/rules.d/53-sane.rules and look for the first part of the ID number found previously and check if there is a line that also reports the second part of the number (model numer), in this example 2504. If not found change or copy a line and enter the idVendor and idProduct of your scanner, in this example it would be:
+
In our example we see the scanner: {{ic|Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard}}. Here {{ic|03f0}} is the ''vendorID'' and {{ic|2504}} is the ''productID''.
  
# Hewlett-Packard ScanJet 4100C
+
Now open {{ic|/usr/lib/udev/rules.d/49-sane.rules}} and see if there is there is a line with the vendorID and productID of your scanner. If there is not any, create the new file {{ic|/etc/udev/rules.d/49-sane-missing-scanner.rules}}, with the following contents:
  ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2504", MODE="0664", GROUP="scanner",
+
  ATTRS{idVendor}=="'''vendorID'''", ATTRS{idProduct}=="'''productID'''", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
  ENV{libsane_matched}="yes"
+
  
 
Save the file, plug out and back in your scanner and the file permissions should be now correct.
 
Save the file, plug out and back in your scanner and the file permissions should be now correct.
 +
 +
{{Accuracy|The scanner needs to be added to the right backend file, {{ic|hp4200.conf}} will not work for any scanner.}}
  
 
Another tip, is that you can add your device (scanner) in backend file:
 
Another tip, is that you can add your device (scanner) in backend file:
  
In example we add string ''''usb 0x03f0 0x2504'''' to file ''''/etc/sane.d/hp4200.conf''''
+
Add {{ic|usb 0x03f0 0x2504}} to {{ic|/etc/sane.d/hp4200.conf}} so it looks like this:
 
+
Now file looks like this:
+
 
+
$ cat /etc/sane.d/hp4200.conf
+
 
  #
 
  #
 
  # Configuration file for the hp4200 backend
 
  # Configuration file for the hp4200 backend
Line 226: Line 176:
 
  #usb 0x03f0 0x0105
 
  #usb 0x03f0 0x0105
 
  usb 0x03f0 0x2504
 
  usb 0x03f0 0x2504
 
===DBus problem===
 
If you get following problem:
 
arguments to dbus_connection_send() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c
 
 
Make sure the {{Ic|dbus}} user is in the groups {{Ic|lp}} and {{Ic|scanner}}:
 
$ groups dbus
 
dbus
 
# gpasswd -a dbus lp
 
# gpasswd -a dbus scanner
 
 
(Note that dbus must be stopped and started for the group changes take effect.)
 
 
Confirm dbus is running. See [[Daemons#Status_reporting]].
 
 
If it isn't, [[Daemons#Starting_manually|start it]]. You might want to [[Daemons#Starting_on_boot|start it at boot time]].
 
 
A session dbus alone seems to be insufficient for scanner operation.
 
 
===Epson Perfection 1270===
 
 
For Epson Perfection 1270, you also need a firmware named esfw3e.bin. It can be obtained by installing the Windows driver.
 
 
Modify configuration file of snapscan backend:
 
 
vi /etc/sane.d/snapscan.conf
 
 
Change the firmware path line with yours. :
 
 
<pre>
 
  # Change to the fully qualified filename of your firmware file, if
 
  # firmware upload is needed by the scanner
 
  firmware /mnt/mydata/Backups/firmware/esfw3e.bin
 
</pre>
 
 
And add the following line in the end or anywhere you like
 
 
<pre>
 
  # Epson Perfection 1270
 
  usb 0x04b8 0x0120
 
</pre>
 
 
You can get such code information (''usb 0x04b8 0x0120'') by "sane-find-scanner" command.
 
 
Also add such information lines in your libsane.usermap file to setup your privilage, like:
 
 
vi /etc/hotplug/usb/libsane.usermap
 
 
 
  #Epson Perfection 1270
 
  libusbscanner 0x0003 0x04b8 0x0120 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
 
 
Replug scanner, you have a working Epson Perfection 1270 now.
 
 
NOTE: I can scan image if I define the X and Y value, but without that error meassage occors like: "scanimage: sane_start: Error during device I/O", if anyone know why, please complete the section.
 
".
 

Latest revision as of 09:01, 17 November 2016

SANE (Scanner Access Now Easy) provides a library and a command-line tool to use scanners under GNU/Linux. Here you can check if sane supports your scanner.

Installation

Install the sane package.

Verification

Now you can try to see if sane recognizes your scanner

$ scanimage -L

If that fails, run the command again as root to check for permission problems. If that fails as well, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for /etc/udev/rules.d/sane.rules to recognize your scanner.

Now you can see if it actually works

$ scanimage --format=tiff > test.tiff

If the scanning fails with the message scanimage: sane_start: Invalid argument you may need to specify the device.

$ scanimage -L
device `v4l:/dev/video0' is a Noname Video WebCam virtual device
device `pixma:04A91749_247936' is a CANON Canon PIXMA MG5200 multi-function peripheral

Then you would need to run

$ scanimage --device "pixma:04A91749_247936" --format=tiff > test.tiff

Sane provides many special backend options for numerous scanner types. To see what these are for your device:

$ scanimage -A

Installing a scanner driver

Most scanners should work out of the box. If yours does not, see SANE/Scanner-specific problems for installation instructions.

Firmware

Note: This section is only needed if you need to upload firmware to your scanner.

Firmwares usually have the .bin extension.

Firstly you need to put the firmware someplace safe, it is recommended to put it in a subdirectory of /usr/share/sane.

Then you need to tell sane where the firmware is:

  • Find the name of the backend for your scanner from the sane supported devices list.
  • Open the file /etc/sane.d/<backend-name>.conf.
  • Make sure the firmware entry is uncommented and let the file-path point to where you put the firmware file for your scanner. Be sure that members of the group scanner can access the /etc/sane.d/<backend-name>.conf file.

If the backend of your scanner is not part of the sane package (such as hpaio.conf which is part of hplip), you need to uncomment the relevant entry in /etc/sane.d/dll.conf.

Install a frontend

Many frontends exist for SANE, a non-exhaustive list of which can be found on the sane-project website. Another way to find them is to use pacman to search the repositories for keywords such as "sane" or "scanner".

  • gscan2pdf — A GTK2-based GUI to produce PDFs, TIFFs or DjVus from scanned documents. It is also able to apply OCR in the process using different engines.
http://gscan2pdf.sourceforge.net/ || gscan2pdfAUR
  • Simple Scan — A simplified GUI that is intended to be easier to use and better integrated into the GNOME desktop than XSane. It was initially written for Ubuntu and is maintained by Robert Ancell of Canonical Ltd. for GNU/Linux.
http://launchpad.net/simple-scan || simple-scan
  • Skanlite — A simple image scanning application that does nothing more than scan and save images, based on the KSane backend.
https://www.kde.org/applications/graphics/skanlite || skanlite
  • XSane — A full-featured GTK-based frontend looking a bit old but providing extended functionalities.
http://www.xsane.org/ || xsane
Note: Scanning directly to PDF using XSane in 16bit color depth mode is known to produces corrupted files and a note in pacman output warns so. 8bit mode is known to work.

Network scanning

Sharing your scanner over a network

You can share your scanner with other hosts on your network who use sane, xsane or xsane-enabled Gimp. To set up the server, first indicate which hosts on your network are allowed access.

Change the /etc/sane.d/saned.conf file to your liking, for example:

# required
localhost
# allow local subnet
192.168.0.0/24

If you use iptables, insert the nf_conntrack_sane module to let the firewall track saned connections.

Now start/enable saned.socket using systemd. Your scanner is now available over the network. For more information, see saned(8).

Accessing your scanner from a remote workstation

Note: Some network scanners require a different approach. See SANE/Scanner-specific problems.

You can access your network-enabled scanner from a remote Arch Linux workstation.

First, specify the server's host name or IP address in the /etc/sane.d/net.conf file:

# static IP address
192.168.0.1
# or host name
stratus

Now test your workstation's connection:

$ scanimage -L

The network scanner should now also show up in any front-end.

Troubleshooting

See also: SANE/Scanner-specific problems

Invalid argument

If you get an "Invalid argument" error with xsane or another sane front-end, this could be caused by one of the following reasons:

Missing firmware file

No firmware file was provided for the used scanner (see #Firmware for details).

Wrong firmware file permissions

The permissions for the used firmware file are wrong. Correct them using

# chown root:scanner /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE
# chmod ug+r /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE

Multiple backends claim scanner

It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that does not do after all (the scanner will not be displayed by scanimage -L then). This has happend with older Epson scanners and the epson2 resp. epson backends. In this case, the solution is to comment out the unwanted backend in /etc/sane.d/dll.conf. In the Epson case, that would be to change

 epson2
 #epson

to

 #epson2
 epson

It may also be possible that the independant iscan epkowa backend interferes with your snapscan backend (epson scanners). You may get this error right after using the scanimage -L command. Starting the scanner app (like xsane) twice can also solve the problem. Otherwise check your /etc/sane.d/epkowa.conf for wrong configuations or remove the iscan package.

Communication via xHCI not working (older scanner models)

Some older scanner models do not work when connected via an USB3 port. This is not a big issue if USB2 ports are available. If only USB3 ports are available, there are several ways to resolve the issue:

  • Disable xHCI via BIOS/EFI. eHCI will consequently be used and communication with the scanner will work. On the downside, USB3 speed can not be reached on any port.
  • On (some) intel chipsets the 'setpci' command can be used to route specific usb ports to either the xHCI or the eHCI controller. See Here and Here (scroll down to where it says "setpci") for further information. With this it is possible to toggle single USB ports with a simple shell script.
  • Connect the scanner over the network instead if it is supported.

Slow startup

If you encounter slow startup issue (e.g. xsane or scanimage -L take a lot to find scanner) it may be that more than one driver supporting it is available.

Have a look at /etc/sane.d/dll.conf and try commenting out one (e.g. you may have epson, epson2 and epkowa enabled at the same time, try leaving only epson or epkowa uncommented)

You can also try to comment out "net" driver, if there are no network scanners.

Your webcam might also be listed as scanning device and slow down detection at startup. To blacklist webcam, try commenting out all the lines in /etc/sane.d/v4l.conf.

Device busy

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The user should not need to be in the scanner group (see Users and groups#Pre-systemd groups) (Discuss in Talk:SANE#)

If your USB device is listed with scanimage -L but launching the test scanimage pixma:04A9173E_11DAD1 --format=tiff > test.tiff always return the 'Device busy' error, you might try to add your username to the scanner group usermod -a -G scanner yourusername then blacklist the usblp kernel module by writing blacklist usblp in /etc/modprobe.d/no-usblp.conf (it prevents usblp from loading to support scanning, not needed by either CUPS or xsane and related tools). Reboot to finish. [1]

Permission problem

After systemd, the scanner and lp groups are deprecated. No need to add your user to those groups. See Users and groups#Pre-systemd groups for detail.

You can also try to change permissions of usb device but this is not recommended, a better solution is to fix the Udev rules so that your scanner is recognized.

First check connected usb devices with lsusb:

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc. 
Bus 003 Device 002: ID 04fc:0538 Sunplus Technology Co., Ltd 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard 
Bus 001 Device 002: ID 046d:0802 Logitech, Inc. Webcam C200
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In our example we see the scanner: Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard. Here 03f0 is the vendorID and 2504 is the productID.

Now open /usr/lib/udev/rules.d/49-sane.rules and see if there is there is a line with the vendorID and productID of your scanner. If there is not any, create the new file /etc/udev/rules.d/49-sane-missing-scanner.rules, with the following contents:

ATTRS{idVendor}=="vendorID", ATTRS{idProduct}=="productID", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Save the file, plug out and back in your scanner and the file permissions should be now correct.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The scanner needs to be added to the right backend file, hp4200.conf will not work for any scanner. (Discuss in Talk:SANE#)

Another tip, is that you can add your device (scanner) in backend file:

Add usb 0x03f0 0x2504 to /etc/sane.d/hp4200.conf so it looks like this:

#
# Configuration file for the hp4200 backend
#
#
# HP4200
#usb 0x03f0 0x0105
usb 0x03f0 0x2504