Linux printing

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...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you enabled a second printer port in the kernel?
Pleas check in /proc/{devices,interrupts}
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...
covellcAuthor Commented:
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...
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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.
covellcAuthor Commented:
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 ?
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??
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.
covellcAuthor Commented:
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 ?
covellcAuthor Commented:
I am crap ! The 'extra' serial interupt is the modem, I was online while writing the last comment, oops.
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....

covellcAuthor Commented:
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 !!!!)
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.
covellcAuthor Commented:
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 !


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

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

Thanks, spjuver for your comment.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
covellcAuthor Commented:
Thanks again for spending so much time on this question, I really appreciate it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.