Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been attempting to get CUPS, hplip, foomatic, and SANE setup on my NAS box for a few months now, trying various different things, yet nothing seems to work. If I started describing the what I've done from the start, this post would be so long that no one would read it. So here's a quick rundown...
The printer I have is an HP PSC 2355 "all-in-one" with scanning ability, connected via USB. It is supported through the HP PSC 2350 Foomatic/hpijs driver.
I currently see four problems:
1) CUPS refuses to print anything. Sending a test page through the admin interface adds the job to the queue, but no error message is generated, and the job just sits there doing nothing.
2) The hplip tools work to some degree. I can use hp-probe, hp-info, hp-levels (which properly reports the ink levels), and hp-align (which properly prints an alignment page). hp-print and hp-testpage look like they send the job to CUPS, but again the job just sits there and never prints.
3) I must run the hplip tools as root, or else I get this error:
Code:
error: Unable to communicate with device (code=12): hp:/usb/PSC_2350_series?serial=MY563F10J6KJ
4) Trying to scan with "scanimage -L" gives an error that SANE couldn't find the device, however running "sane-find-scanner" properly finds the device on the attached USB port.
To me, it sounds like that the USB communication is working correctly (the hplip tools work), but there is a permission problem somewhere that is not allowing non-root users to access the USB interface. I'm assuming this is probably also why CUPS never gets anywhere.
I'm currently using the latest version of everything (CUPS-1.4svn-r7582, hplip-2.8.5, foomatic-3.0.2), but I've been trying earlier versions as well (CUPS-1.3.5, hplip-2.7.12) with no success. Everything is built from source tarballs, since the Linux installed on my NAS box does not have any kind of package management.
Any tips or suggestions would be greatly appreciated -- hopefully before I go bald from pulling out all of my hair. If anyone wants to see any log files, please ask and I will post them.
Welcome to LQ!
I'd start by looking at permissions & groups.
I don't know what variant of linux you are running on your NAS, but it may be fairly simple if all it was designed for is running NAS (="Network Attached Storage", No?)
What are the permissions, owner & group of the device /dev/lp (or whatever you printer is detected as)?
What groups are you a member of?
Quote:
sane-find-scanner" properly finds the device on the attached USB port.
Again, what are the permissions / owner / group of the scanner, and what groups are you in?
I need to be a member of plugdev lpadmin and scanner (amongst others) for my system to work, but your distro's setup may be entirely different.
I'd start by looking at permissions & groups.
I don't know what variant of linux you are running on your NAS, but it may be fairly simple if all it was designed for is running NAS (="Network Attached Storage", No?)
The actual Linux variant is listed as "hardhat". It is a NAS box, but I'd like to make a print server out of it as well, since it has a single USB port.
I should mention it already functions as a mail server (qmail+SpamAssassin+courier-imap), and a web/svn server (apache+php+mysql) all built from source tarballs and installed by myself, so I know my way around the box. However, this is my first attempt at doing any kind of printing on Linux, so I'm a bit lost.
Quote:
Originally Posted by tredegar
What are the permissions, owner & group of the device /dev/lp (or whatever you printer is detected as)?
What groups are you a member of?
It seems I have no /dev/lp device. I don't know if this is a problem or not, but I do have a few similar devices:
Yours is a USB printer, and I am not sure how you have USB set up.
I use udev for USB devices and it creates mountpoints dynamically as things are plugged in and detected. udev also assigns group, ownership and permissions to the device when it is created.
Any changes you make (eg chmod 666 /dev/lp0) will not survive a reboot, or re-plugging, so it is best to make sure you are in the right groups.
If you want your printer or scanner always to be mounted to a known location, you'll need to write some udev rules (See here: http://www.reactivated.net/writing_udev_rules.html
You need to find out where your printer is being mounted, it may be at /dev/lp0
You then need to do a ls -l /dev/lp0 to see the group and permissions
Same for your scanner (mine turns up at /dev/bus/usb/003/002 ) and there's no symlink to something pretty like /dev/scanner
Code:
tredegar@home:/$ sane-find-scanner
found USB scanner (vendor=0x055f, product=0x021f [USB Scanner], chip=GT-6816) at libusb:003:002
tredegar@home:/$ ls -l /dev/bus/usb/003/002
crw-rw-r-- 1 root scanner 189, 257 2008-05-21 18:07 /dev/bus/usb/003/002
tredegar@home:/$ ls -l /dev/lp0
crw-rw---- 1 root lp 6, 0 2008-05-21 17:43 /dev/lp0
It is possible that you need to be in some other group(s) for you to be able to administrate the printer or scanner.
The groups I am in are
Code:
tredegar@home:/$ groups
tredegar adm dialout cdrom floppy audio dip video plugdev lpadmin scanner admin
The ones in red are the ones I think you should look especially carefully at.
Quote:
I noticed the /dev/usb/scanner[0-9] permissions were set as 600, so I tried setting them to 666 and changing the group to lp.
Noooo!, the scanner needs to be in the group scanner, as do you. And remember what I said about udev above. Changes you make are transient
Your problem is that this is a "DIY" installation (and all credit to you for having got this far without resorting to LQ!).
Modern distros all set up the required groups and permissions when you install something. But you have to sort all this out yourself.
Yours is a USB printer, and I am not sure how you have USB set up.
I use udev for USB devices and it creates mountpoints dynamically as things are plugged in and detected.
I'm not completely sure I even have USB set up properly myself...
Unfortunately, I cannot use udev since it requires a 2.6 kernel. My 2.4.17 kernel is burned into EEPROM, and I'd rather avoid reflashing it.
Quote:
Originally Posted by tredegar
You need to find out where your printer is being mounted, it may be at /dev/lp0
You then need to do a ls -l /dev/lp0 to see the group and permissions
Same for your scanner (mine turns up at /dev/bus/usb/003/002 ) and there's no symlink to something pretty like /dev/scanner
Doing an lsusb gives me:
Code:
root@kuro-box:~# /usr/sbin/lsusb
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 002 Device 002: ID 03f0:4911 Hewlett-Packard
Bus 001 Device 001: ID 0000:0000
I don't have a /bus/usb directory in /dev, but I do have one in /proc:
Code:
root@kuro-box:/proc/bus/usb/002# ls -la
total 1
dr-xr-xr-x 1 root root 0 Feb 29 08:11 ./
dr-xr-xr-x 1 root root 0 Feb 29 08:11 ../
-rw-r--r-- 1 root root 18 May 21 18:23 001
-rw-r--r-- 1 root root 18 May 21 21:24 002
...I presume this is it? Maybe?
I doubt that any of the /dev/lp* devices actually point to the printer, since they have a device node of 6 (parallel port), and my NAS box doesn't even have parallel port hardware on it.
SANE gives this (rather lengthy) output to me:
Code:
bpoint@kuro-box:~$ 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.
# Also you need support for SCSI Generic (sg) in your operating system.
# If using Linux, try "modprobe sg".
found USB scanner (vendor=0x03f0, product=0x4911) at libusb:002: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.
# Not checking for parallel port scanners.
# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.
It does seem to find my USB printer/scanner, even as non-root.
Quote:
Originally Posted by tredegar
It is possible that you need to be in some other group(s) for you to be able to administrate the printer or scanner.
After looking over your /etc/group, I noticed a few things:
1) I don't have a cupsys user. cupsd is running as root, but seems to spawn processes as daemon (the perl processes that were started when I tried to print a test page, they stay hung and never go anywhere -- there are also a few other hung processes, like python and ghostscript):
3) I don't have a plugdev group (is this part of udev?).
Quote:
Originally Posted by tredegar
Noooo!, the scanner needs to be in the group scanner, as do you. And remember what I said about udev above. Changes you make are transient
Heheh, ok well, I'll change the permissions back.
Remember my printer is an "all-in-one" device -- the scanner is built into it. So putting the scanner device into the scanner group would effectively put the printer into the same group as well.
Quote:
Originally Posted by tredegar
Your problem is that this is a "DIY" installation (and all credit to you for having got this far without resorting to LQ!).
Modern distros all set up the required groups and permissions when you install something. But you have to sort all this out yourself.
I don't have a problem with doing things myself. It's just that the CUPS installation documentation is severely lacking. I did Google a bit and found some similar posts regarding unable to print over USB, but either they're unanswered or they don't have the same problem as I do.
I probably should have posted this earlier, but this is what /var/log/messages looks like, when I reconnect the USB connection and turn the printer on:
Code:
May 22 04:11:33 kuro-box kernel: hub.c: new USB device 00:0e.1-1, assigned address 3
May 22 04:11:33 kuro-box kernel: printer.c: usblp0: USB Bidirectional printer dev 3 if 1 alt 0 proto 2 vid 0x03F0 pid 0x4911
May 22 04:11:33 kuro-box murasaki.usb[18336]: beep is defined as "off"
May 22 04:11:33 kuro-box murasaki.usb[18336]: usb device is added
May 22 04:11:33 kuro-box murasaki.usb[18336]: vendor:0x3f0 product:0x4911 Dclass:0x0 Dsubclass:0x0 Dprotocol:0x0 Iclass:0xff Isubclass:0xcc Iprotocol:0x0
May 22 04:11:33 kuro-box murasaki.usb[18336]: MATCH(printer) -> match_flags:0x183 vendor:0x3f0 product:0x4911 Dclass:0x0 Dsubclass:0x0 Dprotocol:0x0 Iclass:0xff Isubclass:0xcc Iprotocol:0x0
And this gets spit out when I send a test page to print through the CUPS web administation interface:
Code:
May 22 04:12:15 kuro-box PSC_2350_series?serial=MY563F10J6KJ: io/hpmud/musb.c 135: unable get_string_descriptor -1: Operation not permitted
May 22 04:12:15 kuro-box PSC_2350_series?serial=MY563F10J6KJ: io/hpmud/musb.c 603: invalid product id string ret=-1
May 22 04:12:15 kuro-box PSC_2350_series?serial=MY563F10J6KJ: io/hpmud/musb.c 1058: unable to open hp:/usb/PSC_2350_series?serial=MY563F10J6KJ
May 22 04:12:15 kuro-box PSC_2350_series?serial=MY563F10J6KJ: prnt/backend/hp.c 675: INFO: open device failed; will retry in 30 seconds...
May 22 04:12:23 kuro-box hpijs: io/hpmud/musb.c 135: unable get_string_descriptor -1: Operation not permitted
May 22 04:12:23 kuro-box hpijs: io/hpmud/musb.c 603: invalid product id string ret=-1
May 22 04:12:23 kuro-box hpijs: io/hpmud/musb.c 1058: unable to open hp:/usb/PSC_2350_series?serial=MY563F10J6KJ
Again, "Operation not permitted" looks like some program doesn't have proper access to the USB port...
not completely sure I even have USB set up properly myself...
I'm I fear you are setting yourself an impossible task here, but I'll help as I can.
Quote:
Unfortunately, I cannot use udev since it requires a 2.6 kernel. My 2.4.17 kernel is burned into EEPROM,
Oh.
Quote:
Doing an lsusb gives me:
Bus 002 Device 002: ID 03f0:4911 Hewlett-Packard
...I presume this is it? Maybe?
Yes, that is it. And sane-find-scanner can see it too. But not much else it seems.
Quote:
I don't have a /bus/usb directory in /dev, but I do have one in /proc:
I don't think that helps. Even with my 2.6 kernel, I don't think I have a /dev/scanner entry created for me (no scanner to check with at the moment)
Quote:
I doubt that any of the /dev/lp* devices actually point to the printer, since they have a device node of 6 (parallel port), and my NAS box doesn't even have parallel port hardware on it.
Then they are not what you are looking for.
Quote:
found USB scanner (vendor=0x03f0, product=0x4911) at libusb:002:002
sane-find-scanner (as the user bpoint) found the scanner But scanimage can't find / use it.
Quote:
1) I don't have a cupsys user.
2) I don't have an lpadmin or scanner group.
I think you'll need these.
Quote:
3) I don't have a plugdev group (is this part of udev?).
udev maybe, but I think it is required for hal
Quote:
Remember my printer is an "all-in-one" device -- the scanner is built into it. So putting the scanner device into the scanner group would effectively put the printer into the same group as well.
Yes, but all-in-one printers are seen as separate USB devices: One for printer, one for scanner etc.
Your /var/log/messages is interesting. Is a device called usblp0 created somewhere in /dev/ ?
Quote:
Again, "Operation not permitted" looks like some program doesn't have proper access to the USB port...
Yes, we are back at "permissions"
A big part of your problem is that you are using a 2.4 kernel. I never managed to get anything USB working properly on a 2.4 kernel, apart from a USB memory stick, and that only after reading /var/log/messages and manually mounting it every time, which is why I was so pleased to see 2.6 with hal and udev come along.
Maybe you could find some pointers by searching for how to set up cups and a scanner for something like "Linux from Scratch" (AKA LFS) with a 2.4 kernel.
But, I suspect you are setting yourself a difficult task: Persuading a NAS server to be a print server as well, when the installed OS is non-standard, and an "old" kernel is asking for grief and a major headaches.
I'm I fear you are setting yourself an impossible task here, but I'll help as I can.
Thanks, your patience is much appreciated.
Quote:
Originally Posted by tredegar
Yes, that is it. And sane-find-scanner can see it too. But not much else it seems.
Let's put SANE off for now. I think that once I can get CUPS to start printing properly then SANE will quickly fall into place later.
Quote:
Originally Posted by tredegar
Quote:
Originally Posted by bpoint
1) I don't have a cupsys user.
2) I don't have an lpadmin or scanner group.
I think you'll need these.
I can add them, but I don't think it would really make a difference. I don't see anything in /var/log/messages that shows that they are being requested and not found. I could be wrong though...
Quote:
Originally Posted by tredegar
Your /var/log/messages is interesting. Is a device called usblp0 created somewhere in /dev/ ?
No, I don't have a /dev/usblp0 device. However, I decided to try something different:
Running the above script successfully printed out the words "Hello World" on a sheet of paper -- and it worked as both root and non-root.
I believe I can now say the USB functionality is working just fine, and the problem here is CUPS's communication with the USB interface, for whatever reason...
Quote:
Originally Posted by tredegar
A big part of your problem is that you are using a 2.4 kernel.
Hopefully the above test I just did proves that a 2.4 kernel can still do USB.
Quote:
Originally Posted by tredegar
Maybe you could find some pointers by searching for how to set up cups and a scanner for something like "Linux from Scratch" (AKA LFS) with a 2.4 kernel.
Not a bad idea. Since I've started to be able to narrow the problem down to CUPS, I might try posting on their forums... but I don't think I'll get much of a response.
Quote:
Originally Posted by tredegar
But, I suspect you are setting yourself a difficult task: Persuading a NAS server to be a print server as well, when the installed OS is non-standard, and an "old" kernel is asking for grief and a major headaches.
Is this really worth the time and effort?
The challenge is the best part of it!
I'm still open to other suggestions/tests, but if you've run out of ideas, that's fine. I appreciate what you've been able to help me out with so far.
And I'll go see if maybe I can figure out just where CUPS is misbehaving at...
Well, at least you know where your printer is now, and USB is working fine. When you last tried to set up cups, where did you tell it to find your printer? Perhaps you just said "USB", and it found it. It has been a while since I last used cups, as everything is working at the moment.
Quote:
The challenge is the best part of it!
I understand.
Quote:
And I'll go see if maybe I can figure out just where CUPS is misbehaving at...
Maybe your version of cups is too new for a 2.4 kernel? I know it shouldn't make any difference, but ...
<Visits the attic to boot an ancient PC: Kernel is 2.4.21 cups is 1.1.19>
And there are a couple of potential trip-points eg. Make sure the printer is set as the defult, and "enabled".
run lsusb and find your printer -- which you did let's suppose it shows
Bus 0WX Device 0YZ: ID ????:???? Hewlett-Packard
the usb dirname and filename 0WX and 0YZ are significant
then chmod 666 /proc/bus/usb/0WX/0YZ
You even noticed that you had this usb subdirectory in /proc but I guess didn't think it relevant. It is!
To get the scanner working, I found I had to tell scanimage the device explicitly like so -- for me
scanimage [--format=tiff] \
-d "hpaio:/usb/officejet_d_series?serial=SG28N520B3RQ"
the hpaio is the sane-hpaio backend from hplip and for the part following the :/usb/, substitute the name in the error message, so in your case I think it would be
-d "hpaio:/usb/PSC_2350_series?serial=MY563F10J6KJ"
hp-probe, which you mentioned, also may tell you the device uri except that it shows it as
hp:/usb/xxxx
and if you use this as uri, change the hp: to hpaio:
It may not apply in your case, but hplip and friends have dependencies not actively installed when they are installed (depending on your distro).
gs-esp
pnm2ppa
And probably many others I'm not recalling off the top of my head. It could be that you have everything right, you're just missing some supporting libs. I had a similar issue as yours with one of my HP printers. Which got fixed when I installed a supporting lib not marked as a dependency. It was hinted at in /var/log/* (dmesg / messages?) or some localhost:631 log / status page. It was quite a while ago. And was not easily identified.
It's been a while since I've replied to this thread, but I'll summarize what I know and what I've found out in the meantime.
CUPS actually has been working just fine from the start. If I set the printer driver to use the usb:/ driver instead of the hp:/ one, I don't have any problems with printing. Since I discovered this, I left it as-is since I was able to print, and I haven't needed to scan anything since then.
So the problem was with hplip, in my case.
John: I actually tried chmod 666'ing the /proc/bus/usb driver. It didn't have any affect, and what's worse is when the printer is switched off and back on, it's assigned a different address (instead of 002:001 the next time it becomes 002:002, and so on...), and the new address has the default permissions (644, I think) set again. Even if the chmod did temporarily solve the permissions problem, it wouldn't be an ideal situation.
The hpaio:/ driver is new to me, however, so I will give that a try. Plus it seems hplip has had a few version updates since this old post. Maybe whatever it was has been fixed already.
Shadow_7: There's no package management on my NAS box, so I do everything by hand. I've already made sure all of the necessary dependencies are installed, though.
re the chmod problem with the printer address changing on every plug :
If you have hotplug(*),
You can call a script from /etc/hotplug/usb.agent to do something like(**)
[ "${DEVICE}" = /proc/bus/usb/* ] && chmod 0666 ${DEVICE}
but if that didn't work for you , then I suppose only of adademic interest
(*) better to use udev rules but that didn't work for me - not invoked for my printer
(**) I had trouble using the ${DEVICE} exported by hotplug and just checked all devices in /proc/bus/usb/device for a match on
$(egrep -e "^T:.*Bus=.*Dev#|Manufacturer=Hewlett-Packard" /proc/bus/usb/devices);
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.