Jump to content
xisto Community
Sign in to follow this  
dserban

Linux - Open Printing Compatibility Check By Manufacturer

Recommended Posts

USB printers for the most part work really well under Linux, but there are some that don't work at all - they might as well be paperweights, so before you buy a printer, definitely go to:

http://www.openprinting.org/printers

 

... they have a very good, up-to-date database of printers. It's a dropdown box by manufacturer, so you click your way through it and the verdict is like a thumbs up or thumbs down for Linux compatibility - some printers work great, and some don't work at all ... and some grey areas inbetween.

Posted Image

Additional information can be found at:

http://forums.xisto.com/no_longer_exists/

 

or just:

 

https://wiki.linuxfoundation.org/en/OpenPrinting

 

(It used to be so simple, the only thing you had to do is go to linuxprinting.org, but they keep changing things on me every so often.)

 

As a general observation, HP printers tend to work very well under Linux - not every single one, but a good number of them. (I'm not too sure about Xisto forum rules on mentioning vendor names directly. If I get in trouble, I'll replace the words "HP printers" with "printers made by one of the leading vendors".)

 

So let's say that you have a printer and you want to network it.

There are obviously lots of considerations here since everybody's network is going to be different.

It's not uncommon for people to want to share printers - in a homogeneous environment / between two Linux computers, or in a heterogeneous environment / between Linux and Windows computers.

 

The main program that you are going to need to have installed regardless of which way you're going is CUPS - Common UNIX Printing System. It is a server type piece of software - I am going to refer to it as the print server or CUPS daemon.

 

What it does is three things:

- it allows your Linux computer to print to your standalone printer, so it's a way to configure your directly attached printer without any network.

- it allows your Linux computer to share that printer and process incoming print jobs.

- it allows your Linux computer to print to a shared printer on a remote machine.

 

You often see when you're reading around, about using Samba to share printers. It's actually interesting that you don't necessarily have to use Samba - you can use CUPS just by itself (there may be other packages out there, but I'm focusing on CUPS). In fact, you do need to use CUPS, no matter what. The Samba part is kind of optional. I'll explain this part in more detail further down below. A lot of times people just automatically assume they have to configure both CUPS *and* Samba in order to share printers and I guess my main point - at least initially - is just to say that's not necessarily the case.

 

When you're sharing printers between Linux machines for example, CUPS is all you need - you don't need Samba. Obviously if you need to share files, that's a different story altogether, and sometimes people will set up Samba to share files between Linux computers anyway, so they might still be using Samba, but my point is you don't necessarily have to.

 

Before I break it down into the different types of configurations, what you'll need to do of course is - like I said - to install CUPS. So go to your package manager, search for the CUPS package and go ahead and install that.

 

Just like with any other service or daemon, you have the options to start / stop / restart. I have found this to be slightly different between different distributions. In most distros, what you need to do at the root shell prompt - or by prepending sudo - is:

sudo /etc/init.d/cups (start|stop|restart|status)

However, in a small number of distributions, you need to put a lowercase "d" after cups, like this:

sudo /etc/init.d/cupsd (start|stop|restart|status)

And to further complicate things, in Debian / Ubuntu it's different again:

sudo /etc/init.d/cupsys (start|stop|restart|status)

 

In some distributions you have graphcal tools for starting and stopping CUPS, so you can do that wherever the case may be, but I wanted to describe the three command line options you would have in order to start CUPS in most distributions. A few distributions (Slackware and Arch Linux for example) use a slightly different configuration (rc.d instead of init.d), but since these are fairly advanced Linux distributions, those of you who use them probably already know that.

 

Once you have CUPS installed, there is one prerequisite you should take care of right away, and that is to enable other machines to access the remote CUPS server. At this point I'm referring strictly to a homogeneous landscape. If you have printers attached to a Windows machine and you want to print to them from within Linux, I will describe the steps further below, keep reading.

 

But let's say you have a Linux box and you have a printer attached to it and you want to both access it directly from the local machine and also share it over the network.

 

The very first step on the Linux machine in order to start setting up CUPS is to edit a file, just like you need to do with Samba. Open up a terminal and type:

cd /etc/cups

Look around and locate the file called cupsd.conf, which is the CUPS configuration file.

The first thing I recommend you do is to back it up:

cp cupsd.conf cupsd_backup.conf

Then open cupsd.conf in you favorite editor, for example:

sudo nano cupsd.conf

Notice the opening and closing tags, the only tag you need to be concerned with is location.

Scroll down until you get to a section that looks like this:

<Location />Order Deny,AllowDeny from AllAllow from 127.0.0.1</Location>
Insert a line that contains your subnet, but with the last number being a wildcard, like this:

Allow from 192.168.1.*

<Location />Order Deny,AllowDeny from AllAllow from 127.0.0.1Allow from 192.168.1.*</Location>
You are thus allowing all machines on your local network access to the CUPS server - that's what that line does.

 

And, just as is the case whenever you make a change in most configuration files in Linux, you will need to restart CUPS.

 

We are going to do two more little optional changes. Although it's not necessary for the normal operation of CUPS, we are going to enable support for Windows PCL drivers.

PCL drivers are Windows drivers that send raw data to the print queue, which then knows what to do to the raw data to format it and output it correctly to the printer, as opposed to the formatting having already been performed by the originating client end application.

That means when you have raw printing, there is not much you can change on the client side, so this is not something you are necessarily going to need, but since we are already playing around with the terminal, we might as well enable this because this change tends to be forgotten a lot of times and it can fix a lot of problems.

 

There are two files we need to edit: mime.types and mime.convs

Open these files for editing and in both of them there will be a line in there somewhere with the following:

application/octet-stream

You will find this line commented in both files. Uncomment the line in both files and save them. (Yes, you should back up those files first, before you make this change.)

 

Restart CUPS.

 

At this point you need to set up your printer (we are still in the printer-attached-to-Linux-machine scenario).

 

Fire up a web browser (CUPS has a web-based administration tool) and type in:

