Scanning fails with many Samsung multifunctions (SCX-3200, SCX-3400, CLX-6260) after upgrading to Ubuntu 17.10/18.04 (SANE_USB_WORKAROUND=1 needed)

Bug #1741977 reported by Guenther Grau
50
This bug affects 8 people
Affects Status Importance Assigned to Milestone
sane-backends (Baltix)
Triaged
High
Mantas Kriaučiūnas
sane-backends (Fedora)
Fix Released
High
sane-backends (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Upgraded from kubuntu 17.04 to 17.10. Before the upgrade I was able to use my printer/scanner Samsung SCX-3200 without problems, with 17.10 I can only use the printer part.

sane-find-scanner finds the scanner

$ sane-find-scanner -q
[...]
product=0x3441 [SCX-3200 Series]) at libusb:003:019
[...]

Scanning fails with many Samsung multifunctions (including SCX-3400, SCX-4624f, CLX-6260) after upgrading to Ubuntu 17.10/18.04

It seems the best solution for now is to add SANE_USB_WORKAROUND=1 line to /etc/environment:

echo "SANE_USB_WORKAROUND=1" | sudo tee -a /etc/environment

or to /etc/systemd/user.conf: echo "DefaultEnvironment=SANE_USB_WORKAROUND=1"|sudo tee -a /etc/systemd/user.conf

For more info why SANE_USB_WORKAROUND=1 is needed look at http://www.sane-project.org release notes of 1.0.27:
Note 3: The Linux USB3 workaround which was added in version 1.0.25 is now disabled by default. If you have difficulty using a scanner which previously worked, or intermittent scanner availability, try setting the new environment variable SANE_USB_WORKAROUND=1 before starting frontend.
I found this info in comments of bug #1728012 and https://askubuntu.com/questions/966834/ubuntu-17-10-and-samsung-scx-4624f-scanner-not-working/966835

When I start scanimage the first time, it can talk to the scanner just fine:
$ export SANE_DEBUG_XEROX_MFP=255
$ scanimage -L
[sanei_debug] Setting debug level of xerox_mfp to 255.
[xerox_mfp] sane_init: Xerox backend (build 13), version != null, authorize != null
[xerox_mfp] sane_xerox_mfp_get_devices: 0x7ffdf4d2e220, 0
[xerox_mfp] list_one_device: libusb:003:018
[xerox_mfp] usb_dev_open: open 0x55d2e393c5d0
[xerox_mfp] :: dev_command(INQUIRY[0x12], 70)
[xerox_mfp] [70] a8 00 43 10 53 61 6d 73 75 6e 67 20 53 61 6d 73 75 6e 67 20 53 43 58 2d 33 32 30 30 20 53 65 72 69 65 73 20 19 33 84 2b 00 00 27 d8 00 00 36 d8 00 01 51 00 00 01 00 00 00 00 36 d8 00 00 36 d8 00 01 05 05 00...
[xerox_mfp] dev_inquiry: found Samsung/Samsung SCX-3200 Series
[xerox_mfp] usb_dev_close: closing dev 0x55d2e393c5d0
device `xerox_mfp:libusb:003:018' is a Samsung Samsung SCX-3200 Series multi-function peripheral
When I start scanimage a second time it cannot talk to the scanner anymore:

$ scanimage -L
[sanei_debug] Setting debug level of xerox_mfp to 255.
[xerox_mfp] sane_init: Xerox backend (build 13), version != null, authorize != null
[xerox_mfp] sane_xerox_mfp_get_devices: 0x7ffe9ae18760, 0
[xerox_mfp] list_one_device: libusb:003:018
[xerox_mfp] usb_dev_open: open 0x56138cfa1870
[xerox_mfp] :: dev_command(INQUIRY[0x12], 70)
[xerox_mfp] usb_dev_request: sanei_usb_read_bulk: Error during device I/O
[xerox_mfp] dev_command: dev_request: Error during device I/O
[xerox_mfp] usb_dev_close: closing dev 0x56138cfa1870
[xerox_mfp] list_one_device: dev_inquiry(libusb:003:018): Error during device I/O

Unplugging the usb cable and plugging it back in allows scanimage to talk to the scanner once. After that it fails again. The USB cable is not a problem, as it worked with 16.10.

I downloaded VueScan and it has not problems to repeatedly scan pages using the same hw, which also indicates that this is a sw and not a hw problem. And just to mention it again, printing also works fine using the same cable. And yes, I tried multiple USB ports. All exhibit the same behaviour. When I execute scanimage -L once and start VueScan afterwards, then VueScan also doesn't see the scanner anymore. After unplugging and replugging the UBS cable and restarting VueScan, it's able to scan again.

Looks to me like sane doesn't know how to talk to the scanner anymore. It seems that something get's messed up during the first usb command, which prevents subsequent usb commands from succeeding.

I just downloaded 16.04.3 LTS and booted it from a USB stick. I can confirm that the scanner still works with 16.04.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: sane-utils 1.0.27-1~experimental2ubuntu2.1
ProcVersionSignature: Ubuntu 4.13.0-21.24-generic 4.13.13
Uname: Linux 4.13.0-21-generic x86_64
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: KDE
Date: Mon Jan 8 20:53:07 2018
InstallationDate: Installed on 2016-04-03 (645 days ago)
InstallationMedia: Kubuntu 15.10 "Wily Werewolf" - Release amd64 (20151021)
SourcePackage: sane-backends
UpgradeStatus: Upgraded to artful on 2018-01-05 (2 days ago)

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

Description of problem:
Lack of USB3 xhci patch makes SANE quite unusable with USB3 hardware;
example with Fujitsu fi-6130 (theoretically fully supported by SANE):

[root@tux ~]# scanimage -L # First run
device `fujitsu:fi-6130dj:108292' is a FUJITSU fi-6130dj scanner
[root@tux ~]#

[root@tux ~]# scanimage -L # Second run a few moments later

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).
[root@tux ~]#

Version-Release number of selected component (if applicable):
sane-backends-1.0.24-9.el7

How reproducible:
Everytime, see above and below.

Actual results:
Lack of USB3 xhci patch makes SANE quite unusable with USB3 hardware.

Expected results:
Applying upstream USB3 xhci patch solves the issue (tested myself).

[root@tux ~]# scanimage -L # First run
device `fujitsu:fi-6130dj:108292' is a FUJITSU fi-6130dj scanner
[root@tux ~]#

[root@tux ~]# scanimage -L # Second run a few moments later
device `fujitsu:fi-6130dj:108292' is a FUJITSU fi-6130dj scanner
[root@tux ~]#

[root@tux ~]# scanimage -L # Third run a few moments later
device `fujitsu:fi-6130dj:108292' is a FUJITSU fi-6130dj scanner
[root@tux ~]#

Additional info:
https://src.fedoraproject.org/cgit/rpms/sane-backends.git/plain/sane-backends-1.0.24-usb3-xhci.patch?id=e0bd4233ccf23151f4adfa14f45f328ae57c7c20

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

Created attachment 1285126
sane-backends-1.0.24-usb3-xhci.patch

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

Created attachment 1285127
Patch for sane-backends.spec

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

Cross-filed ticket 01863749 on the Red Hat customer portal.

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Hi Robert,

thank you for contacting us, but it is too late to get this patch into RHEL-7.4, we will look into it for RHEL-7.5. I am deeply sorry for inconvenience.

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

RHEL 7.5 would be fine.

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Robert,

I think it would be better to include upstream commit 1207ce5a40664c04b934bd0a6babbc1575361356 too. It uses environment variable SANE_USB_WORKAROUND, which setting to 1 enables workaround, which is in your proposed patch. It could minimize impact for other users. Its usage will be explained in man page sane-usb(5). Do you agree, Robert?

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Upstream issue for adding SANE_USB_WORKAROUND usage into man page https://alioth.debian.org/tracker/index.php?func=detail&aid=315792&group_id=30186&atid=410366

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Robert,

would you mind testing these rpms from this link https://zdohnal.fedorapeople.org/.sane/ ?

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Upstream accepted manpage patch as commit 56398ead607d8bcb9deef7ca3f4d7f78478f1b4c

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Created attachment 1313099
Proposed patch

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

(In reply to Zdenek Dohnal from comment #8)
> I think it would be better to include upstream commit
> 1207ce5a40664c04b934bd0a6babbc1575361356 too. It uses environment variable
> SANE_USB_WORKAROUND, which setting to 1 enables workaround, which is in your
> proposed patch. It could minimize impact for other users. Its usage will be
> explained in man page sane-usb(5). Do you agree, Robert?

If the result is the same in the end, I don't mind about the details of the
patch or whether to set an environment variable.

Revision history for this message
In , Robert (robert-redhat-bugs-1) wrote :

Do you still need a test for verification? Or do you have such hardware
yourself around somewhere?

Revision history for this message
In , Zdenek (zdenek-redhat-bugs) wrote :

Yes, would you mind testing it? I do not have such HW unfortunately.

Revision history for this message
Guenther Grau (graug) wrote :
Revision history for this message
In , errata-xmlrpc (errata-xmlrpc-redhat-bugs) wrote :

Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0793

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sane-backends (Ubuntu):
status: New → Confirmed
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote :

Could you test if scanning works on your Samsung SCX-3200 multifunction in Ubuntu 18.04 (Bionic) ?

I've meet with a similar issue - Samsung CLX 6260 Color Multifunction Printer (Model CLX-6260FW) doesn't work with Ubuntu 18.04 (Bionic) but works perfectly with Ubuntu 16.04 (xenial)

Revision history for this message
Guenther Grau (graug) wrote :

I upgraded 17.10 to 18.04 and the problem remains the same :-(. I also did a new installation of 18.04 from scratch and that one isn't working either.

I did find, however, a workaround (for 17.10 and 18.04). If I set

export SANE_USB_WORKAROUND=1

in a shell and start a scan application afterwards like gscan2pdf or simple-scan, than scanning works using both applications. Some changes made since 16.04 in the sane framework seem to have broken support for the scanner part of my MFC. You should try setting the variable in the shell an see if it also fixes your problem.

Revision history for this message
Karolis (reklamukibiras) wrote :

Can also confirm the same problem with SCX-3400 model. Printing and scanning worked in all versions before 17.10, and scanning stopped working since then. I also have Debian Testing at home - it doesn't have this problem at all.

I believe this is related to libsane (v1.0.25-4) being renamed to libsane1 (v1.0.27-1) and then maybe something more have changed between these versions. Note that 1.0.27 is actually still tagged as experimental.

Can also confirm that setting SANE_USB_WORKAROUND variable fixes the problem, however it is not a nice workaround and things should just work out of the box.

summary: - SCX-3200, scanning fails after migration to Kubuntu 17.10
+ Samsung SCX-3200, SCX-3400, CLX-6260 scanning fails after upgrading to
+ Ubuntu 17.10/18.04
tags: added: bionic regression
removed: amd64
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote : Re: Samsung SCX-3200, SCX-3400, CLX-6260 scanning fails after upgrading to Ubuntu 17.10/18.04

It seems the best solution for now is to add SANE_USB_WORKAROUND=1 line to /etc/environment:

echo "SANE_USB_WORKAROUND=1" | sudo tee -a /etc/environment

(or to /etc/systemd/user.conf: echo "DefaultEnvironment=SANE_USB_WORKAROUND=1"|sudo tee -a /etc/systemd/user.conf )

For more info why SANE_USB_WORKAROUND=1 is needed look at http://www.sane-project.org release notes of 1.0.27:
Note 3: The Linux USB3 workaround which was added in version 1.0.25 is now disabled by default. If you have difficulty using a scanner which previously worked, or intermittent scanner availability, try setting the new environment variable SANE_USB_WORKAROUND=1 before starting frontend.
I found this info in comments of bug #1728012 and https://askubuntu.com/questions/966834/ubuntu-17-10-and-samsung-scx-4624f-scanner-not-working/966835

summary: - Samsung SCX-3200, SCX-3400, CLX-6260 scanning fails after upgrading to
- Ubuntu 17.10/18.04
+ Scanning fails with many Samsung multifunctions (SCX-3200, SCX-3400,
+ CLX-6260) after upgrading to Ubuntu 17.10/18.04 (SANE_USB_WORKAROUND=1
+ needed)
description: updated
Changed in sane-backends (Baltix):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Mantas Kriaučiūnas (mantas)
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote :

I don't understand why Linux USB3 workaround which was added in version 1.0.25 is disabled by default in SANE 1.0.27 :(
Maybe Ubuntu developers should patch SANE to enable SANE_USB_WORKAROUND=1 by default on all computers with USB 3.x ports?
Anyone knows if SANE_USB_WORKAROUND=1 variable could cause any problems? If not, then why don't set this by default?

Revision history for this message
Karolis (reklamukibiras) wrote :

@Mantas > The question is - is there a scanner out there that uses USB3 natively, and how would this workaround would affect those scanners? If there is no effect - workaround can be enabled by default.

Changed in sane-backends (Fedora):
importance: Unknown → High
status: Unknown → Fix Released
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote :

We could count aproximately how many scanners are broken NOW since SANE 1.0.27 by disabling Linux USB3 workaround by default vs how many scanners could be broken by setting SANE_USB_WORKAROUND=1

Currently scanning with lots of mainstream SAMSUNG and XEROX multifunctional printers doesn't work in Ubuntu 18.04 LTS, but they works with Ubuntu 16.04 LTS, so, this is a very important regression and this should be fixed ASAP.
If enabling SANE_USB_WORKAROUND=1 by default couses problems with few new scanners, which didn't work in Ubuntu 16.04 then this isn't such big problem like now - it's easier to write in Ubuntu 18.04 LTS Release Notes - new USB3 scanners should add SANE_USB_WORKAROUND=0 to /etc/environment instead of cousing problems for users, who upgraded from 16.04 LTS

Revision history for this message
Reinhard Katzmann (suamor) wrote :

I only started investigating but SANE_USB_WORKAROUND=1 does definitively not work for me. However so far I had not been able to communicate with the scanner (even after removing / reinserting USB cable) so I cannot be 100% sure if this is the same issue. The second part of the issue shown is 100% identical. Due to lack of experience with the xerox debug output it may be a different issue.

Question is how can I get any further information why the communication fails ? This still looks to me like a generic issue, not a xerox specific issue.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Reinhard: The upgrade to 1.0.27 in Ubuntu came with several concurrent issues:

- The USB3 issue (which this bug is about)
- The confusion caused by package renaming
- Broken support for drivers installed in /usr/lib/sane

The latter issue is fixed in Ubuntu 19.04, and is about to be fixed in 18.04 (bug #1728012).

Changed in sane-backends (Baltix):
milestone: none → baltix-18.04
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.