Apr 112013

As we have posted earlier, we own an old CanoScan LiDE 30. We are very satisfied with this scanner – but unfortunately it does not work on newer versions of Windows (e.g. Windows 7 64 bit, Windows 8) – Canon “forgot” to release updated drivers.

Raspberry Pi networked scanner sharing

A Raspberry Pi is perfect for a small, low volume server application. Today, we have put together all the pieces necessary to use it to attach the Canon scanner to our network, and scan from Windows once again.

BTW: It looks as though the Fujitsu ScanSnap 1300i might also be supported by SANE. This is the replacement scanner for the Canon flatbed scanner we bought – but it can’t scan books, for instance.

Step by step setup guide:

This guide is written for Raspbian. We have tested it with the latest Raspbian version currently available (2013-02-09).

Get the required packages:

sudo su
aptitude update
aptitude install xinetd sane-utils

xinetd is the Internet superdaemon which will start saned, the “Scanner Easy Access Now” daemon when a network connection to it’s port is opened (saned can’t do that on it’s own).

sane-utils contains the saned. (On Archlinux the package is called simply “sane”)

Raspbian automatically sets up the group saned and the user saned for you. It also adds the user saned to the group scanner.

Configure /etc/default/saned so it will start automatically (RUN=yes):

# Defaults for the saned initscript, from sane-utils

# Set to yes to start saned

# Set to the user saned should run as

Start saned, and test whether the scanner is recognized. Ideally you should do this as user saned, to see if all access rights for saned are setup correctly. Your scanner should naturally be attached to the Raspberry Pi. If it draws its power through USB, we recommend to use a powered USB hub.

root@raspberrypi:/home/pi# /etc/init.d/saned start

root@raspberrypi:/home/pi# su -s /bin/sh - saned
No directory, logging in with HOME=/

$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 008: ID 04a9:220e Canon, Inc. CanoScan N1240U/LiDE 30
Bus 001 Device 007: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business

