个人工具

“UbuntuHelp:PinningHowto”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第53行: 第53行:
 
sudo apt-get install nautilus=2.11.2-0ubuntu1
 
sudo apt-get install nautilus=2.11.2-0ubuntu1
 
</nowiki></pre>
 
</nowiki></pre>
https://help.ubuntu.com/community/[[UbuntuHelp:[[UbuntuHelp:IconsPage|IconsPage]]?|IconsPage]]??action=AttachFile&do=get&target=IconWarning3.png ''IMPORTANT:''
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconWarning3.png ''IMPORTANT:''
 
* the *unstable* version of Ubuntu is the version that is currently in development. This distribution sees all of the changes that packages go through, both small ones and more drastic ones which affect many packages or the whole system. For this reason, this version of the distribution should not be used by inexperienced users or by those who need proven stability.  
 
* the *unstable* version of Ubuntu is the version that is currently in development. This distribution sees all of the changes that packages go through, both small ones and more drastic ones which affect many packages or the whole system. For this reason, this version of the distribution should not be used by inexperienced users or by those who need proven stability.  
 
=== How to upgrade packages from specific versions of Ubuntu ===
 
=== How to upgrade packages from specific versions of Ubuntu ===

2007年12月5日 (三) 12:23的版本

Introduction and Pointers to better docs

First of all, I want to recommand to remove the sections below this one - the explanantions below are, in my opinion, hard to understand and point into wrong directions - even for people who know how pinning works and have a working setup. Pinning is a solution to be able to install packages from different Ubuntu releases on an Ubuntu system, without completely "polluting" your system with libraries and applications that are not meant for the version you are actually running. In other words: if you are running Ubuntu Dapper and need a newer version of a single program or want to run an app that is only available on Ubuntu Edgy, apt pinning might be the solution for you. It helps you to only install the app you need, and, if needed it's dependencies, from a repository that is made for another Ubuntu version- It might also work when you want to install an older version of a program on a newer version of ubuntu - just change the priorities/release appropriately. Pinning should not be used for installing Debian binary packages on Ubuntu. I strongly recommend against using Debian binary packages on Ubuntu, unless you know very well what you are doing - in case a package you need is only available in Debian, you should definitely try to build the package from Debian sources on Ubuntu as a first priority. In this case you don't need pinning. If you are new to the topic, here are two pointers to Howto's that get you up and running in some simple steps:

  • This link contains a very good description of what pinning is and how it works: [1]
  • And this is a very good and short introduction to pinning on Debian - for using it in Ubuntu one will have to adapt the release names in the sources.list and in the preferences file to Ubuntu release names: [2]

One thing that's not mentioned in the Ubuntu Howto, is the Error:

Reading package lists... Error!
E: Dynamic MMap ran out of room

and the amount of added cache described in the Debian Howto is not enough.

echo "APT::Cache-Limit 16777216;" >> /etc/apt/apt.conf

should help.

here the ancient article on pinning starts

!!!!!!!!!!!!!!!!!!! Attention !!!!!!!!!!!!!!!!!!! The nomenclature in the Release files (stored in /var/lib/apt/lists/) seems to have changed without notice and without the necessary adaptions of the man files as well as apt-show-versions. This seems to lead to major implications with the apt package manager especially if you leave your old /etc/apt/preferences file untouched. How to edit it does not seem to be documented anywhere however! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Usually people follow one of the versions of Ubuntu, you either run Ubuntu 5.04 (Hoary Hedgehog) or Ubuntu 5.10 (Breezy Badger), but sometimes you would like to do more. Or despite the fact that everybody says you shoudn't do it, you want to add packages from Debian sid. If that is you, then read on...

Contents

  • How to keep a mixed system
  • How to upgrade packages from specific versions of Ubuntu
  • How to keep specific versions of packages installed (complex)
  • An example /etc/apt/sources.list
  • Links

How to keep a mixed system

People are sometimes interested in using one of the Debian versions as its main system distribution and one or more packages from another branch. To set up what is your main version of Ubuntu you should edit the /etc/apt/apt.conf to contain the following line (you may need to create it):

APT::Default-Release "version";

Where version is the version of Ubuntu you want to use as the main distribution. The versions you can use are Ubuntu 5.04 (Hoary Hedgehog), Ubuntu 5.10 (Breezy Badger) or a later release name. To install packages from another version, then, you must use APT in the following way:

sudo apt-get -t <distribution> install package

For that to work, though, you need at least one APT source line in your /etc/apt/sources.list for the distribution you want the package from, and the package must exist on that source. See An example /etc/apt/sources.list, below. You can also request a specific version of a package using the following syntax:

sudo apt-get install package=version

For example, the line below will install version 2.2.4-1 of the nautilus package.:

sudo apt-get install nautilus=2.11.2-0ubuntu1

