Dell V305 Printer on Linux

I spent this week hanging out with my wife and grandparents-in-law and spent some of my time performing the obligatory family tech support (no complaining here, I love doing that most of the time). To sum up the beginning quickly because I really don’t want to write the post in great detail, my grandfather’s computer got temporarily hosed and the guy from Dell made it even worse (thanks Deepak). He actually wiped the computer after taking very minimal backups (thankfully just enough). Not only that, but the restore from the Dell image actually corrupted a bunch of the core system libraries making installing and updating Windows or Microsoft software impossible. After wasting an hour trying to fix this, I finally decided to reinstall a fresh copy of Windows. Then it hit me, my grandfather doesn’t use his computer for much more than Word documents, PDFs, browsing the internet, and email - all things that Linux does very well. With that, I suggested to him that he try Linux Mint (my favorite ready-to-go Linux desktop distro). After he played around with the live version for a bit, he decided he really liked it (kudos to you Linux Mint guys) so I went ahead to install it.

I got everything working easily but one thing… his printer.

The Dell V305 Printer

The Dell V305 is actually a Lexmark printer rebranded as a Dell. Specifically, it is the Lexmark x4650. Thankfully, Lexmark makes a linux driver for this thing, but it is of course, very problematic. When I first ran the .sh with an embedded binary, it ran fine until I got to the install where it gave me an ambiguous "failed to install". When you click OK, it closes the window with the actually error text in it. While the "failed to install" dialog is up, you can’t check the log because it won’t let you select the background window. Also, the background window isn’t resizable so you can’t hope for a bigger window to compensate for no scrollback. Great design, huh?

I did notice on the last three or so lines though that it was trying to remove a .deb file. With that, I set out to search for it.

The Fun Begins

If you run the lexmark-08z-series-driver-1.0-1.i386.deb.sh file with the --keep switch, the script will not remove all files extracted to perform the install process. This will leave you with a nicely populated tmp folder.

If you cd into the tmp directory, you will find a file called installarchived_all. This is actually an lzma archive file. What you want to do now is extract this file using the following command

tar -xvf ./installarchived_all --lzma

This will extract several files, one of which will be called lexmark-08z-series-driver-1.0-1.i386.deb. You might think that this is a time for rejoicing, but alas it is not. From this point we should be able to run dpkg -i ./lexmark-08z-series-driver-1.0-1.i386.deb and it would work, but it won’t. If you do that you will receive the following friendly error:

dpkg: error processing ./lexmark-08z-series-driver-1.0-1.i386.deb (--install):
 parsing file '/var/lib/dpkg/tmp.ci/control' near line 9 package 'lexmark-08z-series-driver':
 blank line in value of field 'Description'
Errors were encountered while processing:
 ./lexmark-08z-series-driver-1.0-1.i386.deb

What? The .deb file was constructed wrong? 'Tis a shame. Here’s where it gets really fun. What we need to do now is extract the deb file, modify the contents of a single file, and repackage the whole thing back up.

First, let’s create a working directory, copy our deb file in there, extract it, and set up a deb package folder structure. Create our working directory and put the bad .deb file in there.

mkdir ./working
cp ./lexmark-08z-series-driver-1.0-1.i386.deb ./working/
cd working

Extract the .deb file and clean up a bit (don’t forget the period at the end of the dpkg-deb line).

dpkg-deb -R lexmark-08z-series-driver-1.0-1.i386.deb .
rm ./lexmark-08z-series-driver-1.0-1.i386.deb

Fixing the Problem

The problem as you like noticed earlier is because the .deb file has a file named control that is improperly formatted. Specifically, control files cannot have blank lines in them. To have a "blank" line in a .deb control file, you must have a period instead. That said, here’s how we fix the file.

Open up the control file in the DEBIAN directory and put a ' .' (yes, with the space before it) like so

Description:
 Lexmark 08z Series Drivers Package
 .
 This package contains the Lexmark 08z Series Drivers. This is
 a copyrighted package, please refer to the copyright notice
 for details about using this product.

Now that that’s done, We just need to repackage the .deb file and install it. To do that, cd out to one directory above the lexmark-08z directory (the working directory) and run dpkg -b lexmark-08z. This will take a few seconds (it’s 22 megs) but it should create a file called lexmark-08z.deb. Now install this using dpkg -i.

dpkg -b lexmark-08z dpkg -i ./lexmark-08z.deb

I’m too lazy to write the rest out right now so here’s the shorthand

Now you have to edit a ton of files in /usr/local/lexmark/08zero/etc/.

Firstly, we need to edit 99-lexmark-08z.rules and take the following line on the top so it looks like so

ATTRS{idVendor}=="413c", ATTRS{idProduct}=="5305", MODE="666"

ACTION!="add", GOTO="lexmark_custom_rules_end"
ATTRS{idVendor}=="413c", ATTRS{idProduct}=="5305", MODE="666"
ATTRS{idVendor}=="043d", ATTRS{idProduct}=="0142", MODE="666"
ATTRS{idVendor}=="043d", ATTRS{idProduct}=="0150", MODE="666"
ATTRS{idVendor}=="043d", ATTRS{idProduct}=="013f", MODE="666"
ATTRS{idVendor}=="043d", ATTRS{idProduct}=="0151", MODE="666"
ATTRS{idVendor}=="043d", ATTRS{idProduct}=="0116", MODE="666"
LABEL="lexmark_custom_rules_end"

Now that we’ve updated the 99-lexmark-08z.rules file, we need to edit a load of the lxd*.conf files. I say we need to edit lots of them because I’m still not sure which one or combination of them actually did the trick. I can say though that just lxdm.conf wasn’t enough.

Now, edit the following files

  • lxdm.conf

  • lxdq.conf

  • lxdw.conf

  • lxdu.conf

  • lxdx.conf

…and replace all instances of 0116 with 5305 and all instances of 043D with 413C

Once that is done, add your printer from the cups admin console (localhost:631). Once you get to the driver part, select Lexmark 3600-4600 and you should be set!

Whew

Finally, here are the resources I found to help me out with this solution.

Category:Linux Category:Debian