Linux Panda

Open Source | Linux | Android | Tech

Apt Pinning Debian Multimedia Using Preferences


In this guide, we are going to see the steps to apt pinning Debian Multimedia repo using preferences in Debian.

 

Debian

 

Disclaimer:

Before we proceed, I want to let you know that even though the steps in this guide works in my Debian installation properly, it does not mean that the Apt-Pinning method used in this guide may work properly in your system too and/or may break the installation.

So please read more about Apt-Pinning in the Debian Wiki before proceeding further.

 

Multimedia codecs (3rd party repo)

If you want to install w32codecs and libdvdcss2 (required for the decryption of CSS protected-DVD), then you need to add the 3rd party repository deb-multimedia to do that.

Now open /etc/apt/sources.list and add the deb-multimedia repository.
sudo vi /etc/apt/sources.list

 

Add the following lines to the sources.list,

#Debian Multimedia
deb http://www.deb-multimedia.org jessie main non-free
deb-src http://www.deb-multimedia.org jessie main non-free

Now we have to deal with one more issue. Both debian.org and deb-multimedia.org host packages with same names in their repositories.

So we have to set apt pinning in such a way that the packages with same names that exist in both the repositories are downloaded from debian.org and not deb-multimedia.org.

 

Setting Preference by Origin

In order to do that we are going to use pin priority.
sudo vi /etc/apt/preferences

Package: *
Pin: origin *.debian.org
Pin-Priority:610

Package: *
Pin: origin *.deb-multimedia.org
Pin-Priority: 600

Now don’t copy paste that as it is.

You should edit the 2nd line “*.debian.org” as per the repository you are using.

 

For example if your repository in /etc/apt/sources.list looks like the following, which uses “mirror.cc.columbia.edu” as the mirror,

deb http://ftp.mirror.cc.columbia.edu/debian jessie main contrib non-free
deb-src http://ftp.mirror.cc.columbia.edu/debian jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

then your /etc/apt/preferences file should be like,

Package: *
Pin: origin *.cc.columbia.edu
Pin-Priority:610

Package: *
Pin: origin *.deb-multimedia.org
Pin-Priority: 600

I hope you understood that.

You have to use the domain of the repository that you are using in your /etc/apt/sources.list file.

 

Now we have to update and install the multimedia keyring before installing those extra codecs.
sudo apt-get update
sudo apt-get install deb-multimedia-keyring
sudo apt-get install w32codecs libdvdcss2

 

 

Steps to install package that have conflict in dependencies between debian repository & “deb-multimedia” repository

sudo apt-get install mencoder
When you try to install mencoder as per the configuration in the preferences file, you’ll face the following error.

The following packages have unmet dependencies:

mencoder : Depends: libmp3lame0 (>= 1:3.99.0) but 3.99.5+repack1-3 is to be installed
E: Unable to correct problems, you have held broken packages.

So we have to update the preferences file to resolve the conflict between dependencies.
sudo vi /etc/apt/preferences

Package: libmp3lame0
Pin: origin *.deb-multimedia.org
Pin-Priority: 610

Package: libmp3lame0
Pin: origin *.debian.org
Pin-Priority: 600

Package: *
Pin: origin *.debian.org
Pin-Priority: 610

Package: *
Pin: origin *.deb-multimedia.org
Pin-Priority: 600

Since mencoder needs the “libmp3lame0″ package from “deb-multimedia.org” repository, we need to set a high pin-priority for that package. Now you will be able to install mencoder as the package “libmp3lame0″ will be downloaded from “deb-multimedia.org”.

 

Now lets update & install mencoder
sudo apt-get update
sudo apt-get install mencoder

 

For such conflicts, you have to update the preferences file for each package. You can add the packages separated by space. Ill show an example using the same package name.

Package: libmp3lame0 libmp3lame0 libmp3lame0
Pin: origin *.deb-multimedia.org
Pin-Priority: 610

Package: libmp3lame0 libmp3lame0 libmp3lame0
Pin: origin *.debian.org
Pin-Priority: 600

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: