A short term solution

Home
About

Scanner
  The search
  Solution?

Dependency jungle, the agony!

I decided to investigate if the binary deb package distributed by Mustek could work, and started by downloading Ubuntu 14.04 thinking that going there would be reasonable since the Mustek binaries where published Dec 9, 2014. Currently I'm using Linux Mint 'Rosa' (17.3) as my day-to-day-system, and my thinking was back-tracking ~three years + one step closer to debian should lower risks for incompatibilities. But no such luck at first try; I was unable to navigate the dependency jungle apt threw at me when asking dpkg to downgrade libsane to the binary from Mustek.

I was a bit surprised by this, but took a closer look at the version their binary was stated to be and figured that ubuntu has a similar version in their 12.04 release. So I tried it and succeded in getting it installed on a 32bit live-cd session. I've always preferred KDE over Gnome, so I downloaded Kubuntu 12.04 (386) and installed it on an old laptop I had lying.
After installing this old Kubuntu on this old laptop, I proceeded with installing the package from Mustek:

First I made the usual queries to the system:
gjermund@gjermund-LIFEBOOK-S7110:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 13fe:1f00 Kingston Technology Company Inc. DataTraveler 2.0 4GB Flash Drive / Patriot Xporter 32GB (PEF32GUSB) Flash Drive
Bus 002 Device 002: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse
Bus 001 Device 004: ID 055f:040b Mustek Systems, Inc. ScanExpress A3 USB 1200 PRO

So the basic USB system connects with the scanner, as expected.

gjermund@gjermund-LIFEBOOK-S7110:~$ sane-find-scanner

# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.

# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x055f, product=0x040b, chip=SQ113?) at libusb:001:004
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Not checking for parallel port scanners.

# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.

# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.

Now I felt optimistic, could it bee I'd wasted time installing Musteks binary on the live-cd session in vain? Was it in Kubuntus depot after all? But this was not the case, as the next query shows:

gjermund@gjermund-LIFEBOOK-S7110:~$ scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

And with SUDO for good measure

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo scanimage -L
[sudo] password for gjermund:

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

.. it didn't work with SANEs distributed backend ... as expected. So I started installation of Musteks binaries, ie downgrade to Musteks binaries.

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo dpkg -i --force-downgrade libsane_1.0.19-1_i386.deb
dpkg: warning: downgrading libsane from 1.0.22-7ubuntu1 to 1.0.19-1A3IIIU2.
(Reading database ... 90121 files and directories currently installed.)
Preparing to replace libsane 1.0.22-7ubuntu1 (using libsane_1.0.19-1_i386.deb) ...
Unpacking replacement libsane ...
dpkg: error processing libsane_1.0.19-1_i386.deb (--install):
 trying to overwrite '/usr/bin/sane-find-scanner', which is also in package sane-utils 1.0.22-7ubuntu1
Errors were encountered while processing:
 libsane_1.0.19-1_i386.deb

This time it complained of file overwrite between packages, so I removed all traces of the sane-utils package from 'buntu ...

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo dpkg -P sane-utils
(Reading database ... 90120 files and directories currently installed.)
Removing sane-utils ...
saned disabled; edit /etc/default/saned
Purging configuration files for sane-utils ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot

.. and re-ran the downgrade-command that previously failed.

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo dpkg -i --force-downgrade libsane_1.0.19-1_i386.deb
dpkg: warning: downgrading libsane from 1.0.22-7ubuntu1 to 1.0.19-1A3IIIU2.
(Reading database ... 90105 files and directories currently installed.)
Preparing to replace libsane 1.0.22-7ubuntu1 (using libsane_1.0.19-1_i386.deb) ...
Unpacking replacement libsane ...
dpkg: dependency problems prevent configuration of libsane:
 libsane depends on libjpeg62; however:
  Package libjpeg62 is not installed.
