Archive

Posts Tagged ‘how-to’

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

February 19th, 2017 10 comments

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/saned@.service 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 saned@.service 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.

CHUWI LapBook 14.1 Windows 10 Firmware, Drivers, and BIOS

February 13th, 2017 No comments

In case you’ve installed another operating system like Ubuntu on CHUWI Lapbook 14.1 laptop, and want to re-install Windows 10, CHUWI has released Windows 10 firmware, drivers, and LapBook 14.1 “BIOS” in their forums.

So I’ve re-installed Windows 10 on the laptop using the Windows 10 image. You’ll need to download the 8 files CHUWI LapBook 14.1 Windows.part1.rar to CHUWI LapBook 14.1 Windows.part8.rar, and after extracting them you should get a “CHUWI LapBook 14.1 Windows” directory with all necessary files to reinstall Windows.

The files take 8GB, so it may not fit on all 8GB flash drives, and you may need to use a 16GB or greater drive. I just copied the files to an 64GB flash drive formatted with NTFS, insert the drive into the USB 2.0 port of the laptop, and I could start the installation process at boot time.

Click to Enlarge

However, it quickly failed as it tried to install Windows 10 on the flash drive itself:

Virtual Disk Service Error:

The operation is not supported on removable media.

The system cannot open the device or file specified.

Then I remember I had to set the USB drive label to WINPE for this to work. So I have to repartition the drive, format it to NTFS, set the label WINPE, and copy the files again. I reinserted the drive into the laptop, and update started successfully and went much further this time.

Note that by default CHUWI LapBook 14.1 boots from USB first, but if you have changed the settings in the BIOS, you’ll have to press F7 at boot time in order to select the drive. The installation went ahead, and after a while the laptop shutdown. I removed the USB drive, and pressed the power button to carry on with the installation.

Click to Enlarge

At this point System Preparation Tool 3.10 windows pops up, and I just clicked on OK which rebooted the laptop again, and brought me to the usual Windows 10 setup wizard where you select the language, WiFi network, setup and account, etc…

I just went through it as usual, and everything works.

If you have one of the earlier model, and your BIOS is older than version “A2W6_NA14.012”, you may to upgrade the BIOS by downloading “LapBook 14.1 BIOS 20161230.zip” and extracting the files to a USB flash drive formatted with FAT32/NTFS, insert it in the laptop, and boot it to complete the update.

How to Upgrade to Linux 4.8 in Ubuntu 16.04.2

February 13th, 2017 14 comments

I had read from several news sources that Ubuntu 16.04.2 would come with Linux 4.8. My system was upgraded from Ubuntu 16.04.1 to Ubuntu 16.04.2 this week-end, but I still had Linux 4.4.

So I wondered why that was, and eventually found my answer on Reddit thanks to EndofLineLF user:

If it isn’t a new 16.04.2 installation then you won’t have newer kernel.

If your install started as 16.04 or 16.04.1 then with all updates installed “lsb_release” will display 16.04.2 as version because that’s what you have.

The switch to HWE (Hardware Enablement Stack) was never automatic. So if you want newer kernel you have to install it manually.

https://wiki.ubuntu.com/Kernel/RollingLTSEnablementStack#Packages-1
sudo apt-get install –install-recommends xserver-xorg-hwe-16.04

This will also install the new HWE kernel because it is recommended for that package.

Upgrading to the new kernel is completely optional, and Linux 4.4 will still get security updates, but I did it anyway, since I had an issue with the current Linux 4.4.62 kernel, although a fix with the next 4.4.63 release later this month. Anyway, I went ahead with:

After a reboot, I could confirm linux 4.8.0-34 kernel was installed:

If you run a Ubuntu 16.04 server installation, and want to upgrade to Linux 4.8, you may want to instead run:

One important note: If you switch from Linux 4.4 (GA) to Linux 4.8 (HWE), you’ll lose support for Canonical Livepatch Service.

Review & Quick Start Guide for Khadas Vim Pro Development Board with Ubuntu 16.04

February 11th, 2017 32 comments

Khadas Vim is the only Amlogic S905X development board I’m aware of. There are 4 or 5 versions of the board, but currently only two models are sold: Khadas Vim with 8GB flash and single band WiFi + BLE 4.0, and Khadas VIM Pro with 16GB flash, and dual band WiFi + BLE 4.2. SZWesion, the company behind the board, has sent Khadas Vim Pro for evaluation. Today, I’ll take a few pictures of the board and its accessories, and report my experience playing with Ubuntu 16.04.2 on the board. They’ve also released Android, LibreELEC, and dual boot Android/Ubuntu (for Vim Pro only) images, which you can find in the firmware resources page.

Khadas Vim Pro Unboxing and Photos

My parcel included Khadas package that looks like a book, an HDMI cable, and the same IR remote control sent with GeekBox, the first board made by the company, and powered by a Rockchip RK3368 processor.


You can indeed open the package like a book, and you’ll find the board and a USB to USB type C cable inside, as well as some basic specifications.

Click to Enlarge

You can verify you’ve got the right model on that back of the package which shows the memory and storage, in my case 2 GB + 16 GB.

The board comes with a neat acrylic case with opening for headers and ports. The top of the board features a 40-pin header, the Amlogic S905X processor (no heatsink), two RAM chips, the eMMC flash, the wireless module (AP6255), and most ports with two USB 2.0 ports, a USB type C port, HDMI 2.0a, and Fast Ethernet. There’s also a separate header close to the USB-C port giving access to Vin in case you don’t want to power your board through USB.

Click to Enlarge

There’s also 2-pin battery connector on the left of the board for the real-time clock (RTC). The bottom side of the board includes two more RAM chips, and the micro SD slot.

Click to Enlarge

Power, “function” and reset buttons can also be found on the side of the board, and there’s an IR receiver on the right of the 40-pin header.

Click to Enlarge

Ubuntu 16.04 on Khadas Vim (Pro)

While you can download the firmware on the “Firmware Resources” page, I recommend you check the Announcements & News section on the forums, as they normally include a changelog and some tips to configure your board. An Ubuntu 16.04 + XFCE image was released last month, but the company uploaded a Ubuntu 16.04.2 server image yesterday, so that’s the one I’m going to use today. A new Ubuntu 16.04 + XFCE image with better graphics support will be released sometimes next week.

My plan is to do the update in my Linux computer. The firmware is distributed through Mediafire, so you’ll have to download it through your web browser. I also downloaded  Vim_Uboot_170121.7z on the Firmware Resources pge since it’s needed for the SD card update method. Once we’ve got the firmware and U-boot binaries we can extract them with 7z.

Now insert the micro SD card inside your computer, find the device with lsblk, and check if it has more than one partition. Replace /dev/sdX with your own device.

If it has no partition or more than one, you’ll need to change the partition table using tools like fdisk, or gparted. The instructions provided on Khadas website are basically the same as I wrote in the post “How to Create a Bootable Recovery SD Card for Amlogic TV Boxes“.

Mount the partition, for example by removing and re-inserting the micro SD card into your computer, and copy two files needed for update:

Eject the micro SD card:

Now connect your board with the cables would want to use (e.g. Ethernet, HDMI. etc…), and possibly connect a USB to TTL debug board to access the serial console in case of errors. I also connect a USB hub with my RF dongles for air mouse, and a USB keyboard.

Click to Enlarge

The board comes pre-loaded with Android 6.0.1 with Linux 3.14, so you can connect the power first to make sure the board is working properly. Note that you’ll need to provide your own USB power supply. I used a 5V power supply, and not a fast charger found in some phone and starting at 12V. Now we can insert the micro SD card we’ve just prepared into the board, and boot into Upgrade Mode by keeping pressing on the power button (closest to the 40-pin header), pressing a short time on the reset button (closest to the USB port), and releasing the power button two or three seconds later. At this point, you should get a firmware upgrade interface on the HDMI display with a green progress bar, and once completed you’ll get a “Successful Android” logo.

This is what it looks like in the serial console during the update:

So I pressed Control-C in the serial console (if you have not set it up just reboot the board), and it failed to boot with the multiple error messages:

I contacted SZWesion about the issue, and they told me the SD card method did not work despite being documented on their website, and I had to use Amlogic USB Burning Tool in Windows instead. So I fired up a Windows 7 virtual machine, and I had no problem (for once) flashing the “update.img” file extract from Vim_Ubuntu-server-16.04_V170211.7z to the board.

Click to Enlarge

This time it works and the board booted properly. Here’s the complete boot log for reference: