Installing a newer version of a package on Debian stable
I wanted to install Wireshark a network packet sniffing program today but when I checked the version available in the Debian stable repository I noticed it was several versions behind the latest available on their website.
This is a common occurance on Debian as they prefer stability over cutting edge software but sometimes you need the latest version of a software package so how do you get it when it’s not in the repos? The answer is app pinning.
Debian has several repos, stable of course as well as testing and unstable. Many people use the testing repo as their main package repository on a daily basis without major dramas. Unstable is the very top of the tree where the latest packages are introduced to the package tree and they are often the least stable as a result.
So to begin with we need to alter several files. These are /etc/apt/sources.list & /etc/apt/preferences
It’s good to get into the habit of creating a backup of any file you edit in Linux so I started by doing sudo mv /etc/apt/sources.list /etc/apt/sources.list.nfo & sudo mv /etc/apt/preferences /etc/apt/preferences.nfo
This way if you totally screw something up it’s easy to boot your system with a live cd (I recommend the System Restore Cd) and delete the modified config file, rename the backup and you’ve got a working system again.
Also you might be wondering why I used .nfo as the extension well I forget where I read it now but someone suggested using your initials for the extension so that’s what I do.
To start with open your start menu and click “Run Program” then enter "gksudo [editor]" (I use gedit)
Now we need to know what repositories to add. I added
## Testing
deb http://ftp.debian.org/debian/ testing main contrib non-free
## Testing Security updates
deb http://security.debian.org/ testing/updates main contrib
I just added these to the bottom of the list already there. Also i realised I mentioned unstable earlier in this post but I don’t really want to mess with that on this machine so I stayed with testing only. I also changed the existing repos from “squeeze” to “stable” just to keep everything the same.
Now we open /etc/apt/preferences and add
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
Pin: release a=unstable
Pin-Priority: 600
As you can see the Pin-Priority numbers decrease from stable to unstable this is because apt prioritises the highest number so you don’t end up upgrading every package on your system only the one you actual want.
Right so save that and return to your terminal.
Now I ran sudo apt-get install wireshark/testing but that returned errors due to incompatible version numbers of dependant libraries.
Just when I was about to pull my hair out I found this little gem sudo apt-get -t testing wireshark I ran that and it installed perfectly. So I had to check out the man page to find out what this magical -t flag actually did.
Trying to install wireshark with the first command wireshark/testing was only going to install the wireshark package from the testing repos and none of the dependancies but using -t testing means it gets everything it needs to install wireshark from the testing repo in other words the main package and all the dependancies.
Very nice and definately one to remember for future use.