IconsPage?action=AttachFile&do=get&target=IconWarning3.png IMPORTANT:

  • the *unstable* version of Ubuntu is the version that is currently in development. This distribution sees all of the changes that packages go through, both small ones and more drastic ones which affect many packages or the whole system. For this reason, this version of the distribution should not be used by inexperienced users or by those who need proven stability.

How to upgrade packages from specific versions of Ubuntu

Apt-show-versions provides a safe way for users of mixed distributions to upgrade their systems without getting more of the less-stable distribution than they had in mind. For instance, it is possible to upgrade just your Hoary packages by running after having installed the apt-show-versions package: To install apt-show-versions:

sudo apt-get install apt-show-versions

To upgrade packages from hoary:

sudo apt-get install `apt-show-versions -u -b | grep hoary`

How to keep specific versions of packages installed (complex)

You may have occasion to modify something in a package and don't have time or don't want to port those changes to a new version of the program. Or, for instance, you may have just upgraded your Ubuntu distribution to Ubuntu 5.10 (Breezy Badger), but want to continue with the version of a certain package from Ubuntu 5.04 (Hoary Hedgehog). You can "pin" the version you have installed so that it will not be upgraded. Using this resource is simple. You just need to edit the file /etc/apt/preferences. The format is simple:

Package: <package>
Pin: <pin definition>
Pin-Priority: <pin's priority>

For example, to keep package sylpheed that I have modified to use "reply-to-list" at version 0.4.99, I add:

Package: sylpheed
Pin: version 0.4.99*

Note that I used an * (asterisk). This is a "wildcard"; it say that I want that this "pin" to be valid for all versions beginning with 0.4.99. This is because Ubuntu versions its packages with a "Ubuntu revision" and I don't want to avoid the installation of these revisions. So, for instance, versions 0.4.99-1 and 0.4.99-10 will be installed as soon as they are made available. Note that if you modified the package you won't want to do things this way. The Pin-Priority field is optional; if not specified, it defaults to 989. Let's take a look at how pin priorities work. A priority lower than 0 indicates that the package should never be installed. Priorities 0 to 100 denote packages that are not installed and that have no available versions. These won't come into the version-choosing process. Priority 100 is the priority assigned to an installed package - for the installed version of a package to be replaced by a different version, the replacement must have a priority greater than 100. Priorities above 100 indicate that a package should be installed. Typically, the installed version of a package is changed only to upgrade it to a newer version. Any priority between 100 and 1000 (inclusive) indicates this typical behavior. A package with such a priority will not downgrade to an available version with a lower version number. For instance, if I have sylpheed 0.5.3 installed and define a pin on sylpheed 0.4.99 with priority 999, package 0.4.99 will not be installed to satisfy the pin. To make a package "downgradable", to satisfy the pin, it needs possess a priority greater than 1000. A pin can be specified on a package's version, release or origin. Pinning on a version, as we have seen, supports literal version numbers as well as wildcards to specify several versions at one time. Option release depends on the Release file from an APT repository or from a CD. This option may be of no use at all if you're using package repositories that don't provide this file. You may see the contents of the Release files that you have on /var/lib/apt/lists/. The parameters for a release are: a (archive), c (components), v (version), o (origin) and l (label). An example:

Package: *
Pin: release v=2.2*,a=stable,c=main,o=Debian,l=Debian
Pin-Priority: 1001

In this example, we chose version 2.2* of Debian (which can be 2.2r2, 2.2r3 -- this accomodates "point releases" that typically include security fixes and other very important updates), the stable repository, section main (as opposed to contrib or non-free) and origin and label Debian. Origin (o=) defines who produced that Release file, the label (l=) defines the name of the distribution: Debian for Debian itself and Progeny for Progeny, for example. A sample Release file:

$ cat /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_warty_main_binary-i386_Packages
Archive: stable
Version: 2.2r3
Component: main
Origin: Ubuntu
Label: Debian
Architecture: i386

To see which source you have and which priorities they are assigned you can run apt-cache policy You can even find out which versions of a package you could install. Example for the "nautilus" package: apt-cache policy nautilus

An example /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu breezy universe
deb-src http://archive.ubuntu.com/ubuntu breezy universe
deb http://security.ubuntu.com/ubuntu breezy-security main restricted
deb-src http://security.ubuntu.com/ubuntu breezy-security main restricted
deb http://archive.ubuntu.com/ubuntu/ hoary main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ hoary main restricted universe
deb http://security.ubuntu.com/ubuntu/ hoary-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ hoary-security main restricted
#Mono
deb http://www.getsweaaa.com/~tseng/ubuntu/debs ./
deb-src http://www.getsweaaa.com/~tseng/ubuntu/debs ./

Links

These documents were used as a foundation for this page, and might give you more background information:

IconsPage?action=AttachFile&do=get&target=IconNote.png Note: Most of this document is taken from The official debian documentation