LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-10-2017, 10:44 PM   #16
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,480

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080

Quote:
Here is something from the file
Code:

# For Linux >= 2.6.22 without CONFIG_USB_DEVICE_CLASS=y
# If the following rule does not exist on your system yet, uncomment it
# ENV{DEVTYPE}=="usb_device", MODE="0664", OWNER="root", GROUP="root"
0664 will only allow read access to non-root users. It should be 0666 for this to work properly.

So try the following instead
Code:
 ENV{DEVTYPE}=="usb_device", MODE="0666", OWNER="root", GROUP="root"
or else a just create custom Brother rule seting 'lp'group access eg /etc/udev/rules.d/40-Brother.rules
Code:
# Brother MFC-240C
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="01ab", ENV{libsane_matched}="yes", GROUP="lp", MODE="0664"
This will override the existing rule in /lib/udev/rules.d/65-libsane.rules

Last edited by ferrari; 01-10-2017 at 10:46 PM.
 
1 members found this post helpful.
Old 01-10-2017, 10:47 PM   #17
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,480

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
Quote:
There is a configuration file in ~/.sane I think. I read something about getting the message when trying to scan too small an area.
It's safe to delete any existing configuration in ~/.sane and start over if necessary. It will get recreated with any xsane config changes.
 
1 members found this post helpful.
Old 01-11-2017, 07:53 AM   #18
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
Thanks once again ferrari,

I changed the MODE to 666. Same issue. I then made myself a member of the root group an rebooted. Same issue. However, I am not sure I actually had root permissions. I decided to delete the whole OS from the VM before starting over (always wanted to do that :-) but I was denied permission to delete most system files.

I am going to reinstall on the VM just as the Brother script is programmed to do. Then I will login to the gui as root - never have done that but I guess it would work - and see if this is a permission issue.

I am almost afraid to plug the thing into my CentOS 6 desktop as it may no longer work there. Perhaps I should. If it does not work there I can just throw it out and get something made in this millennium
 
Old 01-11-2017, 08:43 AM   #19
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
I installed it again, logged in as root, got scolded and ran xsane. Same error. I plugged it into the original CentOS 6 machine and it scans. Perhaps I can virtualize my physical CentSO 6 PC and run it under VMWare on CentOS 7 when I need to scan something. That will keep me going until 2020. I might figure it out by then or purchase a new scanner.

Actually, the next step will be to look for some error logs. One of the posts you referenced took this approach although I believe that was a networked scanner, not USB connected.

Or I can try to attach it to a Windoze VM. I have one handy which I use on rare occasion. It took THREE DAYS checking for updates last time I fired it up. Found two updates. Came close to getting deleted. I actually relied on an XP VM to run an old flat bed scanner when I first moved to Linux. However, it used a parallel port and when the PC got updated the flat bed got recycled.

Here I go again...
 
Old 01-12-2017, 11:41 AM   #20
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
A don't believe this

After attempting to install and configure this MFC at least 348 times on my test PC under a variety of operating systems, VMWare virtual machines running on my test PC etc.......... I wondered if the MFC might not like the USB on the test PC? So, using the same CentOS 7 VM (originally built on my main PC and copied to the test PC) - I installed the MFC on the CentOS 7 VM while it was RUNNING ON THE ORIGINAL PC. Upon completion of the install I ran xsane as root - figuring I did not want to play with permissions yet - AND IT SCANNED I then went about getting the cups deamon running and ran the install again as the printer part had not installed correctly without access to cups. Upon completion of this exercise I ran xsane as a humble user. AND AGAIN IT SCANNED

For my next trick I am going to copy the working VM installation to the test PC and test it. I will also look at all of the various issues/fixes which are discussed in this thread and see what I can see. Then it is time to buy a new PC, install CentOS 7 and try again. Or run the VM on the new PC and use that for scanning (if it works). Or dispose of my collection of 5 PCs and two servers then purchase a tablet and spend the rest of my life running my finger over the screen like a chimpanzee

Ken
 
Old 01-12-2017, 11:46 AM   #21
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,480

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
Outstanding perseverance skills. Well done
 
Old 01-12-2017, 12:21 PM   #22
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
Thanks but the CentOS 7 VM will not scan on the CentOS 7 test PC. I tried the USB2 and USB3 ports - same issue (Invalid argument). I tweaked the USB properties in the VM settings etc. No change. So at the moment the ancient MFC will work only on an equally ancient PC.

To close the loop (noose) on this thing I tried connecting the MFC to the ad-on USB3 card which I added to the original PC (which was made before USB3 was invented I think.) NO SCAN. I ran the CentOS 7 VM on the original PC. NO SCAN. I wonder if there is a BIOS update for the MFC??? I suppose I need to look at the manual for the thing - it actually has a paper one!

And the manual says at least a Pentium processor with 32 MB of RAM is required. The receipt stapled to the front of the manual indicates I paid $53.89 US after a couple of sale/discount codes. It is a good thing I am retired. It would not be worth my time trying to hook this thing up if I was billing for it.

I guess I need to get a new PC and dedicate the old PC and old MFC as a scanning kiosk - for those rare times I need to scan something. I was going to do something this week but I forget what. I don't think it was this adventure

Thanks again ferrari for all your input and encouragement!

Ken
 
Old 01-12-2017, 12:25 PM   #23
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
I am marking this thread SOLVED even though the solution seems to be to get a new MFC to work with a more modern PC. There is a lot of good troubleshooting information in the thread which might help someone and it is more likely to be read if marked SOLVED.

Ken
 
Old 01-12-2017, 01:58 PM   #24
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,480

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
Quote:
Thanks but the CentOS 7 VM will not scan on the CentOS 7 test PC. I tried the USB2 and USB3 ports - same issue (Invalid argument). I tweaked the USB properties in the VM settings etc. No change. So at the moment the ancient MFC will work only on an equally ancient PC.

To close the loop (noose) on this thing I tried connecting the MFC to the ad-on USB3 card which I added to the original PC (which was made before USB3 was invented I think.)
Yes, it is true that some USB 2 devices do not play nicely with USB 3 host controllers (using the XHCI driver), and sometimes enabling legacy USB support in the BIOS or disabling USB 3 functionality can help.
 
Old 01-12-2017, 02:20 PM   #25
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
The test PC only has options to "Disable external USB" which would be interesting as the only keyboard connector is USB - sort of hard to Press F2 to get back in to re-enable And a choice to "enable USB debug" which I did but I have no idea where any debug info is written.

I do have a REALLY ANCIENT Pentium 4 desktop repurposed as a server with Ubuntu Mate 16.04 on it. I do not think even USB 2 was invented back then. I only boot it up when I need to look for some old backup data on its data drives. I guess I might install xsane and the scanner and see if it works over tigervnc as I do not generally have a monitor connected to it.

As I have a few workarounds such as run CentOS 6 until it expires in 2020 or the PC or the MFC expires - which ever comes first I think I am getting into the region of diminishing returns. Of course if I get bored I may investigate the XHCI driver.

Thanks once more!

Ken
 
Old 01-13-2017, 06:09 PM   #26
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
Late yesterday evening I installed xsane and the scanner - using the Brother provided script - on my really ancient Pentium 4 desktop now ersatz server running UbuntuMate 16.04. The installation went smoothly. I can scan AS ROOT. So now I have a machine which I can apply all of the various techniques discussed in this thread and examine things step by step to see what fixes what. I have taken a beak from scanner fighting today but will get back on it this weekend. I will post some commentary as to what impact group membership, udev rules etc. have. Just for posterity.

Ken

p.s. The "server" has 6 TB of storage. That is probably more than the amount of DASD in the corporate data center of the company where I worked when I purchased the PC. And our data center typically placed in the top 5 largest data centers in the State of North Carolina in those days. Amazing!
 
Old 01-16-2017, 04:12 PM   #27
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
In an effort to provide troubleshooting help to someone else with a similar issue I have documented my step by step testing on a PC which WILL run the scanner. The previous posts in this thread, while valid, were rendered ineffective due to the inability of the scanner to communicate with the newer USB 3 controller (at least that seems to be the reason).

The ancient MFC240c is connected to a USB port on an even more ancient Dell Dimension 4600 PC running Ubuntu Mate 16.04 (32 bit). The USB ports are all 2.0. The drivers from Brother are installed with the Brother provided script. The scanner will scan if xsane is run as root. However, a humble user account gets the dreaded "Failed to start scanner: Invalid argument" error.

Oh where, oh where is the scanner?
Code:
ken@taylor09:~$ sane-find-scanner 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
could not open USB device 0x04f9/0x01ab at 005:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 005:001: Access denied (insufficient permissions)
could not open USB device 0x0a81/0x0205 at 004:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 004:001: Access denied (insufficient permissions)
could not open USB device 0x046d/0xc51b at 003:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 003:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0001 at 002:001: Access denied (insufficient permissions)
  # No USB scanners found. If you expected something different, make sure that
  # you have loaded a kernel driver for your USB host controller and have setup
  # the USB system correctly. See man sane-usb for details.
