LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Setting up Galeon/Mozilla to print (https://www.linuxquestions.org/questions/slackware-14/setting-up-galeon-mozilla-to-print-36988/)

MasterC 12-01-2002 03:17 PM

Setting up Galeon/Mozilla to print
 
I have my printer installed via CUPS, it works fine and I can print webpages from konqueror, but I cannot get Galeon/Mozilla to print.

When I open up a page for printing, I type the name of the printer, and then click "print" but nothing happens. I don't even know where to start or what to tell you guys, so if you need more info, let me know I will be glad to tell you whatever you need.

Oh, the printer might help ;)

It's an HP DeskJet 932C connected via USB. I can administer my printer via the http://localhost:631 thing, and things work fine from there.

So anyway, any suggestions on things to try, or pages on such things would be great thanks :)

Oh the device is: /dev/usb/lp0

Cool

<edit>

Ok, well I just tried printing a test page from the CUPS setup page using http://localhost:631 But no luck. It didn't print at all. I then thought maybe I had also lost the ability with konqueror, but nope, it still prints just fine. :(

So I am even more lost now, any suggestions at all would be great, thanks
</edit>

LNXman 12-01-2002 03:32 PM

Are you just inputing the printer name in the Printer input textfield? You should only have the lpr command (or printing comand) in it, although sometimes you need to put the command with the printer name in the event the lpr program can't determine the printer to use(i.e. lpr -P<printer_name>).

To give you a better idea of what is going on, check your ~/.xsession-errors log file in your account.

GL

NSKL 12-01-2002 03:35 PM

well first can you send a file directly to the printer (as root)
cat any-ascii-file > /dev/usb/lp0 and get the file printed that way? If that works then the printer works, but maybe the filters don't (in other words CUPS). Now i never used CUPS but only APSfilter so some of my suggestions might be incorrect, but its worth trying.
So you get a page printed by directly sending it to the printer device.
Then lets try if you can send it via lpr.
lpr -P Epson penguin.txt would send a cute ascii text file of a penguin to my printer via lpr (lpd daemon) through APSfilter, so the filters get applied. That means lpr works, and if lpr works every app should be able to use the prineter.
with lpr command you need to use the -P flag and specify the name of your printer (as configured in /etc/printcap - but CUPS mught have it setup differently)
So from any application, such as gedit in "print command" field enter lpr -P YourPrinter and it should print if the lpr test you made before worked.
In case lpr test didnt work, check the logs, i think CUPS has it's seperate logfile that might give some clue on whats wrong.
I think i made this post much loonger than it needed to be, sorry for that!
Hope that helps anyway!
-NSKL

EDIT: Damn you LNXman! You posted just while i was writing my post! :D

Excalibur 12-01-2002 03:35 PM

Since Konqueror is a KDE app, I would suppose that it using kprinter to print to CUPS. The others are not KDE apps and I would think they would expect to look in the file /etc/printcap for the available printers to use the standard lp print command. CUPS defaults to an empty printcap file these days. So you might try to add the printer name in the printcap file and retest. The entry is just a single line per printer followed by a colon for CUPS. Example:

printer_name:

However, this doesn't explain why the CUPS test page didn't print though.

Cheers!

LNXman 12-01-2002 03:44 PM

Quote:

Originally posted by NSKL

EDIT: Damn you LNXman! You posted just while i was writing my post! :D

Sorry, it is a slow day for me.

Going to eat now, so you better take advantage . . .;)

L8

MasterC 12-01-2002 06:09 PM