dpkg: error processing libsane (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libsane_1

Now it complained about dependency on a package that wasn't already on the system, and since I was using dpkg to install the binary package from Mustek, the dependency issue wasn't dealt with automatically. So I had to install the libjpeg62 from 'buntus well:

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo apt-get install libjpeg62
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libjpeg62
0 upgraded, 1 newly installed, 0 to remove and 379 not upgraded.
1 not fully installed or removed.
Need to get 87.0 kB of archives.
After this operation, 201 kB of additional disk space will be used.
Get:1 http://no.archive.ubuntu.com/ubuntu/ precise-updates/main libjpeg62 i386 6b1-2ubuntu1.1 [87.0 kB]
Fetched 87.0 kB in 0s (861 kB/s)
Selecting previously unselected package libjpeg62.
(Reading database ... 89862 files and directories currently installed.)
Unpacking libjpeg62 (from .../libjpeg62_6b1-2ubuntu1.1_i386.deb) ...
Setting up libjpeg62 (6b1-2ubuntu1.1) ...
Setting up libsane (1.0.19-1A3IIIU2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Good. Now all was installed and set up properly. But unfortunately it wouldn't last, because apt will always insist on upgrading, in this case libsane, to latest available package and thus breaking any gained support for my scanner. To fix this I had to freeze libsane in the version of the installed Mustek package, telling apt to leave it alone during routine maintenance. There are several tools to achieve this, my preferred tool is aptitude since it has a visual interface where individual packages status are visible.

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo apt-get install aptitude

.. will install aptitude. Entering

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo aptitude

starts aptitude and within aptitude enter '/' and type 'libsane' + [ENTER], the package libsane should appear. To freeze it, select the libsane package and press '=' to hold/block future updates of the package. This should make the indication at the left margin change from a single 'i' to 'ih', indicating that this package will now be held in this state at future system-updates. Press 'u' to update package-information in cache and then 'q' to exit aptitude. Well out of aptitude enter:

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo aptitude upgrade

.. followed by another [ENTER] to install all other system upgrades available for the 12.04. When the update process had ran its course, I rebooted the computer to make sure all updated libraries were loaded before further tests were done.

When the computer came back from the twilight-zone, I needed to test if the scanner worked as expected:

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo scanimage -L
[sudo] password for gjermund:

A3IIIU2 Spicall: hello?

A3IIIU2 Spicall: Init the data link

A3IIIU2 Spicall: <in IsResolution600
device `mustek_usb2:libusb:001:004' is a Mustek ScanExpress A3 USB 1200 Pro flatbed scanner

.. and it did, but using sudo to run scanner software isn't acceptable. So I needed to set up privileges for my user to access the scanner:

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo adduser gjermund scanner
[sudo] password for gjermund:
Adding user `gjermund' to group `scanner' ...
Adding user gjermund to group scanner
Done.

.. and (on one single line) ...

gjermund@gjermund-LIFEBOOK-S7110:~$ echo "ENV{libsane_matched}==\"yes\", RUN+=\"/bin/setfacl -m g:scanner:rw \$env{DEVNAME}\" ATTRS{idVendor}==\"055f\", ATTRS{idProduct}==\"040b\", ENV{libsane_matched}=\"yes\"" > ./60-libsane.rules

.. and then move this file to its proper position, and assign appropriate ownership ...

gjermund@gjermund-LIFEBOOK-S7110:~$ sudo mv ./60-libsane.rules /etc/udev/rules.d/ && sudo chown root:root /etc/udev/rules.d/60-libsane.rules

Finally it needs to restart all authication sub-systems, and frankly it's easiest achieved by a reboot.

*And we're done*

:)

A screen shot I captured while I had this package installed on live-cd session of Ubuntu 12.04.

Some more screen shots from after installing this back end onto Kubuntu 12.04.

Published: 18/11-2017 (Gjermund Skogstad)

2017 © Gjermund Skogstad (skogstad.org)