Very interesting. Let us see what root can see
Code:
root@taylor09:/home/ken# sane-find-scanner 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04f9, product=0x01ab) at libusb:005:002
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.
Let us see what the permissions are on this USB device
Code:
root@taylor09:/dev/bus/usb/005# ll
total 0
drwxr-xr-x 2 root root       80 Jan 15 09:29 ./
drwxr-xr-x 7 root root      140 Jan 15 09:26 ../
crw-rw-r-- 1 root root 189, 512 Jan 15 09:35 001
crw-rw-r-- 1 root lp   189, 513 Jan 15 09:29 002
It looks like membership in the group lp is the requisite to access the scanner. Am I in that group?
Code:
root@taylor09:/dev/bus/usb/005# groups ken
ken : ken adm cdrom sudo dip plugdev lpadmin sambashare
No I am not, let me join. Might be worth checking on what lpamin does, not sure if it is related to lp.
Code:
root@taylor09:/dev/bus/usb/005# usermod -a -G lp  ken
root@taylor09:/dev/bus/usb/005# groups ken
ken : ken adm lp cdrom sudo dip plugdev lpadmin sambashare
Now login via tigervnc and see if I can scan... YES I CAN! That was too easy. Let me get out of the group and explore udev rules.
Code:
root@taylor09:/home/ken# deluser ken lp
Removing user `ken' from group `lp' ...
Done.
root@taylor09:/home/ken# groups ken
ken : ken adm cdrom sudo dip plugdev lpadmin sambashare
In order to make sure that permissions were re-read (and I really no longer had group lp permissions) I killed and restarted my tigervnc session. When I reconnected to the machine I found that I could not even load xsane.
Code:
Failed to open device "brother2:bus1;dev1:Invalid argument.
xsane connects and scans when run with gksu. I have tried powering the scanner off and back on and even rebooting the machine. I can still not scan. Adding mysef back to lp. I have restarted my tigervnc session and I can scan again. Very strange. Now out of lp and back to udev.

My initial efforts with udev rules have been unsuccessful. I suspect that while I was a member of lp I touched something and gave it permissions related to lp. Let me restore the OS from my recent Clonezilla snapshot - before I installed the scanner.

There will be a minor delay while I resolve a hardware issue...

The PC is back - dirty contacts on the 4 port SATA card or PCI slot. I will now reinstall the scanner with the Brother provided script as was done before.

I located the file /lib/udev/rules.d/40-libsane.rules. It did not contain an entry for the Brother MFC. I added this line as recommended
Code:
 ENV{DEVTYPE}=="usb_device", MODE="0666", OWNER="root", GROUP="root"
I still cannot scan but root can. I power cycled the scanner - to see if that would trigger the rule. No dice. I killed my tigervnc session and started a new one (effectively logout/in) still no scan. Finally I threw in the towel and added myself back to the lp group. After a kill/start tigervnc session I can scan. I think I will leave it at that. At least until I learn more about udev.

Hope this helps someone.

Ken

Update...

I changed the entry in /lib/udev/rules.d/40-libsane.rules to
Code:
# Brother MFC-240C
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="01ab", ENV{libsane_matched}="yes", GROUP="lp", MODE="0664"
as recommended by ferarri. My error. This did not do the trick. I changed the MODE to 0666

LOW AND BEHOLD - I CAN SCAN!!!!! Me, myself and I - no group lp membership required.

Last edited by taylorkh; 01-16-2017 at 05:59 PM.
 
Old 01-16-2017, 04:51 PM   #28
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,480

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
I would just assign it like this...
Code:
# Brother MFC-240C
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="01ab", ENV{libsane_matched}="yes", GROUP="lp", MODE="0664"
 
Old 01-16-2017, 05:27 PM   #29
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
I would have also but I had too many note files open from different attempts and tests and I copied the wrong rule text. I think this is what was recommended by a comment in one of the rule files. Let me boot up the venerable PC and apply the correct rule. I will update the post on what happens.

Thanks,

Ken

p.s. It worked when I used your code and changed mode to 0666 - as I think we discussed in this thread about 4 years ago

Last edited by taylorkh; 01-16-2017 at 06:01 PM.
 
Old 01-16-2017, 06:11 PM   #30
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,100

Original Poster
Rep: Reputation: 166Reputation: 166
The new PC I am looking at - Dell Precision Workstation 3620 has a legacy PCI (not express) slot. Perhaps I can find a legacy USB 2 card on evilbay and hook the scanner to it. Of course it might work on the workstation as is. Who knows. I do have two Poweredge servers a T20 and a T130. I guess I need to install the scanner on one of them and see what happens. I run the OS (CentOS 7 + Mate) from 16 GB tiny USB 3 flash drives so I can pop the OS out, take a snapshot with Clonezilla and restore it to normal after the test. I will do that this week.

My current priority project is to hook an encrypted partition on the host to a VMWare client. I connected a normal partition to a VM but I had to run VMWare workstation as root to make the connection. I can not run the VM as me. I changed permission of the VM files that were changed while connecting the partition back to me but then the VM would not run at all. I guess I need to do a little more reading

Ken
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Brother MFC-J5910DW 100949football Linux - Newbie 40 07-26-2015 05:48 AM
My brothers MFC j430w printer,prints but won't scan, I'm using xsane scan program , jbander Linux - Hardware 4 08-01-2013 05:04 PM
Brother MFC-J280W Printer will only print image files, not text files, won't scan. bplis* Linux - Software 4 11-28-2011 08:34 AM
Brother Mfc-240c owa Linux - Hardware 1 01-21-2008 03:56 PM
Brother MFC-210C juman Slackware 1 02-22-2007 08:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration