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

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.

Well, I should have never updated the driver. The black line came back. Hopefully I still have a backup.

Hello jaybo

If all else fails, and the scanner must be made to work...

We have used this at my place of work for around 15 years to keep a special scanner working on redmond operating systems.

Good luck :slightly_smiling_face:

I was able to restore the old driver successfully . Still don't understand why Ubuntu 18.04 decided to go with experimental drivers:

$ apt list --upgradable -a
Listing... Done
libsane-common/bionic-updates,bionic-updates 1.0.27-1~experimental3ubuntu2.1 all [upgradable from: 1.0.27-1~experimental3ubuntu2]
libsane-common/bionic,bionic,now 1.0.27-1~experimental3ubuntu2 all [installed,upgradable to: 1.0.27-1~experimental3ubuntu2.1]

libsane1/bionic-updates 1.0.27-1~experimental3ubuntu2.1 amd64 [upgradable from: 1.0.27-1~experimental3ubuntu2]
libsane1/bionic 1.0.27-1~experimental3ubuntu2 amd64
libsane1/now 1.0.27-1~experimental3ubuntu2 amd64 [installed,upgradable to: 1.0.27-1~experimental3ubuntu2.1]

On my LiDE 120 it is still broken, even in 20.04, as it does not use the official SANE 1.0.29 release, which fixes this properly.

I don't understand, does your LiDE still get the big black line with 20.04. And does 20.04 still use experimental driver as does 18.04?

Not a black line but a discolored one, it is lighter than the rest of the page. And 20.04 is still at 1.0.27experimental, at least the daily build I tried yesterday.

See also https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1862926

Did you ever try the patch listed in https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1731459, specifically post #33 & #37? Not sure if it will work with 20.04.

No, I didn't - I went straight to a genesys backend built from the 1.0.29 sources . That did the trick.

1 Like

...and SANE 1.0.29 finally appeared in 20.04 :slight_smile:

1 Like