Linux printing

Posted on 1998-02-15
Medium Priority
Last Modified: 2010-04-22
New, question...

I am having trouble 'cat'ing a file to my printer, and hence can't print anything. I believe my trouble is fundamental problems with the port, I am not looking at deamons or anything yet, I shall get on to that when I can cat to the port.

My printer port is parallel.
My printer is on /dev/lp2.

If I use "tunelp /dev/lp2 -s" I get the following message:
"Status is 95, busy, on-line".

The printer is on-line, but I do not believe it is busy. The busy light is certainly not flashing.

There is nothing on lpq, "no entries"

If I "cat testfile > /dev/lp2" the session hangs and I must use control C to get the promt back.

Please help !!!! Have I got a spool file knocking around blocking up the port ? I don't know...
Question by:covellc
  • 7
  • 5
  • 3
  • +1
LVL 51

Expert Comment

ID: 1636029
Have you enabled a second printer port in the kernel?
Pleas check in /proc/{devices,interrupts}

Expert Comment

ID: 1636030
First thing to check when parallel/serial ports don't like you:
Do you have any other hardware which uses IRQ 3,4,5 or 7??

Soundcard and LAN-cards sometimes like to uses one of these IRQ's.

The command tunelp find the printer but it is busy (weird). The 'cat' command hangs. Sounds like IRQ messup for me...

Author Comment

ID: 1636031
This sounds as though we are heading down the right track !!!

Of course my next question is how can i tell through Linux what irq settings my hardware is using ! I am at work at the moment and shall be looking at this problem at home tonite so a pointer would be great...
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 1636032
A general question...
Linux will figure out which IRQ you are using if you have compiled in support for that hardware.
Ther problem is not that linux not find your irq. The problem is the actual overlap of irq's.

You have to write down on a piece of paper which irq which port have and which irq which card have. A printer and a modem don't really like share the irqs. The same with sound cards. If it is possible move around irqs on the cards. If it is not possible to change irq on your card and you really have modems and printers etc on your ports. You have hit a hardware limitation in the PC-world...

The multi-port cards usually just steele one irq  and share it with many ports. Maybe an idea??

Anyway to find the irq-settings your kernel have will you find by surf'n around in /proc jungle. cat the irq files there....
Depening of which kernel version as later as better.

Author Comment

ID: 1636033
If I cat /proc/interrupts I get the following:

0:       timer
1:       keyboard
2:       cascade
3:      +serial
13:       math error
14:       ide0
15:       ide1

no lp or parrallel......

I have got a sound card, so I have removed it, but to no avail.

Any other ideas ?

Expert Comment

ID: 1636034
You are missing something there. Do you have lp as module??

If you have, what happens if you write 'modprobe lp'.
How does the /proc/interrupts looks like when you cat your file to the lp device??

Expert Comment

ID: 1636035
Have you watched the system boot? If you have printer support
compiled in, not as a module, you should see the kernel recognize all your printer port(s).
You can also pipe dmesg into more (dmesg|more) to review the bootup.
You say the printer is on /dev/lp2, what is on /dev/lp1 and /dev/lp0?.
If you have lp as a module try insmod lp and see if the irq shows up in use and/or the printer starts working. If it does check your kernel config for the auto module load support.

Author Comment

ID: 1636036
Sorry to be such a pain, but I really do appreciate you time...

I did have lp loaded as a module, but I also believe I have it loaded in the kernle !!! dmesg showed two lots of lp1 and lp2 !!
I have removed the module entry from the rc.modules file. Rebooted and now there is only one entry for lp1 and lp2 in dmesg.

Now if I cat proc/interrupts I have an extra interrupt

4:      +serial

This is in addition to the interrupts mentioned in my last comment.

If I try and tunelp /dev/lp2 -s while catting my file I get the message /dev/lp2 Device or resource busy

If I turn the printer off and tunelp I get:

status 79, busy while it is turning off, and

status is 135, ready, error when it is turned off.

The status of /dev/lp1 is 200.

What next ?

Author Comment

ID: 1636037
I am crap ! The 'extra' serial interupt is the modem, I was online while writing the last comment, oops.

Expert Comment

ID: 1636038
Don't care about the serial ports lp-ports is parallel.

I think that you have to clean out every possibility for interference.

Remove every possible card wich use irq 5 or 7 (incl PnP).
Make sure that lp is compiled in the kernel and remove all lp modules.
Put an '/bin/sh' entry in the end of your /etc/rc.d/rc.sysinit file.

Reboot and cat your favorite file to the /dev/lpx device.

If it works then you have an interference somewhere.
If it not works, then you have an interface/driver problem.

If you get the file correctly on your printer. You have to put back things and use tunelp to check. Begin with starting of certain daemons.
Still works? put the most suspected card back first then reboot.

This is an efficient way but demands a lot of time....


Author Comment

ID: 1636039
The latest word...

Right, I have done all you said. I have pulled all the cards. I have changed the device to /dev/lp1 on the card. I have cut loads of stuff out of my rc. files...

I was not sure how to check for lp in the kernel, but what I have found is...

When I boot there is no lp in /proc/devices.

If I do a tunelp then the device lp appears in /proc/devices but it is set to polling.

On boot up there is no entry in /proc/ioports but if I tunelp to use irq 5 it appears. Also it appears in /proc/interrupts on irq 5.

I seem to be winning, BUT cat still hangs when I cat a file to /dev/lp1

So, your last comment says it looks as though I have an interface/driver problem. Any ideas.

PS spjuver reply with a propper answer so I can give you some points (better still, reply to my old outstanding question so I can give you the points !!!!)

Expert Comment

ID: 1636040
Double check on your system which IO buss the parallel port is  on ISA or PCI.
Then, in your BIOS there should be a place to setup your PCI bus interrupts. Often this is set for automatic. Make it manual and do not give irq's 5 and 7 to the PCI bus. That way the parallel port should be guarenteed of the correct irq so the linux driver should work.
If your parallel port is on an ISA card this is imperative to getting it to work.

Author Comment

ID: 1636041
Hooray, I have finally got the printer to print.

Yes, it seems as though I had to wade through the bios setup and manually set the printer address. I have also now moved the printer to the on board parallel port instead of the one on the serial card.

Many thanks to jeffa and spjuver. I have learnt loads about the /proc directory in the last week thanks again.

I want to give you both points, so i need you to answer the question instead of just commenting, please can one of you answer this one and the other my other question, so I can assign the points !



Expert Comment

ID: 1636042
I'm not interested in the points just happy that everything is working for you...
jeffa, go ahead.

Accepted Solution

jeffa072897 earned 600 total points
ID: 1636043

If you would please accept this as an answer then the points get distributed.

Thanks, spjuver for your comment.


Author Comment

ID: 1636044
Thanks again for spending so much time on this question, I really appreciate it.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month9 days, 6 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question