How to Use CHIP Board as a Linux Printer & Scanner Server

We have a Canon Pixma MP250 series multi-function USB printer connected to a Windows 10 laptop at home, and for several years, I had no problems printing from my Ubuntu computer to that printer. However, this setup recently stopped to work, and whatever I would do, printing would never start from my Ubuntu PC, even though the file was (allegedly) successfully transfered to the Windows 10 laptop connected to the printer. So I decided to setup my own printer server, as well as a scanner server since it’s a multi-function printer, using one of the boards from my collection. As I opened my cabinet, I wondered whether I would use an Orange Pi board, Raspberry Pi board, or Nano Pi board, but I needed WiFi since there’s no Ethernet in the office where the printer is located, and I found that Next Thing CHIP board was the ideal candidate as it comes with a USB port, built-in WiFi, and storage, and I paid just under $15 in total to have it shipped to South East Asia. So I’ll report my experience setting up CUPS printer server and SANE (Scanner Access Now Easy) on the board. Those are generic instructions working on Debian / Ubuntu, so they will other work for Raspberry Pi, Orange Pi, Nano Pi board, etc… via WiFi or Ethernet.

Click to Enlarge

While I reviewed PocketCHIP last year, I had yet to actually use a standalone CHIP board. I did not want to connect it to a display, so I used some of the “Headless CHIP” instructions to set it up. I used a micro USB to USB cable to connect it to my computer, and use minicom to connect to /dev/ttyACM0 with 115200 8N1 settings, and yould access the command line with chip / chip credentials:


Then I configured WiFi from the command line, by first listing SSIDs:


and connect to my the closest access point from the list above:


The next step is to check whether CHIP has successfully connected to the wireless router with the command:


That’s all good. The micro USB to USB cable works, but it was unstable in my case, with the two LEDs something going dark due to power issues, which means CHIP consumes more power than NanoPi NEO + armbian, as I’ve been running it from a USB port for several weeks… CHIP ships with Debian with XFCE4, so it might be a good idea to remove the corresponding packages:


Alternatively, you could flash Debian without GUI based on the instructions here.

So since WiFi had been setup, I connect the board to a 5V/2A power supply, and logged it to the board with SSH, and everything became much more stable. I received the board in the middle of the last, so I updated the system first:


Now that the initials setup was done, I could start the printer server setup, with the steps below greatly inspired from instructions on Next Things forums.

By default CHIP board hostname is  “chip”, so I changed it to something more specific by editing /etc/hostname and /etc/hosts, and replacing chip with CNX-PRINTER. You’ll need to restart avahi-daemon for the changes to take effect:


At this point, we can access the board with CNX-PRINTER.local instead of using the IP address or chip.local. So I could SSH to the board with:


If you are doing this from a Windows machine, you’ll need mDNS (Bonjour) installed for .local addresses to be recognized, and one way is to simply install iTunes.

The next step is to install CUPS server:


CUPS will start automatically, and the web interface will be accessible from the locahost interface on port 631, but since I have not connected a monitor, this would not be convenient, so we can enable remote management with:


At this point I could access the web interface by going to http://cnx-printer.local:631/ in my preferred web browser.

Click to Enlarge

If you have not already done so, you may want to connect the printer to the board’s USB port, and power it on at this stage. Now we can click on Adding Printers and Classes.

Click to Enlarge

and then click on Add Printer, which will switch to an HTTPS connection with a self-generated certificate, so you may get a warning, but you can safely add the certificate to carry on. You’ll then be asked for a username and password. Don’t login with chip user, but instead root. The default password is also chip, so you may want to change that in the board.

Click to Enlarge

The next page is called “Add Printer”, and my printer was automatically detected. So I selected “Canon MP250 series (Canon MP250 series)”, and clicked on Continue button.

Click to Enlarge

You can add some location information on the next page, and also remember to tick Share This Printer, before clicking on Continue. Note that if you’re going to use Windows clients, you may want to note the Printer Name, in my case Canon_MP250_series, as we’ll need it.

Click to Enlarge

The next page will show a list of models, but in my case everything was already selected, to I just had to click on Add Printer to carry on with the setup.

Click to Enlarge

Finally, you’ll be asked to define some default options, but again I did not change anything there, and clicked on Set Default Options to complete the setup.

Click to Enlarge

The next step was to fo the Printers in Ubuntu to see what I had to do to configure the network printer, and the answer is: Nothing at all. The new networked printer was automatically detected and added to the list of printers.

Click to Enlarge

I went ahead, and clicked on Print Test Page, and it worked beautifully, although it started a little slower than usual.

But the printer server won’t last long if it cannot work with my Wife’s Windows 10 laptop, so I followed some instructions on ArchWiki. First I went to Control Panel -> Hardware and Sound -> Devices and Printers, and clicked on Add a printer.

Click to Enlarge

In the next window, you’ll need to select “Select a shared printer by name“, and type the printer name.

Click to Enlarge

The URL should look like http://<hostname>:631/printers/<printer_name>, where <hostname> is the IP address or hostname, and <printer_name> the printer name shown in CUPS web interface. Once this is done we can click on Next, and you’ll be asked to select Windows drivers for your printer, once it is done you’ll get a confirmation the installation was successful.

Click to Enlarge

The printing server installation went pretty smoothly, and worked with both Linux and Windows clients. But my printer is also a multifunction scanner, so I’d also need to enable scan function too. I adapted instruction @ http://xmodulo.com/usb-network-printer-and-scanner-server-debian.html and SaneDaemonTutorial on Ubuntu.com using SANE. I did manage to make it work, but only once. I guess there may be a permission or systemd issue, and I’ll update the post once I find a solution. In the menatine, I’ll still report what I’ve done below.

Before we try the scanner over the network, we need to make sure it works locally inside the CHIP board. SANE is probably already installed, but to make sure we can install the following packages.


The following command will try to find scanners, and it could find my Canon MP250 series scanner connected via USB:


Another way to check this out is to use the following scanimage command line:


We can now try to scan one image:


The scanning started shortly after, and we’ve got our scanned file:


So far, so good. SANE is is working…

We can now configure saned (SANE daemon) to be able to access the scanner from the LAN. First we need to create /etc/systemd/system/saned.socket file as root with:


Please note that this differs from the instructions on Ubuntu as there seem to be an error. The line:


does not seem right, and would cause systemdctl to report a “bad message”, and the line at the top are ignored by systemd. I tried to edit the Wiki, but I could not due to a gateway error on the site.

We also need to create a separate file called /etc/systemd/system/[email protected] with:


We als oneed to enable access to computer on the LAN, by editing /etc/sane.d/saned.conf:


The exact IP address subnet will depend on your own local network configuration. We can now enable saned (so that it starts automatically), and start it as follows:


We can check the status with:


So everything appears to be going smoothly. We can now configure clients. Let’s start with a Linux client (my Ubuntu computer) to make sure it work. We can first install xsane, a graphical interface for saned:


And then configure sane to connect to our SANE daemon by editing /etc/sane.d/net.conf, and adding the hostname or IP address of our server, and enabling time out:


Time to start xsane from the command line or dash for some scanning, except it did not work for me with the window below showing up each time after a few seconds.

So I spent a few hours studying about this problem, reading articles online, capturing packets with Wireshark, and trying the same thing on a Windows client with SaneWinDS. I could not find any solution in any articles, but I could see packets exchanged between the server and client, and SanWinDS could connect the CHIP board SANE daemon, but would not find any device/scanner. I could not find anything relevant in /var/log. or dmesg either, so I tried to mess up with the config files, and changed [email protected] to use User=chip instead of User=saned, and success! I could start xsane, and scan a document.

Click to Enlarge

So I rebooted, the board to see what would happen, and sure enough it went back to the “no devices available” window. I tried to change that back to User=saned, and reboot, and then try again with User=chip, but I had no luck in all of my subsequent attempts, and ran out of time for the day… The solution is probably close, and I’ll update the post once/if I found out what the problem is.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
15 Comments
oldest
newest
tkaiser
tkaiser
7 years ago

Two small notes:

1) for inexperienced readers the use of ‘nmtui’ is more straightforward than dealing with nmcli. You can then choose from a single dialog the SSID you want and enter logon credentials as well as settings (IP config for example)

2) Another approach to deal with USB accessible multi function devices is an USB redirector. Armbian ships with one since ages but this should work on the CHIP too: https://github.com/igorpecovnik/lib/blob/master/extras/usb-redirector.sh

tkaiser
tkaiser
7 years ago

BTW: Isn’t there an ‘apt autoremove’ missing after uninstalling libxfce4util-common package to reclaim used but oboslete disk space? Would be interesting to compare ‘du -h’ output before/after.

willmore
willmore
7 years ago

Great writeup. I’m going to need to do this soon with a printer in my house. I’m currently using a WAP with USB print server, but it was damaged in a recent lightning strike and is acting strangely.

I’ll probably use an Orange Pi Zero instead due to availability, though.

tkaiser
tkaiser
7 years ago

@willmore If you want to replace a ‘dumb print server’ you should keep in mind that the variant Jean-Luc showed is somewhat different. As soon as you add a ‘driver’ in CUPS (assign a PPD) also ‘filters’ are applied. In the above example you can then send PostScript or PDF as spool type and the CUPS host will then render the page’s contents into bytemaps and then translates them in the PDL the printer knows (PDL — page description language). If you want the ‘dumb print server’ behaviour you have to ensure that you’re choosing ‘raw’ as printer type (no… Read more »

tkaiser
tkaiser
7 years ago

@Jean-Luc Aufranc (CNXSoft): As already explained above with your setup filtering of print jobs happens on the CHIP now (which is a rather bad choice due to its single core A8 CPU). Using native drivers in Windows spool jobs are interpreted as raw but from your main Ubuntu host you’re currently sending either PostScript or PDF (don’t know whether Linux still uses PostScript or managed to switch to PDF in the meantime ‘already’) and let the processing happen on the CHIP. You might test some large print jobs and then replace ‘Remote Printer’ with the PPD available on your machine… Read more »

Goran
Goran
7 years ago

@tkaiser So what about network printers who supports: Language Simulation (IBM PPDS, PCL 5E, PCL 6, PostScript 3) and Remote Management Protocol like HTTP, IPP Network / Transport Protocol LPR/LPD, TCP/IP. I have CUPS installed on my router and he advertise printing abilities with avahi(shared option), after version 2(i think) he advertise some parameters (“URF=DM3” “pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf) which needs iPhone to print via AirPrint. The network printer is added as “IP”:9100( so non spooling printer) to CUPS. So if it true about RAW things like you wrote before, is it possible to somehow offload not just Windows or Linux machines but… Read more »

tkaiser
tkaiser
7 years ago

@Goran No idea about Android but iOS always spools PDF since this is internal basis of everything display in both iOS and OS X (though iOS uses the MIME type image/urf and not application/pdf). So unless your printer is capable of native PDF processing filtering has to happen on the CUPS host. Two options possible: 1) Standard way using default CUPS filter chain: PDF will be rendered to CUPS’ raster format (either pdftoraster on Linux/UNIX/*BSD or cgpdftoraster on OS X). Then this bytemap will be wrapped into the final PDL (PCL5e, PCL6 and PostScript all contain high level graphic objects… Read more »

willmore
willmore
7 years ago

@tkaiser
Understood. It’s a printer that CUPS can’t speak to anyway and the only available driver is x86, so I have no choice to make it a raw queue.

On the plus side, it was absurdly cheap, uses very inexpensive toner, and has already outlived a print server. 🙂

Drone
Drone
7 years ago

Make sure you firewall that CHIP Board print server! Connected printers are the next big target after surveillance cameras when it comes to crappy IoT device DDoS BotNet attacks. See this:

150,000 printers “pwned”…

http://www.twit.tv/shows/security-now/episodes/598

tkaiser
tkaiser
7 years ago

Drone : 150,000 printers “pwned”… BS! 150,000 printers were used to print something ‘unauthorized’. That’s a little difference isn’t it: https://www.bleepingcomputer.com/news/security/a-hacker-just-pwned-over-150-000-printers-left-exposed-online/ (check especially the last link there which explains a bit more about state of printer security). So while the suggestion to prevent printers being accessed from the Internet is good (and pretty obvious BTW) and especially PostScript printers can be considered broken by design from a security PoV due to some design principles as soon as a modern CUPS print server is put in front of the device the attack surface of most affected printers is already minimized. CUPS… Read more »

Goran
Goran
7 years ago

@tkaiser
“but iOS always spools PDF since this is internal basis of everything display in both iOS and OS X (though iOS uses the MIME type image/urf” you are right it is image/urfm, when you mean that on internal basis of everything display in both iOS is PDF you mean everything what is send to printer or where else?

and can you explain a little bit more use of ghostscript, gutenprint and foomatic type of drivers(openprinting-cups-filters)?
For my setup, i add this Printer as PPD, and –with-pdftops=gs i think that i should change it to pdftops…

tkaiser
tkaiser
7 years ago

@Goran In iOS applications just ‘draw’ graphic objects on a canvas be it the display or a printer. The whole graphic subsystem is based on PDF so that’s what you get when printing too. It’s a bit hard to ‘explain a little bit more’ regarding the many different options to filter incoming print jobs. Maybe the most important information is that information you find on the web is mostly outdated as usual (especially mentioning foomatic). Just stay with defaults (AFAIK CUPS’ own pdftops is still based on Poppler lib) and in case the printer isn’t PostScript capable then let CUPS… Read more »

emk2203
emk2203
7 years ago

http://superuser.com/questions/985254/installation-of-saned-with-systemd-no-inetd-or-xinetd-saned-refuses-connecti sounds very similar to the problems you have. Maybe it’s related. I think that the sane versions that your Debian uses are old enough to show similar issues.

Amelia Ryan
Amelia Ryan
6 years ago

got a cable with my new computer and hooked it up to my computer. Iit worked right away installing the drivers to my Laserjet 5. However it is so slow. I do PDF tax returns and 16 pages takes more than an hour. The exact same document from the old computer to the same printer takes a couple of minutes.

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...