0

I am using arch linux kernel 5.7.2-arch1-1. All software is up to date.

I am attempting to set-up a Laserjet 2200 printer from the command line using the utility lpadmin.

While I am able to use the system-config-printer GUI utility to set up the printer so it works, I prefer to be able to do this from the command line as it is much more portable. When I set-up using the GUI method the working printer gives some information about the working driver. The make and model field is filled as HP LaserJet 2200 - CUPS+Gutenprint v5.3.3.

Being able to replicate this set-up on the command line would be ideal. I've had a brief look at the Gutenprint web site and the pdf document they have and there apprears to have no set-up information in there, that I can see.

The below printer set-up command is accepted by the terminal, but the newly set-up printer accepts the print job but fails to print:

lpadmin -p "hp_laserjet_2200" -d "hp_laserjet_2200" -o printer-is-shared=false -e -i ~/script_PRINTER_CUPS_config_file/hp-laserjet-2200.ppd -v socket://192.168.1.240:9100

I think this command should work and that the problem is the .ppd file, though I am sure that I used this same .ppd file many years ago for a same model printer.

What is the GUI app accessing that I can't see?

Do I need more than a once upon a time working ppd file?

Where can I get a newer ppd file (a search revealed nothing)?

What is the method to set-up this laserjet printer from the command line?

I feel certian this is simply a driver problem. I have done much googling but the answer is not so far clear. I have installed hplip which I think has a gui, but as I say I want to do this entireley on the command line.

1 Answer 1

0

Ok, here is what worked for me, in a step by step breakdown.

There's probarly other simpler ways to get your printer set-up as a one liner in linux.

  1. Install gutenprint and hplib driver softwares if not already installed. Here is the code I used.

package_list=( gutenprint hplip ) for i in "${package_list[@]}" do if [ "$(echo $sudo_password | sudo -S pacman -Qi | grep -m 1 -oE $i)" = "$i" ]; then echo "$i is already installed, no need to do anything"; else echo $sudo password | sudo -S pacman -S $i --noconfirm --needed fi done

  1. Run the lpinfo command to search for the drivers on your system. In my case I have an HP LaserJet 2200 printer, so I greped for it as follows

    lpinfo -m | grep 2200 | grep LaserJet

You can use your printer make and model with this command, it worked for me

lpinfo --make-and-model "HP LaserJet 2200" -m

The output will be something like this gutenprint.5.3://hp-lj_2200/expert HP LaserJet 2200 - CUPS+Gutenprint v5.3.3 lsb/usr/HP/hp-laserjet_2200-ps.ppd.gz HP LaserJet 2200 Postscript lsb/usr/HP/hp-laserjet_2200_series-ps.ppd.gz HP LaserJet 2200 Postscript drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd HP LaserJet 2200 Series, hpcups 3.20.5 lsb/usr/HP/hp-laserjet_2200_series.ppd.gz HP LaserJet 2200 Series, hpcups 3.20.5 everywhere IPP Everywhere

  1. Select an appropriate drv line. I selected this one

    drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd

  2. Then use that in the below printer setup line

    lpadmin -p "HP_LaserJet_2200_LOCAL"
    -D "HP_LaserJet_2200_LOCAL"
    -L "Corridor"
    -o printer-is-shared=false
    -E
    -m drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd
    -v socket://192.168.1.240:9100

Here is what each flag does, terms definitions:

  • -p = printer name
  • -D = printer description
  • -L = printer location
  • -o printer-is-shared=false. This stops other people using the printer via your computer.
  • -E = Enable printer
  • -m = driver / ppd location
  • -v = uri-socket
  1. Set your printer as default if you have a few and wish to do so

    lpadmin -d HP_LaserJet_2200_LOCAL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .