How can I repair libsane to make my scanner usable in 18.04

I have a Cannon flat bed scanner LIDE 100. It still works perfectly under 16.0-4LTS. I recently switched over to 18.04LTS and my scans now have a black vertical line. Googling the issue it seems something went wrong with the development from “libsane_1.0.25” to “libsane1_1.0.27-1~experimental3ubuntu2_amd64” where a known bug remains impacting genesys_gl847 scanners. I do not understand why the Ubuntu 18.04LTS developers decided to go with an experimental package (libsane1_1.0.27-1~experimental3ubuntu2_amd64) vice a known stable package. I see some have resolved the issue by downgrading to 1.0.25 while others installed some patch. In the mean time it seems development of the SANE software has migrated to GIT so most the instructions to patch are no longer valid. All my attempts to downgrade libsane have failed. I am looking for help to get my fax LIDE 100 fax working in 18.04LTS. Any help is appreciated.

Hello!

I found this: drivers - Canon CanoScan LiDE 200 scans with a black bar - Ask Ubuntu

Hope it helps!

I did try those a while ago. These instructions are outdated, I think the repositories have moved. I have not been able to find a better address. Below is the output from the second command line:

$ git clone git://anonscm.debian.org/collab-maint/sane-backends.git
Cloning into 'sane-backends'...
fatal: unable to connect to anonscm.debian.org:
anonscm.debian.org[0: 194.177.211.202]: errno=Connection refused
anonscm.debian.org[1: 2001:648:2ffc:deb::211:202]: errno=Network is unreachable
$

You are right, my apologies. Take a look at Debian / sane-backends · GitLab and may be also to CompileSaneFromSource - Community Help Wiki

Also see:

https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1731459

  • contains instructions for patching 18.04.1, see last entry by Gabriel N. (gary17)

Discussion of problem:

  • see last post about clearing calibration cache.

I tried Gabriel's solution earlier and it failed as well. I even asked Gabriel for help and for some reason he thinks I am trying to clone from a Debian git repository when I followed his commands exactly. Maybe a repository moved? See below:

$  apt-get source libsane1
 Reading package lists... Done
 Picking 'sane-backends' as source package instead of 'libsane1'
 NOTICE: 'sane-backends' packaging is maintained in the 'Git' version
 control system at:
 git://anonscm.debian.org/collab-maint/sane-backends.git
 Please use:
 git clone git://anonscm.debian.org/collab-maint/sane-backends.git
 to retrieve the latest (possibly unreleased) updates to the package.
 Need to get 6,545 kB of source archives.
 Get:1 http://archive.ubuntu.com/ubuntu bionic/main sane-backends
 1.0.27-1~experimental3ubuntu2 (dsc) [2,495 B]
 Get:2 http://archive.ubuntu.com/ubuntu bionic/main sane-backends
 1.0.27-1~experimental3ubuntu2 (tar) [6,430 kB]
 Get:3 http://archive.ubuntu.com/ubuntu bionic/main sane-backends
 1.0.27-1~experimental3ubuntu2 (diff) [112 kB]
 Fetched 6,545 kB in 2s (4,009 kB/s)
 sh: 1: dpkg-source: not found
 E: Unpack command 'dpkg-source --no-check -x sane-
 backends_1.0.27-1~experimental3ubuntu2.dsc' failed.
 N: Check if the 'dpkg-dev' package is installed.
 > 
 $ git clone git://anonscm.debian.org/collab-maint/sane-backends.git
 Cloning into 'sane-backends'...
 fatal: unable to connect to anonscm.debian.org:
 anonscm.debian.org[0: 194.177.211.202]: errno=Connection refused
 anonscm.debian.org[1: 2001:648:2ffc:deb::211:202]: errno=Network is
 unreachable
 $

I have tried these as well. Although it seemed a little more promising, it failed at the make install command.

Step 2 of Gabriel’s instructions work here.

$ apt source libsane1
Reading package lists... Done
Picking 'sane-backends' as source package instead of 'libsane1'
NOTICE: 'sane-backends' packaging is maintained in the 'Git' version control system at:
git://anonscm.debian.org/collab-maint/sane-backends.git
Please use:
git clone git://anonscm.debian.org/collab-maint/sane-backends.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 6,545 kB of source archives.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (dsc) [2,495 B]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (tar) [6,430 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (diff) [112 kB]
Fetched 6,545 kB in 1s (5,812 kB/s)    
dpkg-source: info: extracting sane-backends in sane-backends-1.0.27
dpkg-source: info: unpacking sane-backends_1.0.27.orig.tar.gz
dpkg-source: info: unpacking sane-backends_1.0.27-1~experimental3ubuntu2.debian.tar.xz
dpkg-source: info: applying 0020-nousbtest.patch
dpkg-source: info: applying 0025-multiarch_manpages_libdir.patch
dpkg-source: info: applying 0035-trim-libraries-in-sane-backends.pc.in.patch
dpkg-source: info: applying 0600-scanimage_manpage.patch
dpkg-source: info: applying 0705-kfreebsd.patch
dpkg-source: info: applying 0710-sane-desc.c_debian_mods.patch
dpkg-source: info: applying 0140-avahi.patch
dpkg-source: info: applying 0145-avahi.patch
dpkg-source: info: applying 0100-source_spelling.patch
dpkg-source: info: applying 0150-genesys-Fix-use-of-uninitialized-variable.patch