$ scanimage -L
device `plustek:libusb:001:008' is a Canon CanoScan N1240U/LiDE30 flatbed scanner

$ exit


I have included the # and $ prompt in this listing, so you can distinguish between commands the root user (#) issues and the saned user issues ($)

If you see your scanner here, great. If not – have a look at the documentation and further reading links we will provide at the end of this article.

The USB scanner itself is plug & play – you can attach it to the Raspberry Pi when you feel like scanning, and remove it after you have finished.

Prepare network sharing of the scanner

root@raspberrypi:/etc/xinetd.d# cat /etc/services | grep sane
sane-port       6566/tcp        sane saned      # SANE network scanner daemon

You should see the sane-port line as in the listing. If it is not in there, add it.

root@raspberrypi:/# cd /etc/xinetd.d

root@raspberrypi:/etc/xinetd.d# touch sane-daemon

root@raspberrypi:/etc/xinetd.d# which saned

root@raspberrypi:/etc/xinetd.d# nano sane-daemon

This will set up the XInet configuration. Please use the following configuration for the /etc/xinetd.d/sane-daemon file:

service sane-port
              socket_type = stream
              server = /usr/sbin/saned
              protocol = tcp
              user = saned
              group = saned
              wait = no
              disable = no

Note that we used the output from “which saned” in the configuration above. If it is different for you – e.g. on Archlinux – adjust accordingly.

Set up saned to accept connections from your network by editing /etc/sane.d/saned.conf:

# saned.conf
# Configuration for the saned daemon

## Daemon options
# [...]
# data_portrange = 10000 - 10100

## Access list
# [...]
# The hostname matching is not case-sensitive.



# [...]

Please adjust the subnet specification to your network architecture. You can also explicitly specify single IPs. If you do not edit this file, SaneTwain will hang when contacting your Raspberry Pi scanner server.

Now you can reboot the Raspberry Pi (sudo reboot), and continue to the set up on the Windows side.

Setting up Windows to access the SANE network scanner

We have tested with Windows 7 64 bit & Windows 8 64 bit.

Windows users use “TWAIN” drivers. Luckily, there is an application, which will create a bridge between TWAIN and SANE on the network. The author claims it does not work for 64 bit Windows, but it did work for us. Please report back in the comments about your success / failure stories on different Windows versions.

Download SaneTwain here.

SaneTwain Setup


Just enter your Raspberry Pi IP (if you do not know it, “ip addr show” will show you it’s network setup) as the hostname. Port and Username can stay the way they are. Look through the other settings, if you want to. The Mail tab, for instance, offers the possibility to set up an Evernote account you want to scan to.

Before you try to use the TWAIN driver SaneTwain offers, you should set up the hostname using the way we just described (by starting ScanImage.exe).


Now you’re set up for scanning. Use the “preview” button to acquire a preview, and the “scan” button to save the selected area to a PNG (it will be scanned with better quality, of course). The resolution can be set, also other options.

Wait until the scanner is finished with the preview and has repositioned itself, before you hit the “scan” button.


The TWAIN driver works for us, too. (Tested with IrfanView) – this is Windows 8 64 bit. No special tweaks were applied.

Setting up Linux to scan from the network scanner

If you have a Linux box, you can use basically any SANE Frontend to scan using the network.

You need to add the network scanner to a local SANE installation.

Edit /etc/sane.d/net.conf and add the IP of your server. You can specify multiple servers.


Test with scanimage –L once again, and after a while you will see your network scanner showing up.


Try XSane. Noteworthy is also gscan2pdf which will convert scanned pages to multipage PDFs, and even OCR them for you!

Of course you should be able to scan from another Raspberry Pi on your network, or even the Internet.

simple-scan is a frontend for SANE.

Further Reading & Links




We used the following how-tos in building this tutorial. Thanks, guys!

  • Peter

    Great tutorial! Exactly what I needed! Thank you very much!

  • Révész Ádám

    Great! I have the same hardware, and my question is: Do you use powered usb hub or just simply plug the scanner?

    • pi3g

      Definitely go for the powered USB hub, if your scanner has no power supply of its own. If it DOES have its own power supply, it should be safe to plug it directly into the Pi.

  • Révész Ádám

    I have done the same, but when i type scanimage -L on my ubuntu, it doesn’t find the network scanner.

  • Révész Ádám

    Fixed it. I misstyped the IP in the saned.conf. Great job! Thanks! :)

    • pi3g

      Glad that you could find the error quickly :-)

  • lingonsylt

    Hi, seems i’ve no problems installing sane and getting it to recognize my scanner. However (running win 7 x64 ) ScanImage.exe encounters problems. First, i can’t connect to host, there shouldn’t be anymore than the ip i need to adjust in ScanImage.exe?
    I also get a “Access violation at adress 004056A0 in module ScanImage.exe Read of adress 00000004 ” when i try to close ScanImage.exe. This is maybe the 64-bit error he’s referring to on the SaneTwain homepage? Hopefully i can test pretty soon with a win 8 system and see how it works there

    • pi3g

      yes, the access violation is observed when closing the application.

      And, yes, you should only change the IP. Maybe there are some Firewall problems, or configuration problems on the Raspberry side? If you want to rule out the configuration problems, you could try setting up a virtual machine with VirtualBox, and e.g. Ubuntu, and test the connection with it.

      And by all means avoid 8 😉

      • lingonsylt

        Ok, now i had time to try on another laptop in the house (some ’09 Asus on Win7 x64), SaneTwain worked as a charm (with firewall on). Didn’t get the Access violation error.. on exit either. For future googlers: the computer in my earlier post is Lenovo Thinkpad Edge E530 from last year. The raspberry is connected to the home LAN wireless as is the two laptops, which both run the standard win firewall. Both also has SP1 installed. Hardware is most likely not the cause here, but manufacturers standard settings could be, i suppose i have to dig down into my firewall settings on the Lenovo. Anyway, will update here if i get it to work or find something else.

  • pi3g

    Please note, ScanImage WILL work on Windows 8 (it might run into crashes and things like this, though – use Task Manager to terminate it in this case). ScanImage has problems with large image files (we are talking 10+ MB) stored in the same directory where you want to store your scan into – it will HORRIBLY crash, and even the task manager won’t be able to help you – as it will be locked itself … -> the only solution is to remove the big files or rename them (.png to ._png for example) temporarily.

    Also, I recommend not to run any tasks (i.e. preview or scan) until ScanImage has spoken to the Raspberry and the scanner, and determined the available resolutions – this should help you avoid those “division errors”.

  • GiulianoFavro

    I’ve tested sanetwain under windows 7 32 and 64.

    Under win7-32 scanimage works correctly if is launched as stand-alone application. But if i try to use it via a TWAIN enabled application, when i try to select sanetwain as source, scanimage gui is not displayed….

    Under win7-64 I have confugured the IP. Scan image accessed the server and display the available resolutions and modes, but nothing more. Any other operations generates errors.

    Now I’m trying the new (and beta) WIASANE. frontend….

    • pi3g

      Share your results about WIASANE with us, please. TIA

      You might want to experiment with compatibility settings, btw. … I am not sure what causes the software to work for some people, and break for others ….

      • GiulianoFavro

        I have experimented some compatibily setting (win 2000, win xp…) but without results.

        For WIASANE test is in progress, for the moment seems to work correctly.

        I have purchased the raspi for replace a print server wifi (digicom), because it is not compatible with win 64 bit and don’t support linux.

        this print server works making a virtual USB port and connecting this virtual USB port to the fisical port on it.
        The system is like to http://usbip.sourceforge.net/.

        For the moment i’m testing SANE/CUPS, but the USB/IP are the second choice.

  • Pingback: Using Raspberry Pi as a print server « 1001 ways to blink a LED …()

  • Bernd Bausch

    My raspberry has a similar function as low-performance server and is also used to revive an ancient scanner, Canon FB636. This device uses the USB port as power source, and it didn’t work before I attached it to a powered USB hub.

    One slight but crucial configuration setting is different on my server. I needed to tell xinetd to run saned as group “scanner”, otherwise it wouldn’t have write access to the device file /dev/bus/usb/001/008. This is necessary even for retrieving the list of attached scanners.
    Alternatively, I could have configured udev to use the group “saned” for this device file; the line I would have had to change in /etc/udev/rules.d/60-libsane.rules or /lib/udev/rules.d/60-libsane.rules is almost at the end of the file: ‘ENV{libsane_matched}==”yes”, RUN+=”/bin/setfacl -m g:scanner:rw $env{DEVNAME}”‘

    The only problem that remains is that scanimage on my Windows-7 32-bit PC sometimes throws errors, locks up and can only be stopped from Task Manager. I will try WIASANE.

  • Martin Bart

    After few hours, I got this working with Epson perfection 660.

    I had to copy the firmware-file (TAIL_061.BIN, copied from windowstwain_32, maybe also present on installation disc, (on the SANE-website TAIL_058.BIN is mentioned)) in the right folder (/usr/share/sane/snapscan/ (this folder didn’t exist)), and I had to edit the file /etc/sane.d/snapscan.conf as follows:

    firmware /usr/share/sane/snapscan/TAIL_061.BIN

    besides this, SaneTwain works under windows7 64 bit, but if no connection strange errors occur

  • JoeThePimpernel
    • for 64 bit Windows 7, too?

      • JoeThePimpernel

        I got the idea of trying the 32-bit driver from a post that said the 64-bit worked for them.

  • Jake M

    I’m having a bit of trouble getting my HP DeskJet 1050 J410 All-in-one to scan via sanetwain on my Win7x64 notebook. The IP addr and configs are all correct, but I get a notification that no devices were found on the backend.

    This is probably because if I login to the backend and type scanimage -L, it doesn’t find any scanners. However, from the bash terminal, scanimage -L finds the printer just fine, and I can actually scan images from it without trouble.

    Any idea how to fix that?

  • Tanner Blomster

    I just tried this tutorial on Raspbian LITE with no GUI. I had to manually enable the the saned socket by using sudo systemctl enable saned.socket

  • Oleksa Stasevych

    Hi! I scan on my SCX-3200 using NAPS2 through SaneTwaing and saned installed on my OpenWrt router. However, usually the NAPS2 scans 2 times (not once, as it should be). The last one is saved. What could be wrong with my settings?

  • Rostislav Liber

    Hi! My Canon I-Sensys MF4330d is able to print thanks to this article but it is not able to scan. Raspbian can see the scanner but Windows computers in my network can not see the scanner. What could be wrong ?

Optimization WordPress Plugins & Solutions by W3 EDGE