SOLVED Scanner error: Failed to start: Invalid argument

SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 24th, '17, 18:33

Recently upgraded to M6 and installed sane and xsane. When I first run a scan I get the error:
Code: Select all
Failed to start:Invalid argument

If I click on the scan button a second time after I close the error dialog, then the scan is performed. This happens in Xsane and Xscanimage. Simple Scan just fails to scan and Gimp fails to scan with the xsane plugin.
lsusb shows:
Code: Select all
Bus 002 Device 002: ID 04f9:0263 Brother Industries, Ltd

scanimage -L shows:
Code: Select all
device `brother4:bus10;dev1' is a Brother MFC-J6710DW USB scanner

the installed packages are
Code: Select all
saned-1.0.25-5.mga6
lib64kf5sane5-16.12.3-1.mga6
python-sane-2.8.2-3.mga6
xsane-0.999-9.mga6
xsane-gimp-0.999-9.mga6
lib64sane-hpaio1-3.17.4-1.mga6
sane-backends-doc-1.0.25-5.mga6
lib64sane1-1.0.25-5.mga6
sane-backends-iscan-1.0.25-5.mga6
libksane-16.12.3-1.mga6
sane-frontends-1.0.14-20.mga6
sane-backends-1.0.25-5.mga6

I tried putting myself into the lp group as per a posting online, but no change.
Scanner is set up directly under USB and the latest Brother drivers are installed.
the following is /var/log/messages when I run Xsane
Code: Select all
Jul 24 12:23:40 perrin kernel: [ 1138.534230] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
Jul 24 12:23:40 perrin kernel: [ 1138.534233] usb 2-1: usbfs: process 4127 (xsane) did not claim interface 1 before use
Jul 24 12:23:53 perrin kwin_x11[5145]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 40953, resource id: 79693385, major code: 15 (QueryTree), minor code: 0
Jul 24 12:24:08 perrin kernel: [ 1165.816772] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
Jul 24 12:24:08 perrin kernel: [ 1165.816775] usb 2-1: usbfs: process 4127 (xsane) did not claim interface 1 before use   [Error about invalid argument then pops up now]
Jul 24 12:24:31 perrin kernel: [ 1188.919814] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
Jul 24 12:24:31 perrin kernel: [ 1188.919819] usb 2-1: usbfs: process 4127 (xsane) did not claim interface 1 before use [Second try and scan happens at this point without problem]

Output of syslog during this is:
Code: Select all
Jul 24 12:28:34 perrin kernel: [ 1431.984715] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1 [Open Xsane]
Jul 24 12:28:34 perrin kwin_x11[5145]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 57848, resource id: 79691779, major code: 15 (QueryTree), minor code: 0
Jul 24 12:28:43 perrin kernel: [ 1441.294359] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
Jul 24 12:28:43 perrin kernel: [ 1441.294362] usb 2-1: usbfs: process 12868 (xsane) did not claim interface 1 before use
Jul 24 12:28:51 perrin kwin_x11[5145]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 64978, resource id: 79692791, major code: 15 (QueryTree), minor code: 0 [Error message about Invalid argument]
Jul 24 12:28:54 perrin kernel: [ 1452.314237] usb 2-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
Jul 24 12:28:54 perrin kernel: [ 1452.314240] usb 2-1: usbfs: process 12868 (xsane) did not claim interface 1 before use [Second attempt at scan succeeds]

Here is the ouptut from sane-find-scanner run as user
Code: Select all
found USB scanner (vendor=0x04f9 [Brother], product=0x0263 [MFC-J6710DW]) at libusb:002:002
could not open USB device 0x1d6b/0x0002 at 002:001: Access denied (insufficient permissions)
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.



Any help would be appreciated
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 24th, '17, 20:36

Two steps that needed to be done
1. To get xsane to work as user Brother requires that there be a file /etc/udev/rules.d/60-libsane.rules. It needs, according to them, the line
Code: Select all
ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"
However it should read:
Code: Select all
ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes" ,MODE="0666"
Note the addition of the MODE! This fixes the problem of the error with sane-find-scan.

2. To fix all other errors on scanning the USB cable needed to be moved to a different usb port on the computer. After that everything worked fine! :D
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby doktor5000 » Jul 25th, '17, 08:49

I believe you can also add your user to the "scanner" group that might have also fixed part of the problem.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 25th, '17, 14:53

I had already added myself to the scanner group and to the saned group but it did not solve all the issues.
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby martinw » Jul 31st, '17, 19:17

When you create the file /etc/udev/rules.d/60-libsane.rules, it overrides the standard rules file /usr/lib/udev/rules.d/60-libsane.rules, so the rule at the end of that file:
Code: Select all
ENV{libsane_matched}=="yes", MODE="664", GROUP="scanner", RUN+="/usr/bin/setfacl -m group:lp:rw $env{DEVNAME}"

doesn't get executed. This supplementary rule is what sets the access permissions correctly. Renaming your local file to 59-libsane.rules would prevent it being overridden (the 59- prefix ensures your local rule gets executed first), so should allow everything to work as intended. You might be thankful for this if you ever plug a different scanner into your machine ;-)

Adding GROUP="scanner" avoids the need to make the device world-writable, which your current rule does. You shouldn't need to put yourself in the scanner group - libsane takes care of that for you.
martinw
 
Posts: 609
Joined: May 14th, '11, 10:59

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 31st, '17, 19:54

martinw,
Thank you. When I first looked in /etc/rules.d there was no 60-libsane.rules file. All I had to go on was what I found on the Brother site and while it instructed that the line be added to end of the existing file, there was no file to append. That is why I created it. If I understand, the code you give should be the 60-libsane.rules entry and then I just need to append the Brother information without the mode command and I can then remove myself from the scanner group and be OK. Is that correct?
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby doktor5000 » Jul 31st, '17, 20:06

By default there should be no rule at all in /etc/udev/rules.d/ as that is simply a directory for the system administrator to amend/modify/overwrite the systemwide defaults that come from /usr/lib/udev/rules.d/
This is a general concept that applies to a lot of software projects. It's the same with e.g. polkit or systemd rules/units.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 31st, '17, 20:09

doktor5000 wrote:By default there should be no rule at all in /etc/udev/rules.d/ as that is simply a directory for the system administrator to amend/modify/overwrite the systemwide defaults that come from /usr/lib/udev/rules.d/
This is a general concept that applies to a lot of software projects. It's the same with e.g. polkit or systemd rules/units.


That being said, should not the installation of libsane have resulted in that file being created? Otherwise, when trying to get scanner support, how is one to know to create it?
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby martinw » Jul 31st, '17, 20:51

leon244 wrote:That being said, should not the installation of libsane have resulted in that file being created? Otherwise, when trying to get scanner support, how is one to know to create it?

The installation of libsane installs the default 60-libsane.rules file in /usr/lib/udev/rules.d. If you want to add your own rules, the recommended place is in /etc/udev/rules.d. In particular, don't modify existing files in /usr/lib/udev/rules.d, because your changes will be lost if the package that owns those files gets updated.

The problem you had is due to the default 60-libsane.rules file not having a rule that matches your specific scanner model (it has lots of rules for Brother devices - but not your particular one). Eventually I expect your model will get added to the default rules in libsane upstream, and work its way into the Mageia distribution.

Note that your custom rule needs to be executed before the supplementary rule I quoted - it triggers that supplementary rule via the ENV{libsane_matched}="yes" action.
martinw
 
Posts: 609
Joined: May 14th, '11, 10:59

Re: SOLVED Scanner error: Failed to start: Invalid argument

Postby leon244 » Jul 31st, '17, 21:13

martinw, thank you.
I think I may now understand. I have created 59-libsane.rules in /etc/udev/rules.d and left alone 60-libsane.rules in /usr/lib/udev/rules.d and rebooted. I removed the Mode="0666" in my file and so far all seems to work OK, except for the Gimp plugin that only works if I choose <Device Dialog> from the Create from scan menu and I can live with that.
Again, my sincere thanks for your patience and explanation.
leon244
 
Posts: 108
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA


Return to Printers and Scanners

Who is online

Users browsing this forum: No registered users and 1 guest

cron