You don’t need the “git clone step” because you are patching against Ubuntu 18.04.1 source not the development source. I don’t see a “git clone step” in the patch instructions.

djb

Have you installed dpkg-dev? The error says it is missing.
djb

I thought I did. Anyway, I did again, and fared a little better, but failed on the patch command (No such file or directory).

$ apt-get source libsane1
Reading package lists... Done
Picking 'sane-backends' as source package instead of 'libsane1'
NOTICE: 'sane-backends' packaging is maintained in the 'Git' version control system at:
git://anonscm.debian.org/collab-maint/sane-backends.git
Please use:
git clone git://anonscm.debian.org/collab-maint/sane-backends.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 6,545 kB of source archives.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (dsc) [2,495 B]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (tar) [6,430 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic/main sane-backends 1.0.27-1~experimental3ubuntu2 (diff) [112 kB]
Fetched 6,545 kB in 1s (4,371 kB/s)     
dpkg-source: info: extracting sane-backends in sane-backends-1.0.27
dpkg-source: info: unpacking sane-backends_1.0.27.orig.tar.gz
dpkg-source: info: unpacking sane-backends_1.0.27-1~experimental3ubuntu2.debian.tar.xz
dpkg-source: info: applying 0020-nousbtest.patch
dpkg-source: info: applying 0025-multiarch_manpages_libdir.patch
dpkg-source: info: applying 0035-trim-libraries-in-sane-backends.pc.in.patch
dpkg-source: info: applying 0600-scanimage_manpage.patch
dpkg-source: info: applying 0705-kfreebsd.patch
dpkg-source: info: applying 0710-sane-desc.c_debian_mods.patch
dpkg-source: info: applying 0140-avahi.patch
dpkg-source: info: applying 0145-avahi.patch
dpkg-source: info: applying 0100-source_spelling.patch
dpkg-source: info: applying 0150-genesys-Fix-use-of-uninitialized-variable.patch
$ patch sane-backends-1.0.27/backend/genesys.c --dry-run < genesys.c.diff
bash: genesys.c.diff: No such file or directory
$

The patch is post #33:

genesys.c.diff

2075c2075,2079
<   if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK && dev->model->cmd_set->rewind)
---
>   if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK && dev->model->cmd_set->slow_back_home)
>     {
>       status = dev->model->cmd_set->slow_back_home (dev, dev->model->flags);
>     }
>   else if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK && dev->model->cmd_set->rewind)

My Canon LIDE scanner broke a plastic gear some time back so I can’t test this patch here.

djb

Dave, Thanks for the reply. I am working from post 37. Did I do step 3 incorrectly? Unfortunately I have will not be home for the next 10 days and not be able do anymore until I return home.

Post #37 has the correct steps, including using fakeroot. He just forgot to include the patch .diff file in post #37.

I’ll see if I can fix my LIDE scanner and test all of this stuff between now and then.

djb

Dave, I am back home and ready to continue. I see the patch in post #33. What is unclear to me is where to put it. Or do I run the command " patch sane-backends-1.0.27/backend/genesys.c --dry-run < genesys.c.diff" from the same directory where “genesys.c.diff” resides?

The instructions assume you are in your home directory, have installed the source package in directory sane-backends-1.0.27 in your home directory, and have downloaded gensys.c.diff to your home directory.

I like to make a backup copy of any file before I try to patch it…

I must have thrown away my Canon scanner with the bad motor:(

djb

1 Like

Dave, Thanks for your help. My biggest mistake was not realizing there was a file to download in post 33. Once I downloaded that file and placed it in my home directory, the instructions (Gabriel’s solution) worked perfectly. Thanks again for your help.

So the next morning Ubuntu presented me with a system error: “package libsane1 1.0.27-1~experimental3ubuntu2 failed to install/upgrade: trying to overwrite shared ‘/usr/share/doc/libsane1/changelog.Debian.gz’, which is different from other instances of package libsane1:amd64”. Scanner still works properly.

The recent automatic update tried to remove your patched package.

Use “sudo apt-mark hold libsane1”

1 Like

It looks like there’s additional chatter on that gitlab discussion thread from the libsane backend’s owner as it looks like he started a new branch…if there is indeed a new release, would it not be too much to ask that it get backported to 18.04 since 16.04 is unaffected (but will be (theoretically) unsupported soon?) Reason being dated hardware and (potential) 10-year lifespan of 18.04. :pray: @Wimpy :pray:

1 Like

Just an update:
So I went back, did an unhold. Ran Software Updater, nothing available. Ran Synaptic Package Manager, an update was available. Applied update, rebooted, went to Simple Scan. Nothing looks new, but the scanner functions as expected. So I guess the issue has been corrected.