Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I limit the updates that are installed to those from a specific set of repositories? Is this at all possible?

share|improve this question
Do you want to be able to specify repo during runtime, or should be it be more a static thing? The two answers below assume the latter option. – Tshepang Feb 21 '11 at 12:50
Ideally it would be during runtime. The static option is sufficient though. – Ton van den Heuvel Feb 22 '11 at 8:11
You heading and the actual help you are requesting are different. – sundar Apr 27 at 15:08
up vote 17 down vote accepted

Use Pinning

Pinning is a process that allows you to remain on a stable release of Ubuntu (or any other debian system) while grabbing packages from a more recent version. —

You can disable automatic updates from certain repositories without entirely removing them via apt policies:

To disable automatic updates from repository repo, add a file
/etc/apt/preferences.d/repo with the following content:

Package: *
Pin: release n=repo
Pin-Priority: 50

Which will give all packages from this repository a lower priority than already installed packages (which have 100).

For more information man apt_preferences or check the Ubuntu Community Wiki.

share|improve this answer
It’s a shame the only apt_preferences answer is the last... – Robert Siemer Jan 25 '14 at 9:22
how to find out which version is from which repo? – Max N Jun 15 at 12:13

You can specify a release with -t option. As an example, I have added the following repository to /etc/apt/sources.list to install Iceweasel latest release:

deb squeeze-backports iceweasel-release

As you know there is a same package iceweasel in the official Debian repository. If I want install Iceweasel from this specific release I run:

apt-get install -t squeeze-backports iceweasel

from apt-get manual page:

-t, --target-release, --default-release
           This option controls the default input to the policy engine, it creates a default pin at priority 990 using the specified
           release string. This overrides the general settings in /etc/apt/preferences. Specifically pinned packages are not affected by
           the value of this option. In short, this option lets you have simple control over which distribution packages will be retrieved
           from. Some common examples might be -t '2.1*', -t unstable or -t sid. Configuration Item: APT::Default-Release; see also the
           apt_preferences(5) manual page.

I think this is a better solution.

UPDATE: As @SuB mentioned in the comment, "-t specifies release not repository name. There is no repository name in Ubuntu (unlike RedHat based linux such as RHEL,Fedora,CentOS, ...)".

share|improve this answer
As you see in the apt-get manual, -t specify release not repository name. There is no repository name in Ubuntu (unlike RedHat based linux such as RHEL,Fedora,CentOS, ...) – SuB Sep 20 '13 at 17:31
@SuB Yes, you're right! I confused repository name with release! – cartoonist Sep 21 '13 at 15:19

A gui based alternative would be to open software centre and select edit > software sources...

Software Sources with Ubuntu software tab selected

Software Sources with other software tab selected

all you need to do is un-tick the repositories you don't want updates from.

Hope this helps

share|improve this answer

Obvious choice is to modify /etc/apt/sources.list and comment out all other repositories, and then run

apt-get update && apt-get upgrade && apt-get autoclean

And then remove comments from sources.list. Maybe not the best way, but at least apt-get man pages do not specify any way to do that.

On related note, for example Ubuntu distribution upgrade process disables all 3rd party repositories during upgrade (and do not just run some option to exclude those temporarily).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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