"Invalid argument" when trying to scan

Bug #844582 reported by Dave Webb
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gscan2pdf (Ubuntu)
Invalid
Undecided
Unassigned
sane-backends (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

I'm using a Fujitsu M3091DCd scanner with SANE. From the command line it works more or less well with Ubuntu.

I can't use it with gscan2pdf v0.9.31, but gscan2pdf works with another scanner.

All I get is a meaningless "Invalid argument" when I hit the scan button.

When I start gscan2pdf from the command line I see these lines appearing when I hit the scan button:

Error running process: Died at (eval 39) line 7.

  $device->start;
  $shash{$sane_thread}{status} = $Sane::STATUS+0;
  if ($Sane::STATUS != SANE_STATUS_GOOD) {
   print "$prog_name: sane_start: $Sane::STATUS\n" if $debug;
   $shash{$sane_thread}{go} = 0;
   die; # quickest way out of the eval block
  }

  my $path = $shash{$sane_thread}{data};
  if (not open($fh, ">", $path)) {
   $device->cancel;
   $shash{$sane_thread}{status} = SANE_STATUS_ACCESS_DENIED;
   $shash{$sane_thread}{go} = 0;
   die; # quickest way out of the eval block
  }
  scan_page($device, $fh);
  $shash{$sane_thread}{status} = $Sane::STATUS+0;
  close $fh;
  printf "Scanned page %s.", $path if $debug;
  printf " (scanner status = %d)\n", $Sane::STATUS if $debug;
  $shash{$sane_thread}{status} = $Sane::STATUS+0;
  $shash{$sane_thread}{go} = 0;

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: gscan2pdf 0.9.31-2
ProcVersionSignature: Ubuntu 2.6.38-11.48-generic 2.6.38.8
Uname: Linux 2.6.38-11-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
Date: Thu Sep 8 09:44:25 2011
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=
 PATH=(custom, no username)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gscan2pdf
UpgradeStatus: Upgraded to natty on 2011-06-01 (98 days ago)

Revision history for this message
Dave Webb (davewebb8211) wrote :
Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote : Re: [Bug 844582] Re: "Invalid argument" when trying to scan

I have complete rewritten this code in the upcoming version. Please
try the new version as soon I release it.

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

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

Changed in gscan2pdf (Ubuntu):
status: New → Confirmed
Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

Please start gscan2pdf with the --log=log option from the command line, reproduce the problem, quit, and post the log file.

Changed in gscan2pdf (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

I have a similar problem with a different scanner. The Epson GT-S80. When I choose Doublesided scanning also Invalid Argument.

I'm using Ubuntu 14.04.2LTS with the PPA running version 1.3.0

I've run a log file and attached it here below.

These Entries in the log seem odd.

WARN - Argument "" isn't numeric in numeric ne (!=) at /usr/share/perl5/Gscan2pdf/Dialog/Scan/Sane.pm line 731.

WARN - Argument "" isn't numeric in subroutine entry at /usr/share/perl5/Gscan2pdf/Frontend/Sane.pm line 430.

INFO - sane_set_option 51 (auto-eject) to returned status Success with info 0

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

[Expired for gscan2pdf (Ubuntu) because there has been no activity for 60 days.]

Changed in gscan2pdf (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

Sorry for the delay. Please try this patch.

Changed in gscan2pdf (Ubuntu):
status: Expired → Incomplete
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0001-Suppress-warnings-when-passed-boolean-as-empty-strin.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

After applying the patch and restarting I'm still receiving Invalid Argument (see screenshot)

Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

Here is the new output of gscan2pdf --log=log with the patch applied.

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

You are using the libsane-perl frontend in gscan2pdf, which is generally the preferred one.

Please change this to scanimage in Edit/Preferences and post another log file.

Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

As requested a new log file and screenshot using scanimage instead of libsane-perl
The error message says "Unknown Message: scanimage: sane_start: Invalid Argument"

Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

And because you can't post multiple attachments here is the log file using scanimage

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

The fact that you can reproduce this with the scanimage frontend tells me that this is a problem with Epson SANE backend, and not with gscan2pdf. If you look at the bottom the last log you posted, you will see that this is the command gscan2pdf used:

 scanimage --device-name='epkowa:interpreter:001:005' -x 210 -y 297 --adf-mode='Duplex' --resolution='200' --batch --progress --batch-start=1 --batch-increment=2

Please try this from the command line and confirm that it throws the same error.

If so, this bug should also be attached to the libsane package, where the epson and epson2 backends are.

Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

I get the exact same error from gscan2PDF with my HP 7510 all-in-one scanner. (see attached Video). On two different computers. (note using the HP scan utility works)

For the earlier Epson. The Epson ScanImage for Linux also works normally.

Is there a better explanation what "Invalid Argument" is referring to in the error handling?

I'll make a log of the HP output later today.

Revision history for this message
Damiön la Bagh (kat-amsterdam) wrote :

~$ scanimage --device-name='epkowa:interpreter:001:005' -x 210 -y 297 --adf-mode='Duplex' --resolution='200' --batch --progress --batch-start=1 --batch-increment=2
scanimage: open of device epkowa:interpreter:001:005 failed: Invalid argument

Bus 001 Device 004: ID 04b8:0136 Seiko Epson Corp. ES-D400 [GT-S80]

When I use Epson's own scan software it works fine. I notice that the epkow:interpreter selected is different than the one gscan2pdf is choosing.

gscan2pdf chooses: epkowa:interpreter:001:005
epson proprietary chooses: epkowa:interpreter:001:004 see screenshot

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

As you have noted, the 001:005 refers to the usb device. However this can change between boots. Did you reboot between the gscan2pdf/scanimage and epson sessions?

As you can reproduce this from the commandline with scanimage, I am transferring this bug to sane-backends, as the bug must be in the epson/epkowa backend in SANE.

"Invalid argument", is simply the error code that libsane returns. Unfortunately, it does not provide any more information that that by default.

However, you can run scanimage with debugging turned on. I would ask on the SANE mailing list for more help.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Dave, are you still experiencing this problem?

tags: removed: patch
Changed in sane-backends (Ubuntu):
assignee: nobody → Rolf Leggewie (r0lf)
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
Hans Deragon (deragon) wrote :

I had a similar problem with the default version of gscan2pdf available from the default Ubuntu 16.04 repositories. I would scan, but the error message would arrive after the scan was completed.
 gscan2pdf version 1.3.8.

I then installed the following PPA to get the latest version, 1.8.3:

sudo add-apt-repository --yes ppa:jeffreyratcliffe/ppa

The problem was gone. I suggest you upgrade gscan2pdf to the latest and report your findings. We might be able to close this ticket.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Please do not suggest to install third-party packages, even if from the upstream developper. It is a very bad idea in almost all situations. The real problem is how to distinguish those situations from the ones where it might be OK (for the ordinary user). Thus, the normal user should stick to the official packages. We need to get rid of the impulse to install random stuff from the internet to quickly "fix" a problem.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Dave, are you still experiencing this problem?

Revision history for this message
Hans Deragon (deragon) wrote :

Rolf, I would agree with you if bugs would be fixed in a timely manner, but that is not the case. In the meantime, people go months if not years with a scanner that does not work. That is unacceptable by any standard. People should see my previous comment as a work around to get things done. This bug was opened in 2011 and still affects people.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Hans, we can certainly disagree. But it seems you as well as some of the upstream devs do not understand much about packaging. If you want timely fixes, pay someone to do it. If you want to make a mess of your system, install random packages. I'm fine with any of that. I'm not fine if then such person comes back and waste Ubuntu devs time with a problem they did not create or gives Ubuntu a bad name that they did not deserve in this case. I hope that makes sense.

BTW, scanner support is the responsibility of the manufacturer, don't you think? Have you complained to them about lack of FOSS support? Have you taken this into consideration when you purchased your scanner? Or have you simply purchased whatever was cheapest? IMO, what is not acceptable is buying cheap, unsupported stuff and then complaining to people doing a LOT of work for you for free. Last comment, if you feel that all of this is so unacceptable then have you rolled up your sleeve and provided a patch or at least tried to?

Changed in sane-backends (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gscan2pdf (Ubuntu) because there has been no activity for 60 days.]

Changed in gscan2pdf (Ubuntu):
status: Incomplete → Expired
Rolf Leggewie (r0lf)
Changed in gscan2pdf (Ubuntu):
status: Expired → Invalid
Changed in sane-backends (Ubuntu):
status: Incomplete → Opinion
assignee: Rolf Leggewie (r0lf) → nobody
Revision history for this message
Paul Hazelden (paul-hazelden) wrote :

I have the same problem.

gscan2pdf: sane_start: Invalid argument

I would agree that scanner support is the responsibility of the manufacturer, except that my system ran perfectly until I upgraded from 18.04 to 20.04.1. So whatever the manufacturer supplied used to work, but the upgrade broke it. It seems to me that in this situation, Ubuntu ought to try to fix it.

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

Please start gscan2pdf from the command line with the --log=log option, try to scan, quit, and post the log file, which gscan2pdf should have compressed to log.xz for you.

Revision history for this message
Fernando (gholst) wrote :

Hello,
I have the same problem:
   gscan2pdf: sane_start: Invalid argument

I run from the command line with the "--log=log" option and create the log.xz file that I attach.
My system is:
   * Kubuntu 20.10 (Ubuntu + KDE)
   * Scanner: Brother DCP-J562DW
I've been able to use this scanner in al ubuntu versions (I'm long linux user and gscan2pdf too), but I'm not sure if I've used with the previous 20.04 version (I think that yes).

I have another PC with Windows 10 and the scanner works. So is something with my system not with the device.

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

What happens if you try the following from the command line:

scanimage -x 210 --mode=Color --resolution=300 --batch

?

Revision history for this message
PaulHazelden (tenuki57) wrote :

Apologies for the slow response. Please find attached the requested log file.

Revision history for this message
PaulHazelden (tenuki57) wrote :

I then tried the next suggestion:
scanimage -x 210 --mode=Color --resolution=300 --batch

and this succeeded. If I attach the '--log=' option to this command line, will that generate any useful information?

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

@PaulHazelden (tenuki57):

I don't see "invalid argument" anywhere in the log. It looks to me that SANE did not find any scanners. Was your scanner plugged in?

What does the following return:

    scanimage -L

?

Revision history for this message
Garnier (jeanphilippe49) wrote :

I meet the same bug with gscanpdf
gscan2pdf: sane_start: Invalid argument
My system is:
   * Ubuntu 20.04
   * Scanner: Brother MFC-J1010DW

I read a lot of post and I try an another file : numériseur de document (simplescan perhaps) and I find that the scanner works perfectly.
I suspect there is a bug in gscanpdf in some situations (I use gscanpdf for a long time even with some other brother scanners without problems)

Revision history for this message
Jeffrey Ratcliffe (jeffreyratcliffe) wrote :

Please start gscan2pdf from the command line with the --log=log option, try to scan, quit, and post the log file, which gscan2pdf should have compressed to log.xz for you.

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.