I need to run the latest version of Sane-Backends to support my scanner. I've compiled the source such that it's out of the way for the distro's package V1.22 but when I run an update it overwrites my simlink to libsane.so.1 so then I have to manually update the symlink.

My Question is two fold:

  1. Is there a way to prevent this from happening? Should I pin the package? I'm not sure if that's the correct approach?
  2. If not is there some sort "hook" that I can connect a script to run on a post update action? ie run: sudo ln -sf /usr/lib/libsane.so.1.0.24 libsane.so.1

The OS is raspbian, aka Debian 7.0 for the Rasberry Pi.

Thanks for the tips.

  • Welcome to Server Fault. Unfortunately your question appears to be off topic as there's no obvious connection to professional system/network administration. You may wish to visit our sister sites Unix & Linux or Raspberry Pi to see if one of them may be a better fit for your question. May 28, 2013 at 3:53
  • Didn't realize there was unix version.
    – Grumps
    May 28, 2013 at 3:56
  • Can you not just find an apt repo (eg backports) with the newer sane package there, and install from it?
    – Gagravarr
    Aug 27, 2013 at 12:41
  • Did you tried uupdate? A lot of times you can just build a newer version of a package with uupdate and the upstream tarball.
    – dfc
    Jan 24, 2014 at 20:48

2 Answers 2


I would recommend compiling your source and keeping it separate from your system's libraries. From there, you could do a couple of things:

  • Copy the library file from the source directory into the folder of the binary you are executing
    • cp /path/to/src/library.so /path/to/executable

This assumes that the executable isn't "installed" and was a compressed file containing all of the libraries and binaries you would need.

  • Add an environmental variable to ~/.bashrc or /etc/environment
    • export LD_LIBRARY_PATH=/path/to/source:$LD_LIBRARY_PATH

It is important that this line is below other LD_LIBRARY_PATH lines. The bottom should be fine. If you put it into ~/.bashrc, only your user will be affected. By placing it into /etc/environment, you'll make it a system-wide configuration.

In both cases, you're exploiting which library will be found first. Programs should look in their local directory first for libraries. They should also look through environmental paths in order.


CheckInstall allows you to create packages for Debian that won't get overwritten. You use it something like this:

  1. make sure you have all the dependencies you need. You can pull them in for the current version with something like sudo apt-get build-dep sane-backends (which pulls in the insanely large TeX Live system, which you likely don't need for anything else but building the docs.)
  2. remove the system version of libsane with sudo apt-get remove sane-backends or similar.
  3. Download, unpack and build the package as before, but instead of make install, do sudo checkinstall. It will prompt you for some input, then build a deb file that you can install.

As your own build has its own version number (and you don't have Debian's version to overwrite it) this should stick around for a while.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.