Skip to content

Instantly share code, notes, and snippets.

@tforgione
Last active December 30, 2020 08:57
Show Gist options
  • Save tforgione/936b7c2b08c0a5c43f56 to your computer and use it in GitHub Desktop.
Save tforgione/936b7c2b08c0a5c43f56 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! -f "$1" ] ; then
echo "No such file"
fi
DIR=${1%%.deb}
mkdir "$DIR" && cd "$DIR"
ar x "../$1"
mkdir data control
cd data && tar -zxf ../data.tar.gz && cd ..
cd control && tar -zxf ../control.tar.gz
#!/bin/bash
if [ ! -f 'debian-binary' -o ! -d 'control' -o ! -d 'data' ] ; then
echo "No extracted deb file here"
exit 1
fi
if [ -z "$1" -o ! -f "$1" ] ; then
PKG="../"$(basename $PWD)"-custom.deb"
else
PKG="$1"
fi
echo "Writing new package to $PKG..."
rm -f control.tar.gz data.tar.gz "$PKG"
cd data && tar -zcf ../data.tar.gz ./ && cd ..
cd control && tar -zcf ../control.tar.gz ./ && cd ..
ar rc "$PKG" debian-binary control.tar.gz data.tar.gz

Installing the lexmark X2550 printer on ArchLinux

This gist is based on my personnal experience, I struggle a lot with this, and each step in every tutorial I read caused me troubles, so I decided to write this gist.

Links :

Before starting

Before starting, there are a few packages that you have to install. Check the custom drivers and instal them.

Let's install this

  1. Go to the Lexmark website and download the driver for the X2600 printer.

  2. Unzip the archive somewhere, and give it the execution rights, like so

    mv <path-to-the-archive.zip> ~/Lexmark
    cd ~/Lexmark
    unzip lexmark-inkjet-08-driver-1.0-1.i386.deb.sh.zip
    chmod +x lexmark-inkjet-08-driver-1.0-1.i386.deb.sh
  3. If you have a recent enough version of CUPS, you'll probably have troubles. We'll disable the CUPS version verification by doing this :

    1. Extract the files from the script, like so

      ./lexmark-inkjet-08-driver-1.0-1.i386.deb.sh --noexec --target lexmark_install

      This should create a lexmark_install directory.

    2. Edit the file lexmark_install/config/run.lua with your favorite editor, and find lines from 569 to 574 :

      if is_cups_version_ok() == false then
          MyInstallScreen_output:add("The system does not meet minimum CUPS version requirements.")
          gui.msgbox('The installer has detected the operating system does not meet CUPS minimum version requirements. Please install CUPS version 1.2 or higher and run the installer again.')
         	do_clean_up()
         	os.exit(1)
      end

      Just remove them. They ensure that the CUPS version is correct, but it doesn't work and if your CUPS is up-to-date, it will still fail, preventing you from continuing the installation.

      However, be sure that your CUPS version is higher than 1.2 (which is always the case).

  4. Continue the installation by running the script startupinstaller.sh. At a certain point, it should fail saying failed to install (what a great error message, right ?). In fact, there is a problem in the .deb that was downloaded from the script, but we need it to get the .deb.

  5. Correct the .deb :

    1. First of all, cd to lexmark_install and do the following :

      mkdir arch
      cp arch.tar arch
      cd arch
      tar -xvf arch.tar
    2. Now, in the current directory, you should have a file lexmark-inkjet-08-driver-1.0-1.i386.deb. We'll edit this file. Copy the two other files of this gist to the current directory, and run the following :

      ./deb-extract.sh lexmark-inkjet-08-driver-1.0-1.i386.deb

      and this should create a directory lexmark-inkjet-08-driver-1.0-1.i386.

    3. Edit the control/control file in this dir, and make it should look like this :

      Package: lexmark-inkjet-08-driver
      Version: 1.0-1
      Section: non-free
      Priority: optional
      Architecture: i386
      Installed-Size:
      Maintainer: build <build@linux>
      Description:
       Lexmark Z2300/X2600 Drivers Package
      
       This package contains the Lexmark Z2300/X2600 Drivers. This is
       a copyrighted package, please refer to the copyright notice
       for details about using this product.
      

      The problem with this file is that the description is not on a single line. My solution was to remove the last 3 lines, and merge the Description: with the Lexmark Z2300/X2600 Drivers Packages so it is on a single line.

    4. Then, re-build the .deb by running

      ../deb-rebuild.sh

      and you should have a lexmark-inkjet-08-driver-1.0-1.i386-custom.deb file in the parent directory.

    5. Install it like this :

      sudo dpkg -i --force-architecture lexmark-inkjet-08-driver-1.0-1.i386-custom.deb`

      And it should install the drivers correctly.

  6. Now, you will have to edit those three files :

    /usr/lexinkjet/lxk08/etc/lxdn.conf
    /usr/lexinkjet/lxk08/etc/99-lexmark-2600-series.rules
    /usr/lexinkjet/lxk08/etc/Lexmarklxdn.conf
    

    As you may have seen, we installed the drivers for the 2600 Series, but I had a 2550, so I have to correct it. Since those values are written in hexadecimal, I had to change 011D to 010B, but if your model isn't a X2550, you can find the hexadecimal value you want 011D to replace to by typing this in the terminal (you are looking for the pid) :

    dmesg | grep -i print

    You can replace automatically by doing this :

    sudo sed -i 's/011d/010b/g;s/011D/010B/g' /usr/lexinkjet/lxk08/etc/lxdn.conf
    sudo sed -i 's/011d/010b/g;s/011D/010B/g' /usr/lexinkjet/lxk08/etc/99-lexmark-2600-series.rules
    sudo sed -i 's/011d/010b/g;s/011D/010B/g' /usr/lexinkjet/lxk08/etc/Lexmarklxdn.conf

    If you have to change your pid (because your printer isn't the 2550), you can change the 010b and 010B in the three previous lines to match your pid, but be careful : you need to change the PID while keeping the case.

  7. Now, you have to use CUPS. Plug the printer if it's not already done.

    1. If CUPS is installed and running, you should be able to go to localhost:631 to see the CUPS interface. Then click on Administration and Add printer. You'll need to identify yourself so CUPS can create new printers.

    2. If everything went well, you should see your Lexmark in the Local printers. Click on it and then on Continue.

    3. Change the name of the printer and the description if you want to, and then, click on Continue.

    4. Be patient, the next page could take a while to load. Make yourself a coffee, or something.

    5. When the page is loaded, you'll have to select the model of your Lexmark. Choose Lexmark 2600 Series, 1.0 (en), and click on Add printer.

    6. Set the default parameters you want, and finish the form by click on Set default options.

    7. If you fail, and want to delete the printer, you can run

      lpadmin -x PrinterName
  8. Now, if you try to see the printer from a pdf you are trying to print, you may see problems such as Filter for printer has insecure permissions for a certain file. I had problem with printdriver, but it can be something else, somewhere else. Here is what I had to do :

    sudo chmod -R 755 /usr/local/lexmark/lxk08/bin/
    sudo chgrp root /usr/local/lexmark/lxk08/bin/printdriver

    If your problem is not with printdriver, or in another directory, try to adapt those two lines, on ubuntuforums, a guy had to do this :

    sudo chmod 755 /usr/local/lexmark/v3/bin
    sudo chgrp root /usr/local/lexmark/v3/bin/printfilter
  9. Normally, you should be ok with that. If you are on ArchLinux, you may still have problems with libncurses. To see if this is your problem, you can check /var/log/cups/error_log if it contains something like

    error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
    

    This is because on Arch, we have libncurses.so.6 for lib32, and the printer fails to find the correct library.

    A solution to this problem is to install the AUR's packages lib32-ncurses5-compat-libs (and eventually, ncurses5-compat-libs)

  10. Normally, you should be ok with that. Feel free to comment if you still have problems. Honestly, I've been struggling for so long with this that I can't really remember if I didn't forget something in this tutorial.

    I hope it helps people, even if this is a really old printer, and I'm not sure anyone is likely to use it nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment