I've added the ubuntu base repo http://archive.ubuntu.com/ubuntu vivid main and a couple of PPAs into my debian installation to get access to some software that's not available on a debian repo. I've setup my apt preferences to be the following:

Package: *
Pin: release o=Debian,a=jessie
Pin-Priority: 1001

Package: *
Pin: release o=Debian,a=wheezy
Pin-Priority: 990

Package: *
Pin: release o=Ubuntu,a=vivid
Pin-Priority: 500

Package: *
Pin: release o=Ubuntu,a=utopic
Pin-Priority: 400

However whenever I do apt-get upgrade or apt-get dist-upgrade I get a whole bunch of ubuntu packages in there. Is there anyway to prevent that from happening? I just want the ubuntu repos for very select packages. I know I could just add the repos temporarily and then remove them and re-add them but that seems like a hassle. Are my priorities too high? Or is it something else?

The result of apt-cache policy ffmpeg:

Installed: (none)
Candidate: 6:0.8.17-1
Version table:
 7:2.4.3-1ubuntu1~utopic1 0
    400 http://ppa.launchpad.net/kirillshkrogalev/ffmpeg-next/ubuntu/ utopic/main amd64 Packages
 6:0.8.17-1 0
    990 http://ftp.us.debian.org/debian/ wheezy/main amd64 Packages
  • If you only want certain packages, why not give high priority for these packages only? Anyway, what you see is that probably there are some other packages needed, that aren't in Debian repo - hence it decides to pull them, despite being low priority - because it simply decided that they are the only ones out there. – MatthewRock Sep 25 '15 at 8:43
  • I didn't specify specific packages because won't I run into dependency issues doing that? And I figured that's what I was seeing but is there any way to prevent that? – Scoopta Sep 25 '15 at 8:46
  • May I ask what exactly are you trying to install? – MatthewRock Sep 25 '15 at 8:51
  • @MatthewRock OBS, ffmpeg, and handbrake – Scoopta Sep 25 '15 at 8:53
  • Why Ubuntu? It looks like handbrake is available for Debian. Also, here is post about ffmpeg on debian(but if you only need it for handbrake, you probably don't need it). – MatthewRock Sep 25 '15 at 8:59

Try running apt-cache policy with no arguments to see if the pinning preferences you set are having the effect you thought they would.

If that doesn't help, try running apt-cache policy with a package name which is unexpectedly being pulled from ubuntu. This should show you the available versions of that package, the scores it gets assigned, and it will mark (by way of a *** marker) which package apt considers the 'best' option.

If that doesn't help you, post the output of the above two commands.

  • I don't see a *** marker but I believe it's looking at the proper repo...I'll edit my original post with the result. – Scoopta Sep 25 '15 at 21:48
  • Actually, I was mistaken; what you need to look at is the candidate. The output says 'candidate: 6:0.8.17-1', so that part seems to work. If the ubuntu version still gets pulled in, that can only mean one of the packages you're upgrading has a dependency on the new version of ffmpeg, or a conflict against the old one. Try running apt-get install on the packages which apt wants to upgrade, until you see ffmpeg pulled in; you'll then know which of the packages or package sets has the dependency or conflict that causes it to happen. Run apt-cache policy on those packages, too. – Wouter Verhelst Sep 25 '15 at 22:10
  • So I installed ffmpeg and it came from the debian repos but it's the wrong ffmpeg. There's a certain dependency that comes with the ubuntu one but apt doesn't want to install it. It looks like it's going to have to update pulse and some other stuff to the ubuntu versions. Apparently the debian ones are versioned differently or something. When I try to install obs I get The following packages have unmet dependencies: obs-studio : Depends: libavdevice-ffmpeg56 (>= 7:2.4) but it is not going to be installed Depends: libfdk-aac0 (>= 0.1.1) but it is not installable – Scoopta Sep 25 '15 at 22:34
  • I guess I should start a new question...my original question has been resolved. I figured out that I need to do n=jessie instead of a=jessie so thanks. – Scoopta Sep 25 '15 at 22:37

At least one problem is in your references to Debian repositories. Change the first two rules in your apt preferences to:

Package: *
Pin: release o=Debian,n=jessie
Pin-Priority: 1001

Package: *
Pin: release o=Debian,n=wheezy
Pin-Priority: 990

This will cause apt-update to replace everything installed on your system with the version in jessie if availble (even if it is a downgrade). Packages not availble in jessie will prefer wheezy (or a specified target) over other availble repositories (assuming an upgrade from currently installed). I'm not sure if the archives in Ubuntu repositories are named with the codenames or if you also must change the "a=" to "n=" for those entries.

See the apt preferences man page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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