Thank you all for your speedy answers, but to no avail :(

Ok, here's what I have from your ideas:

LNXman:
Yes, I just had the printer name in the "printer" field. From your suggested example I used:
lpr -P DeskJet932C

DeskJet932C is what I named my printer, but still nothing. Oh and I don't have an ~/.xsession-errors file, so I can't check there for errors, thanks for the suggestions though..

NSKL:
cat any-ascii-file > /dev/usb/lp0 works as root... sort of. It sends something to my printer, but my printer ends up sending me a blank page, this might be part of my problem, but further down the chain of events.

lpr -P DeskJet932C also sends something to the printer because it starts making the sounds like it's ready to print, sends paper to the print head and in fact prints the file. So that appears to work. Which is leading me to believe I need to change perms on /dev/usb/lp0 but I am not sure on that yet.

Ok, so now it appears I am getting somewhere, but not sure what to do now.

Excalibur:

Yes you are correct sir, it is using kprinter. Here is the contents of my /etc/printcap file:

Code:

root@masterc:/home/masterc# cat /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file.  All changes to this file
# will be lost.
DeskJet932C:
USB_Printer:
root@masterc:/home/masterc#

And as the file says, here's the contents of my /etc/cups/printers.conf file:
Code:

root@masterc:/home/masterc# cat /etc/cups/printers.conf
# Printer configuration file for CUPS v1.1.15
# Written by cupsd on Mon Nov 25 06:16:43 2002
<DefaultPrinter DeskJet932C>
Info /dev/usb/lp0
Location DeskTop
DeviceURI usb:/dev/usb/lp0
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>
root@masterc:/home/masterc#

So now I am sort of back to square one, but with a little more knowledge. Right now I will try changing perms and see how things go.

Cool

MasterC 12-01-2002 06:19 PM

Well it appears that I still cannot print as a user, or as root since I just tried that as well, at least not from a browser. Like I said, that command line worked, but not in the browser. I tried all kinds of variations, here's the latest:
lpr -P DeskJet932C:

But it doesn't work, along with removing the colon or not. Not as root or as a regular user.

Anymore ideas, or need anymore info? I will poke around for a CUPS logfile to see what it says, thanks for the ideas so far.

Cool

MasterC 12-01-2002 06:24 PM

Ok, so I found cups error log, here it is:
ftp://masterc.no-ip.org/share/cups-error_log

I thought it'd be way to big to post here, so there's a link to a copy of it.

Lots of errors, hmm...

Thanks for looking at it and any suggestions from it.

Cool

LNXman 12-01-2002 08:10 PM

Quote:

Originally posted by MasterC

Yes, I just had the printer name in the "printer" field. From your suggested example I used:
lpr -P DeskJet932C

DeskJet932C is what I named my printer, but still nothing. Oh and I don't have an ~/.xsession-errors file, so I can't check there for errors, thanks for the suggestions though..

O.K. then since you say you are having problems printing with the command line. Do this quick check. Check if you have both lprng and cups installed. If you do, then that can cause problems as well. I recently had problems with my whole printing system a couple of days ago, and traced it back to when I installed cups after lprng. Apparently cups over wrote some of the files and apps lprng uses and mayhem began . . . In short, nothing worked. In the event you have both printing services installed, I would sugges eliminating the one you don't use (in my case it was cups). After that, everything was back to normal.

Other possible causes are:
- Problems with the gimp-drivers (check the requirements for your driver if any)
- Using the wrong driver: Your printer should be using the "hpijs" driver Check this link out.
- what does the directory /proc/bus/usb have in it? Do you see your device there? If not, Do you have the /proc/bus/usb mounted with your fstab (i.e. none /proc/bus/usb usbdevfs gid=3,mode=660 0 0)? That could also cause problems . . .

Aside ---
What? no .xsession-errors? Do you run XFree86 at all? (I assume so since you are running Galeon) Everone has one in their home directory. . . weird, because errors comming from Galeon are sent there . . .

BTW ---
I assume that when you use the lpr command line, your actual test command is like this: lpr -PDeskJet932C <file> or cat <file> > /dev/usb/lp0. Also make sure the :lp= section of your printcap actually says: :lp:=/dev/usb/lp0:.
GL

P.S. Why did you use the lpr -P <printer_name> for the input in Galeon when you don't know if it does not see it? did you test by passing just the lpr command alone. I say this, because Galeon maybe screwing the command up in the background. . .Then again, you have to look at the error log for that. . . In my case I just pass it the lpr command on my machine because I only have one printer defined on my workstation. . .

//edit: Added P.S.

Excalibur 12-01-2002 09:08 PM

Thanks for posting the log file and the others. Your printcap and printers.conf look OK. And the colon is only a delimitor in the printcap file not part of the printer name. The printcap file's history is from BSD and that uses a colon to delimit items for a printer definition. So programs expect it after the printer name.

Well, it might be a permission issue. Your log file suggest that the problem has always been there. And also, it still puzzles me why the test page from inside CUPS didn't print. It might be you attempted that back on the 24NOV when you defined the printer. The error always states the same thing "No pages found!" like it was expecting input but never received it. If you want to turn the debug level on then the setting is in the /etc/cups/cupsd.conf file. Mine is currently set to "info". The CUPS daemon will probably need to be restarted. Don't forget to turn it back though.

I can also concur with LNXman on the compatibility problem. CUPS installs it's own lp, lpr, etc. programs. So it cannot coexist with any BSD style printing system. One does have to make the choice. I think that is why Slack installs apsfilter as a default instead of CUPS. If lpr or LPRng were installed after CUPS, they would overwritten the print programs from CUPS. That might explain why kprinter will work. If that is the case then reinstall the CUPS package or switch to apsfilter.

As for the permisions, the CUPS daemon runs as user=lp and group=lp. Both should exist in /etc/passwd and /etc/group. The lp group should have read/write permission on the /dev/usb/lp devices. I think that is OK because you stated that kprinter can print OK and I think the daemon would need that to print anything to the device. The /var/spool/cups directory should be owned by lp and have full permissions. The /var/spool/cups/tmp directory should also be owned by lp with full permissions with the sticky bit set.

I think I found the source to a problem I have had with CUPS as well from reviewing my logs. If a job is submitted by "root" and is owned by "root" the daemon cannot hold or cancel the job, doesn't have the rights. This may be related to the /var/spool/cups/tmp directory files. Because I have also noted it depends on how the job was submitted, like your galeon print issue. Some jobs can be cancelled and some cannot. I think that the kprinter jobs can be cancelled or placed on hold. Well I think kprinter usually uses files to submit print jobs and not stdin but it might also use the full path to print a job file and not use the CUPS tmp directory. And kprinter might also be using the lp user/group as well. I will need to check on it some more.

Well perhaps this info has helped in some way.
Cheers!

Edit/Followup: The problem I described above was resolved by adding security to the Jobs section of the cupsd.conf file to allow authentication for job control. This would not be related to your problem. Cheers!

MasterC 12-02-2002 01:43 AM

Quote:

Originally posted by LNXman
O.K. then since you say you are having problems printing with the command line. Do this quick check. Check if you have both lprng and cups installed. If you do, then that can cause problems as well. I recently had problems with my whole printing system a couple of days ago, and traced it back to when I installed cups after lprng. Apparently cups over wrote some of the files and apps lprng uses and mayhem began . . . In short, nothing worked. In the event you have both printing services installed, I would sugges eliminating the one you don't use (in my case it was cups). After that, everything was back to normal.

Other possible causes are:
- Problems with the gimp-drivers (check the requirements for your driver if any)
- Using the wrong driver: Your printer should be using the "hpijs" driver Check this link out.
- what does the directory /proc/bus/usb have in it? Do you see your device there? If not, Do you have the /proc/bus/usb mounted with your fstab (i.e. none /proc/bus/usb usbdevfs gid=3,mode=660 0 0)? That could also cause problems . . .

Aside ---
What? no .xsession-errors? Do you run XFree86 at all? (I assume so since you are running Galeon) Everone has one in their home directory. . . weird, because errors comming from Galeon are sent there . . .

BTW ---
I assume that when you use the lpr command line, your actual test command is like this: lpr -PDeskJet932C <file> or cat <file> > /dev/usb/lp0. Also make sure the :lp= section of your printcap actually says: :lp:=/dev/usb/lp0:.
GL

P.S. Why did you use the lpr -P <printer_name> for the input in Galeon when you don't know if it does not see it? did you test by passing just the lpr command alone. I say this, because Galeon maybe screwing the command up in the background. . .Then again, you have to look at the error log for that. . . In my case I just pass it the lpr command on my machine because I only have one printer defined on my workstation. . .

//edit: Added P.S.

Ok, cool thanks for all the ideas, here's a go:

I uninstalled lprng as it was installed.

/proc/bus/usb is completely empty, yet I use several usb devices (mouse, memory stick reader, and printer), and the mouse and mem stick reader work fine...

And no, it's not mounted via fstab as far as I can tell, but here's what that looks like:
Code:

masterc@masterc:~$ cat /etc/fstab
/dev/hda5        /            ext3        defaults                1  1
/dev/hda6        /home        ext3        defaults                1  2
/dev/hda7        /mnt/lfs    ext3        defaults                1  2
/dev/hdb1        /Debian      ext3        defaults                1  2
/dev/hdb5        /Mandy      ext3        defaults                1  2
/dev/hdb7        /Mandy/home  ext3        defaults                1  2
/dev/hda1        /mnt/windows vfat        users,auto,rw,umask=000 1  0
/dev/hdb6        /mnt/fat32  vfat        users,auto,rw,umask=000 1  0
/dev/cdrom      /mnt/cdrom  iso9660    noauto,users,owner,ro  0  0
/dev/cdrom2      /mnt/cdrom2  auto        noauto,users,owner,ro  0  0
/dev/fd0        /mnt/floppy  auto        noauto,owner            0  0
/dev/sda1        /mnt/sony    auto        noauto,users,rw        0  0
none            /dev/pts    devpts      gid=5,mode=620          0  0
none            /proc        proc        defaults                0  0
masterc@masterc:~$

in case I am not seeing it.

Yeah, I know it's very strange because I know I have seen that file before (~/.xsession-errors), but it's definitely not in my users' home directories, nor root's. Very strange to me, but I don't know what to tell ya. :confused: Also, yes I do use X, so I would think it'd be there too. Here's the output of ls -a from my root's home directory for ya:
Code:

root@masterc:~# ls -a
./                            .gnome_private/    .xfce/
../                            .gstreamer/        .xfce_bkup/
.ICEauthority                  .gtkrc              .xftcache
.RealNetworks_RealMediaSDK_60  .gtkrc-kde          .xine/
.RealNetworks_RealPlayer_60    .gtkyahoo/          .xinitrc
.RealNetworks_RealShared_00    .java/              .xinitrc-backup
.Trash/                        .kde/              .xmms/
.Xauthority                    .kde2/              2002-10-13.tar.bz2
.asoundrc                      .kderc              Desktop/
.bash_history                  .limewire/          LimeWire_InstallLog.log
.cvspass                      .mailcap            Mail/
.ee/                          .mcop/              OpenOffice.org1.0.1/
.eroaster/                    .mcoprc            arson-0.9.6-kde3/
.esd_auth                      .metacity/          arson-0.9.6-kde3.tar.bz2
.file-roller/                  .mime.types        dmesg.save
.fluxbox/                      .mozilla/          flex-2.5.4/
.fonts.cache-1                .mplayer/          flex-2.5.4a.tar.gz
.fullcircle/                  .nautilus/          jordyn02.mpg
.gaim/                        .netscape/          key.sah
.gaimrc                        .netscape6/        lame-3.92.tar.gz
.galeon/                      .pine-debug1        lock.sah
.gconf/                        .pinerc            mail/
.gconfd/                      .qt/                mbox
.gkrellm/                      .sawfish/          mimeinstall.results
.gnapster/                    .sversionrc        pid.sah
.gnome/                        .user60.rdb        plugininstall.results
.gnome-desktop/                .wine/              tmp/
.gnome2/                      .wmWeatherReports/  version.sah
.gnome2_private/              .xcdroast/
root@masterc:~#

So I don't think I am just not seeing it???

Ok, when I test it via command line here's what happens (as root just to make sure it's not permissions even though I have fixed that AFAIK):

When I try:
cat text-file > /dev/usb/lp0

The printer will start moving around, lights flash, the roller turns, brings up paper then waits. After a few seconds the light starts flashing as if it were out of paper, but there is paper in the tray. I press the on/off button and restart the printer. It starts up, spits out my paper it had, and returns to "ready" status. Nothing is on this paper.

When I try:
lpr -P DeskJet932C text-file

It starts up, pulls up the paper, prints the text file on it, spits it out, and returns waiting in "ready". So this works, and just fine as a regular user as well.

I edited my /etc/printcap file, but in the header it says that any edits to it will be erased anyway, but I did put those lines in there to try the idea, but nothing changed.

I put anything I could think of in the Printer line in Galeon to try different things, I tried straight "lpr" and "lpr -P DeskJet932C" and "CUPS". I don't know what else to try, but that's why I did that.

I too only have the 1 printer, so I am not sure if that makes a difference or not..

Anyway, thanks for anymore ideas or if I missed something let me know, I'll be glad to give it a try and let you know how it goes.

Cool

MasterC 12-02-2002 01:47 AM

Quote:

Originally posted by Excalibur
Thanks for posting the log file and the others. Your printcap and printers.conf look OK. And the colon is only a delimitor in the printcap file not part of the printer name. The printcap file's history is from BSD and that uses a colon to delimit items for a printer definition. So programs expect it after the printer name.

Well, it might be a permission issue. Your log file suggest that the problem has always been there. And also, it still puzzles me why the test page from inside CUPS didn't print. It might be you attempted that back on the 24NOV when you defined the printer. The error always states the same thing "No pages found!" like it was expecting input but never received it. If you want to turn the debug level on then the setting is in the /etc/cups/cupsd.conf file. Mine is currently set to "info". The CUPS daemon will probably need to be restarted. Don't forget to turn it back though.

I can also concur with LNXman on the compatibility problem. CUPS installs it's own lp, lpr, etc. programs. So it cannot coexist with any BSD style printing system. One does have to make the choice. I think that is why Slack installs apsfilter as a default instead of CUPS. If lpr or LPRng were installed after CUPS, they would overwritten the print programs from CUPS. That might explain why kprinter will work. If that is the case then reinstall the CUPS package or switch to apsfilter.

As for the permisions, the CUPS daemon runs as user=lp and group=lp. Both should exist in /etc/passwd and /etc/group. The lp group should have read/write permission on the /dev/usb/lp devices. I think that is OK because you stated that kprinter can print OK and I think the daemon would need that to print anything to the device. The /var/spool/cups directory should be owned by lp and have full permissions. The /var/spool/cups/tmp directory should also be owned by lp with full permissions with the sticky bit set.

I think I found the source to a problem I have had with CUPS as well from reviewing my logs. If a job is submitted by "root" and is owned by "root" the daemon cannot hold or cancel the job, doesn't have the rights. This may be related to the /var/spool/cups/tmp directory files. Because I have also noted it depends on how the job was submitted, like your galeon print issue. Some jobs can be cancelled and some cannot. I think that the kprinter jobs can be cancelled or placed on hold. Well I think kprinter usually uses files to submit print jobs and not stdin but it might also use the full path to print a job file and not use the CUPS tmp directory. And kprinter might also be using the lp user/group as well. I will need to check on it some more.

Well perhaps this info has helped in some way.
Cheers!

Edit/Followup: The problem I described above was resolved by adding security to the Jobs section of the cupsd.conf file to allow authentication for job control. This would not be related to your problem. Cheers!

Yes, lp does exist in both locations and does have perms' on those directories.

After I uninstalled lprng, I did reinstall CUPS but still nothing. So now I am stuck again, the one last thing I will do is adjust the logging as you suggested, and see what that spits out.

Thanks for the ideas so far, and if you have anymore feel free to let me know so I can give em a whirl.

Cool

LNXman 12-02-2002 03:45 AM

One last thing you can try is to increase the debug level of cups manually and then check the log (man cupsd for info). Probably cups cannot find the foomatic-gswrapper script when it is trying to print since you say you at least get activity, or something else is happening in deeper that causes the printjob to stall. Hopefully the log won't look too ugly, and will be able to help you. . .

WRT usb mount ---
if you mount your usbdevfs to /proc/bus/usb, then all your devices' infomation will be put there. . . not overly critical, but you can check for abnormalities regarding your devices in there . . .

GL

P.S. if all else fails, give apsfilter a try . . . ;)

MasterC 12-02-2002 03:25 PM

Yes, thank you I am about to. I figured cups to be a bit easier than apsfilter, since a long time ago I gave apsfilter a try but with no luck. It was probably just because I had no clue what I was doing at the time though, and now might be a bit easier.

Anyway, thanks for the usbdevfs tip, I will start doing that.

I am just makin a quick post, so I will post back later with better info WRT debug level/info from there.

Cool

NSKL 12-02-2002 03:45 PM

Well, dunno if it will be of any help, but heres what i did to get my Epson stylus color 900 to work, since i had similar problems, and in my previous post i really didn't help much...
I installed cups, together with lprng and as LNXman said there was a problem of compatibility, but it took me damn 3 hours to figure that out, so i uninstalled both packages, and reinstalled lprng only. Used APSfilter to setup the printer, but something was wrong with ghostrscript drivers, they weren't available although i installed the latest ghostrscropt with correct flags for my printer. So i went ahead with trial and error, and found a driver for a Epson 800 that works fine with my printer, however prints only at half speed than it did back in Slack 8.0, but i rarely use the printer, so this is okay.
So you might want to give APSfilter a try, i never got CUPS to work, EVER! and with APSfilter i even shared this printer with other two linux machines on a LAN with no problems (just run APSfilter on other machines, and add a network printer, it was really simple.
If you want to give it a try, remove cups and reinstall lprng to make sure everything is "clean", then cd to /usr/share/apsfilter and run SETUP ( ./SETUP). Its easy to setup, you might need to do some trial / error work tho...
well i hope that will be of some help
-NSKL


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