Showing posts with label binary plugin. Show all posts
Showing posts with label binary plugin. Show all posts

20 August 2012

222. Fighting and, eventually, installing HP laserjet P1102w on debian.

This printer is great when it works. It's just always a pain to set up, and it seems to be down to the way the install scripts are written. Setting up the printer was easy in the end -- but getting there? Not so much. Obviously, part of the reason is my own stupidity. Summary: it works on linux, but you'll need a bit of time and patience.

Update: here's an interesting post on the same topic: http://downfromthetrees.com/linux-installing-a-proprietrary-hp-printer-driver.html The only thing I would add is that instead of using sudo as described in that post you may have to use gksu in order to avoid the Magic Cookie error.

The short guide:
You NEED a binary plugin. It blows, but you do. Blowing harder: there's a lot of references to letting hp-setup download it for you -- but I'm willing to bet that it will fail for you.

Anyway, do this:
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.12.6-plugin.run
chmod +x hplip-3.12.6-plugin.run
gksudo ./hplip-3.12.6-plugin.run

Hopefully that's good enough to take you through to system-config-printer and/or hp-setup. I did a lot of things, but it was the gksudo ./hplip-3.12.6-plugin.run that did it in the end.

And don't forget to add yourself to the lpadmin and perhaps lp groups:

cat /etc/group|grep lp
lp:x:7:verahill
lpadmin:x:111:verahill
I don't know how necessary it is, but heck, why not?


Here's the full, painful (and probably embarrassing) route I took:
It should not be this difficult to get a bloody printer to work. With older printer models it's been quick and easy, without having to download any 'binary plugins'. This is just effing ridiculous. Guess who's not buying another HP printer...

I reorganised my office, and as part of that decided to move my printer from my desktop to one of my networked boxes to free up some space on my desk. My desktop is running GNOME, while the target box is running KDE.

If you install the hplip packages in debian you end up with a very helpful script called hp-setup. You can run that as a user, but try running it as root via sudo, and you get

Invalid MIT-MAGIC-COOKIE-1 keyhp-setup: cannot connect to X server :0

OK, so you can run it as user. Everything looks great, BUT...you'll find that in this case the install will fail at the step of downloading the magical, mythological 'binary plugin'.

Also, as a user you're unlikely to be able to be able to put files in the places where they belong anyway, so there's that (see e.g. the first comment below).

You then do a bit of googling for hplip-3.12.6-plugin.run, and end up here: https://aur.archlinux.org/packages.php?ID=44646

You do
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.12.6-plugin.run
chmod +x hplip-3.12.6-plugin.run
./hplip-3.12.6-plugin.run

This opens a gui where you get to accept the T&C. Not much seems to happen beyond that though. Oh, and you can't do the sudo-thingy because, well, you get the magic cookie error.

OK, take a step back.

sudo lpstat -a

global-mfp accepting requests since Mon 20 Aug 2012 10:46:48 EST
HP-LaserJet-Professional-P1102w-2 accepting requests since Mon 20 Aug 2012 13:49:19 EST
lpoptions -d HP-LaserJet-Professional-P1102w-2

lpq
HP-LaserJet-Professional-P1102w-2 is ready

Test it:
lp /etc/fstab
request id is HP-LaserJet-Professional-P1102w-2-1 (1 file(s))

 lpq
HP-LaserJet-Professional-P1102w-2 is ready and printing
Rank    Owner   Job     File(s)                         Total Size
active  (null)  1       untitled                        2048 bytes
Printing my foot it is.

Hmm...
cat /etc/group|grep lpadmin
lpadmin:x:114:
OK, edit /etc/group and add myself to lpadmin.

I can open system-config-printer, but I can't 1) delete any printers (which would've been nice) or 2) start it with sudo.

I can use http://localhost:631, but as a user I'm somehow not allowed to remove printers, and I use sudo -- there's no 'root' password.

At this point I was getting frustrated and nuked all printers clear of my system.

sudo lpadmin -x HP-LaserJet-Professional-P1102w-2

sudo apt-get install system-config-printer-kde

Now I had both 'printing' (= vanilla CUPS system-config-printer) and 'Printer Configuration' in the KDE menu.

Still no dice.

OK, another step back.
mkdir hp
./hplip-3.12.6-plugin.run --target hp
cd hp/
sudo cp 86-hpmud-sysfs_hp_laserjet_professional_p1102w.rules /etc/udev/rules.d

Still no effing luck.

Tried one last desperate thing:
gksudo ./hplip-3.12.6-plugin.run
Clicked the agreement. Said done.
Hit 'print test page' and...it printed!

So...you need to be root...but the MIT magic cookie issue combined with the requirement to have a friggin' gui (why???) made that painful. Well, I guess that's why we're told to use gksu whend oing graphical stuff...

OK, only things remaining: network sharing. Should be simple. Opened up all ports on print-host box to accept traffic from my desktop (and desktop only). No luck.

gksu system-config-printer
Click on server, settings -> check Publish shared printers connected to this system.

On my desktop it was then just add a matter of adding the printer in GNOME (ipp://192.168.1.101:631/printers/HP-LaserJet-Professional-P1102w)

Sweet.

SOLVED.