http://localhost:631
631 is the port that the CUPS daemon runs on, so before you do anything, make sure that your firewalls have port 631 open (again, that's something else that trips people up a lot). I'm not talking about allowing access to your 631 port from the Internet through your NAT router, I'm talking about software-based firewalls which are internal to your local network.

 

Log in as root, click on the "Administration" button, click "Add printer" and this will walk you through a little wizard which is not very complicated to go through, so I'm not going to go into detail here about every little step, although a couple of brief comments on a few of these are in order.

When it asks you for the spooler name, you will want to just type in a really short, easy to remember name that is going to be used on the system to identify the printer (that name should not contain any spaces or special characters because it's going to be embedded in URLs later on).

Location is completely optional, and so is the description.

On the next screen, where it's giving you the various options (HP JetDirect, Internet Printing Protocol, lpd/lpr, parallel port, USB printer) you need to know that JetDirect is a little hardware box that is going to act as a kind of a LAN port for your printer, with all that such a port entails (MAC address, IP address). Remember, what we are doing now is to set up the local printer on the local machine (we're not networking yet) so I'm assuming you aren't using JetDirect or IPP.

Other self-explanatory fields are manufacturer, model number, etc.

I will describe adding additional CUPS drivers further down below, but hopefully there will be a driver on the default CUPS screen here for your printer (remember, you can always go back and change the driver later on).

 

Now that you have your printer all set up, you are back at the main CUPS admin page and you should see your printer now. You can go ahead and print a test page, hopefully that works for you.

 

Now we get to the stage where we connect to this printer from the other machines.

Should you want to connect to this printer from another Linux machine, you first need to install CUPS on that second box, open up the CUPS web-based administration tool, log in as root, click on the "Administration" button, click "Add printer", and on the next screen where it gives you all those options, go ahead and select the IPP (Internet Printing Protocol) option. The CUPS web-based administration tool gives you examples on how to type in the URL in the text field called "Device URI". So you'll see examples like:

ipp://hostname-or-IP-address-of-CUPS-server-machine-where-the-printer-is-connected/printer/printername
and that's where that short spooler name comes in handy.

Alternatively, try this:

http://hostname-or-IP-address-of-CUPS-server-machine-where-the-printer-is-connected:631/ipp/queue-name-in-the-queue-syntax-format
but usually ipp-based URIs work just fine.

 

So that's what you can do to connect to that printer from another Linux machine.

 

The interesting part is that you can perform almost the same sequence of steps to connect to that printer from Windows. So you still have your printer connected to the Linux machine, you have enabled the remote access to the printer under the location section in cupsd.conf, you have configured the printer in CUPS, and now you go over to your Windows machine and you want to connect to the remote printer. Same thing - IPP printing is supported out of the box in Windows 2000 and Windows XP. For Windows 9x and ME, you need to download and install some little piece of software to enable IPP printing, as far as I know.

All you need to do in Windows 2000 and XP is go into the "Add printer" wizard, select "Network printer", and when it asks you for the URL, you type in:

http://hostname-or-IP-address-of-CUPS-server-machine-where-the-printer-is-connected:631/printers/queue-name-in-the-queue-syntax-format
and it works very well - no Samba needed.

 

But should you have had Samba set up already - let's say your Linux machine was already set up as a file server and serving files to your Windows machines - you can use Samba for printing as well, but keep in mind that Samba really uses CUPS as the back end, so you do need to get CUPS set up and working.

But then you need to make two small changes to your Samba configuration file in order to share printers over Samba.

The first change is in the global section of the smb.conf file. Here you will see 2 printing-related lines, and in both you need to put "cups", like this

printcapname = cups

printing = cups

Then, scroll down to where you start defining the shares (home directories etc.) and you will see a section where you define shared printers:

[printers]comment = All Printerspath = /var/spool/sambaprintable = Yesbrowseable = No
Here you need to add:

public = Yes

printername = <shorthand-name-of-printer>

 

and that will make that printer discoverable in the Windows network using Samba, in which case you don't have to jump through the hoops of adding a network printer etc.

 

So that's CUPS as a print server.

 

The other situation is when you have a printer attached to your Windows machine already and you want to print to it from Linux. In this case you do need to be using Samba because there is no way that I know of for a Windows machine to serve printers using IPP.

 

In this case the sequence of steps is pretty easy.

Obviously in Windows you have to set up the shared printer. On the Linux side, you need to use CUPS and Samba. So go ahead and install CUPS and Samba on the Linux box, open up the CUPS web-based administration tool, log in as root, click on the "Administration" button, click "Add printer", and on the next screen where it gives you all those options, go ahead and select the "Windows printer via Samba" option, which should be there if you have installed Samba, configured it correctly and it's ready to go. When you get to the page where you need to type in the URI for the printer, you will need to use a slightly different syntax (and again, you'll see examples of this in CUPS). But basically the syntax is:

smb://username:password@workgroup/server/printername
Of course username:password is a valid combination recognized by your Windows machine.

If the above syntax doesn't work, there is another one you can try:

smb://server/printername
Once a printer is available in CUPS, it is automatically available to all Linux applications.

 

There is a great CUPS tool in the KDE Control Center, and there is also of course a printer tool in Gnome, but the CUPS web tool is cross-platform and cross-desktop-environment, so once you get used to it, you'll find it very convenient to use on a regular basis in any combination of distribution and desktop environment.

 

I promised I would talk about installing different CUPS drivers in Linux.

There are a couple of them, for example the GIMP print driver (aka Gutenprint):

http://gimp-print.sourceforge.net/

 

Basically, what you need to do is download and install that package, then you go back into CUPS to change the printer, once you get past the sections where it asks you for the manufacturer and model number of the printer, you'll see "Additional drivers" there, and you'll see GIMP print drivers for your printer (assuming they have any - they may not), which give you some additional features and settings.

 

Another example is HP drivers (HPLIP):

http://hplipopensource.com/

 

which give you additional options like gray scales, high quality or medium quality, etc.

 

There are a bunch of good pages out there if you need more information. There is a really good one in the Gentoo docs, there are a couple in the Gentoo Wiki. (By the way, the Gentoo docs are always good places to start, even if you don't use Gentoo, their docs are sooo good.)

And of course the documentation on the CUPS website is pretty good as well.

Edited by dserban (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.