Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

This question already has an answer here:

Is there a way to cherry pick packages from a ppa repository you add? That is, to exclude some from updating while including others?

For example, I want just the chromium-browser package from this repository but not the others. So I don't want my sudo apt-get upgrade to have that ppa's other (besides chromium-browser) packages install over my existing ones, just that one.

I realize this is a license to shoot myself in the foot if I misread dependencies and exclude ones that are needed to ones that I included, but I know for a fact in this case that the other packages are not dependencies for that one.

Is this at all possible? Maybe there is some whitelist/blacklist file or something?

share|improve this question

marked as duplicate by Eliah Kagan, Warren Hill, muru, Andrea Corbellini, Eric Carvalho Aug 19 '14 at 16:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I'd pass on synaptic for three reasons: Ubuntu dropped it as the software updater in favor Ubuntu Software Center, I didn't see a way for Synaptic to stop upgrades from a ppa over installed files (which was my problem), and I prefer a command line solution to a GUI one. Ended up finding something that worked (see my answer below). –  yuvilio Jul 31 '12 at 4:58
The Software Center is used for Installing and Removing software, Update Manager is used for Updating, you could have used pinning in Synaptic so the other packages wouldn't upgrade, also for a new user that wouldn't want to mess with the Terminal the GUI would be preferred, of course yours is pretty much the correct answer. –  Uri Herrera Jul 31 '12 at 5:01
There are a few things you simply can't do via Software-Center (which are easy with Synaptic). And not everyone (especially newbies) is comfortable with the commandline. –  Mrokii Jul 31 '12 at 20:32
@Mrokii I agree that my approach is not for beginners. The Synaptic answer you wrote and Uri Herrera hinted at, which I assume works, is better in that regard. I'll let others who try it rate it. –  yuvilio Jul 31 '12 at 21:22

3 Answers 3

up vote 36 down vote accepted

Found one way to do it.

The trick is using two pinning clauses. The first to disallow ALL packages from the PPA and the second to select the ones you want.

So for the example above, I first add the ppa as usual:

$ sudo add-apt-repository ppa:webapps/preview
$ sudo apt-get update

Now if i run apt-cache policy, it will show me that there's a newer version of chromium-browser available and that it will install with an upgrade because it's in the same priority (500) as my current chromium-browser.

$ sudo apt-cache policy chromium-browser
  Installed: 18.0.1025.168~r134367-0ubuntu0.12.04.1
  Candidate: 20.0.1132.47~r144678-0precise1+webapps3
  Version table:
     20.0.1132.47~r144678-0precise1+webapps3 0
        500 http://ppa.launchpad.net/webapps/preview/ubuntu/ precise/main amd64 Packages
 *** 18.0.1025.168~r134367-0ubuntu0.12.04.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
        500 http://ppa.launchpad.net/chromium-daily/beta/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
     18.0.1025.151~r130497-0ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
E: Unable to parse package file /etc/apt/preferences.d/webapps-preview-pin-400 (1)

That's great as far as that package but I don't want the others in this ppa (which also have a 500 priority) to install. Right now if I try to upgrade, I'll get more than just the chromium packages I want from that repository:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  bamfdaemon gwibber gwibber-service gwibber-service-facebook gwibber-service-twitter indicator-appmenu libbamf0 libbamf3-0 shotwell
The following packages will be upgraded:
  chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg gwibber-service-identica indicator-messages indicator-status-provider-mc5
  indicator-status-provider-pidgin libindicator-messages-status-provider1
8 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Need to get 25.3 MB of archives.
After this operation, 5,034 kB of additional disk space will be used.
Do you want to continue [Y/n]? 

So what I can do is tell apt that I want all the packages in that ppa, webapps-preview in this case, to have a lower priority except the ones with "chromium" in their name. The mechanism for this is pinning a package

I create a file in /etc/apt/preferences.d/ with two clauses. The first one says give all the packages in the webapps-preview ppa a lower priority than the regular one (so that they are not preferred even if they have a higher version number. The second clause partly overrides the first by saying give the packages in that ppa with "chromium" in their name the same priority as other packages so that it will get installed (by it having a higher version number).

$ cat /etc/apt/preferences.d/webapps-preview-pin-400
Package:  *
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 400

Package:  *chromium*
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 500

To identify the correct string for "Pin: release" option we can use apt-cache policy again.

$ apt-cache policy
500 http://ppa.launchpad.net/webapps/preview/ubuntu/ precise/main i386 Packages
    release v=12.04,o=LP-PPA-webapps-preview,a=precise,n=precise,l=preview,c=main
    origin ppa.launchpad.net

For apt versions < 0.8.14 pinned packages have to be specified explicitly as wildcards do not work:

$ cat /etc/apt/preferences.d/webapps-preview-pin-400
Package:  *
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 400

Package:  chromium-browser chromium-codecs-ffmpeg chromium-browser-l10n chromium-codecs-ffmpeg-extra
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 500

And now, when i try to upgrade I get only the packages I want from that ppa and not the other ones. All nicely cherry picked for me:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.1 MB of archives.
After this operation, 5,026 kB of additional disk space will be used.
Do you want to continue [Y/n]?
share|improve this answer
pretty complicated, imho. –  Mrokii Jul 31 '12 at 20:23
I disagree, this is pretty straight forward for what someone likes wants. And nice to have all the instructions on identifying the ppa's Pin name. –  Nicholi Mar 25 '14 at 22:18

You can actually "cherry pick" certain packages via Synaptic and it's very easy. It works like this:

  • If you want to do that for certain PPAs only, chose "Origin" (lower left corner) in the Synaptic-window and then choose the PPA you want to change

  • choose all the packages you don't want to upgrade automatically any more.

  • choose menu "Package/Lock Version". All the packages you chose won't be upgraded automatically anymore until you unlock them again.

share|improve this answer

You can also select the release you want to install from with the ?origin selector:

Matches package versions whose origin matches the regular expression origin. For instance, “!?origin(debian)” will find any unofficial packages on your system (packages not from the Debian archive).

So, in your specific case you can use:

sudo aptitude install ~OLP-PPA-webapps-preview chromium

Or you can specify the version using <packagename>=<version>:

sudo apt-get install chromium=20.0.1132.47~r144678-0precise1+webapps3
share|improve this answer
But in order to do "install package/ppa-name", don't you need to add-repository the ppa? In which case on next upgrade you still get asked if you want to upgrade to all the packages from that ppa? –  unhammer May 20 '14 at 20:41
@unhammer sorry, that part doesn't make sense in apt-get but aptitude, corrected now –  Braiam May 20 '14 at 21:26

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