"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Tuesday, 28 October 2014

Using HP ScanJet G4050 USB scanner from a VirtualBox guest machine


One of the well known Linux problem is the lack of hardware drivers. I've sometime complained, in the past, about the poor support my HP ScanJet G4050 scanner had on Linux promising myself to try to find a solution using VirtualBox with a Windows guest machine. Fortunately a good enough SANE scanner driver came out and I forgot quickly about my intent. I lived well with my SANE driver recently when I found a bunch of old film negatives. The HP SANE driver works fine and fast but doesn't support the scanner transparent materials adapter (TMA). I so decided to go back to my initial idea about using VirtualBox and a Windows guest machine.

Setting-up VirtualBox

In order to fully support USB devices an extension pack has to be installed in addition to VirtualBox main program. The extension pack version must match with the VirtualBox one. Since the VirtualBox version I used, installed with Ubuntu Software Centre, did not match with any of the available versions I had to download both main program and extension pack.
I first uninstalled the the VirtualBox version I had on my computer then I installed the downloaded “.deb” file. Once the right version was ready I could eventually install the expansion pack from VirtualBox preferences.
The extension pack installation starts asking confirmation first

then the license agreement
As the installation completed I went to my host machine configuration but still couldn't see any USB device available. After some googling around I discovered I had to add my user to the “vboxusers” group. This can be done by command line with the “adduser” command or graphically by installing the “Gnome System Tools” and using the provided “User Settings” tool.
At last I could enable the HP G4050 scanner in my guest machine
Once the guest machine started and the scanner software was installed I could start scanning my negatives.

Some final thoughts …

My scanner works fine in the virtual machine even it's less responsive than when I use the SANE driver. Other scanners could, of course, behave in different way or even do not work at all. If your guest machine runs, like mine, the old and now unsupported Windows XP better you disable networking in order to minimize the risk of having it infected. Last but not least, keep an eye on licenses, especially if you're installing onto your computer at work. VirtualBox expansion pack come with a different license (PUEL: Personal use and evaluation license) also remember not all Windows licenses can be installed on a virtual machine.