How-To: Fix LMDE Repo Hell

LMDE is a great distro, but the repo situation is a bit of a mess, what with all the update packs and tracking testing or sid or romeo or wheezy or… yeah, it gets confusing. As I wanted to build openFrameworks the other day and it was moaning about libavcodec and libavcodec-dev mismatches I did a bit of searching around and found this thread over on the mint forums, and making the following changes fixed up the repo issues in no time:

Change your main repos (in /etc/apt/sources.list) to:

deb http://packages.linuxmint.com/ debian main upstream import
deb-src http://packages.linuxmint.com/ debian main upstream import
# deb http://debian.linuxmint.com/incoming testing main contrib non-free
# deb http://debian.linuxmint.com/incoming/security testing/updates main contrib non-free
# deb http://debian.linuxmint.com/incoming/multimedia testing main non-free
 
## DEBIAN
deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free
deb http://www.deb-multimedia.org testing main non-free

If you wanted to then make sure the Mint repos take precedence over the Debian ones, put something like the following in /etc/apt/preferences:

Package: *
Pin: release o=linuxmint
Pin-Priority: 700
 
Package: *
Pin: origin packages.linuxmint.com
Pin-Priority: 700
 
Package: *
Pin: release o=Debian
Pin-Priority: 500

Once you perform an update to get the new package listings and upgrade, all package mismatches should be fixed and you can actually build stuff! Woo! =D

Update May 2012: Getting a large number of packages to be removed when you contemplate updating/upgrading? Pin all repos to 500 (i.e. level the playing field) to fix! Source: http://forum.linuxmint.com/viewtopic.php?f=198&t=67502&p=578038. Thanks, ZeroZero!