特殊:Badtitle/NS100:PinningHowto:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
(未显示同一用户的8个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/PinningHowto}} | {{From|https://help.ubuntu.com/community/PinningHowto}} | ||
{{Languages|UbuntuHelp:PinningHowto}} | {{Languages|UbuntuHelp:PinningHowto}} | ||
This wiki page will discuss some advanced things you can do to packages to accomplish specific goals. The first thing described is Pinning, this is useful if you want only some things from a newer version of Ubuntu. There is also package holding, which allows you to not update the package. | |||
== Introduction to Pinning == | |||
Pinning is | 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. | ||
Note however that the processes described below will only work if things like libc6 versions match, so you should probably not do this on an Ubuntu system. I strongly recommend you look at [[UbuntuHelp:UbuntuBackports|UbuntuBackports]] before doing this. | |||
=== Pinning Methods === | |||
There are 3 main files you must edit for pinning to even function. | |||
It is important to start out by setting your default release to avoid accidentally upgrading all packages, by editing /etc/apt/apt.conf [in intrepid that is /etc/apt/apt.conf.d/01ubuntu, "intrepid" rather than "hardy"] as follows: | |||
I strongly recommend | |||
<pre><nowiki> | <pre><nowiki> | ||
APT::Default-Release "hardy"; | |||
</nowiki></pre> | </nowiki></pre> | ||
The second file is: | |||
/etc/apt/sources.list | |||
An example configuration is as follows: | |||
<pre><nowiki> | <pre><nowiki> | ||
# official ubuntu sites | |||
deb http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse | |||
deb http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse | |||
</nowiki></pre> | </nowiki></pre> | ||
In this example, we're pulling from hardy and intrepid (the current development version of Ubuntu). | |||
The next file involved is: | |||
/etc/apt/preferences | |||
The 'preferences' file is where the actual pinning takes place. To pin a package, set its Pin-Priority to higher number. Here's an example: | |||
<pre><nowiki> | <pre><nowiki> | ||
Package: firefox-3.0 | |||
Pin: release a=hardy | |||
Pin-Priority: -10 | |||
Package: firefox-3.0 | |||
Pin: release a=intrepid | |||
Pin-Priority: 900 | |||
</nowiki></pre> | </nowiki></pre> | ||
In this example, we're giving a higher priority to Firefox from intrepid because we want rc1 instead of beta5. This of course can be done with any package, or even all packages - although in the above example, you likely want to change hardy and intrepid Pin-Priority values around so that hardy is default. For further information please read: man apt_preferences | |||
==== Debugging Package Priorities ==== | |||
To print out the priorities of each source, run `apt-cache policy`. For priorities for packages, run `apt-cache policy packagename[s]`. | |||
=== Recommended alternative to pinning === | |||
In Ubuntu, most times, the libc6 version is updated from version to version - it is not the purpose of this page to describe what libc6 is, but needless to say it breaks the above example. | |||
A better method for grabbing things from a development version while not committing your entire machine to that version is as follows: | |||
Add the following line to /etc/apt/sources.list | |||
<pre><nowiki> | <pre><nowiki> | ||
deb-src http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse | |||
</nowiki></pre> | </nowiki></pre> | ||
Then you'll need to update your repos: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get | sudo apt-get update | ||
</nowiki></pre> | </nowiki></pre> | ||
Now we need to install some packages so we can build the desired software in intrepid: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get | sudo apt-get build-dep firefox-3.0 | ||
</nowiki></pre> | </nowiki></pre> | ||
Now we can do the following to get the package built from intrepid on our hardy machine: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get | sudo apt-get -b source -t intrepid firefox-3.0 | ||
</nowiki></pre> | </nowiki></pre> | ||
It will output lots of info on the screen, when it's done (could take a while), you will have rc1 instead of beta5! | |||
== Introduction to Holding Packages == | |||
Holding a package basically means you're telling the package manager to keep the current version no matter what. This is useful if more recent version of a currently working program breaks after an update. | |||
The following will describe the process of actually holding the package, there are several options to accomplish this: | |||
=== Synaptic === | |||
{|border="1" cellspacing="0" | |||
| https://help.ubuntu.com/community/PinningHowto?action=AttachFile&do=get&target=lockver.png | |||
|} | |||
First way to hold a package is in Synaptic: | |||
*Open Synaptic: System -> Administration -> Synaptic Package Manager | |||
*Click Search and type the package's name in the Search box | |||
*Highlight the version you want to pin '''Make sure that you select the correct version''' | |||
*Once the correct package is selected, Click Package -> Lock Version | |||
*Close Synaptic | |||
<<BR>> | |||
=== Apt/Dpkg === | |||
Second way is to hold it with Apt/Dpkg: | |||
*Open a terminal | |||
*sudo -s and hit enter | |||
*Enter your password for sudo | |||
<pre><nowiki> | <pre><nowiki> | ||
echo libxfont1 hold | dpkg --set-selections | |||
</nowiki></pre> | </nowiki></pre> '''Replace libxfont1 with the package you want to pin''' | ||
== | *Now run sudo apt-get update and then sudo apt-get upgrade | ||
== Removing a Hold == | |||
To remove a package from hold, you can run "sudo apt-get install libxfont1" (replacing libxfont1 with the package you wish to remove). To see what the next version of the package is, use `apt-cache policy packagename` (see ''Debugging Package Priorities'' above). | |||
=== Synaptic === | |||
To remove the pin in Synaptic: | |||
*Open Synaptic | |||
*Search for the correct package | |||
*Click on package to highlight it | |||
*Once the correct package is selected, Click Package -> Lock Version to remove the checkmark | |||
*Close Synaptic | |||
<pre><nowiki> | === Apt/Dpkg === | ||
To remove pin from Apt/Dpkg: | |||
*Open a terminal | |||
</nowiki></pre> | *sudo -s and hit enter | ||
*Enter your password for sudo | |||
*<pre><nowiki> | |||
echo libxfont1 install | dpkg --set-selections | |||
</nowiki></pre> '''Replace libxfont1 with the package you want to pin''' | |||
*Now run sudo apt-get update and then sudo apt-get upgrade | |||
'''NOTE''' | |||
At the time of the making this Wiki there is not a known way to Pin a package with Update Manager. | |||
Pinning should never be used for installing Debian binary packages on Ubuntu. | |||
Ubuntu strongly recommends against using Debian binary packages on Ubuntu, | |||
== Karmic Example == | |||
=== Pinning the ubuntu-mozilla-daily PPA === | |||
"I regularly use a package from the Ubuntu Daily Mozilla PPA. Unfortunately the PPA also contains snapshot builds of Firefox 3.5 and XulRunner 1.9.1, which I want to keep at their standard Ubuntu versions". | |||
The Pinning Solution | |||
To make apt-get upgrading as painless as possible set a lower Pin-Priority on the PPA, this will stop unwanted package versions from installing. Once set, packages from the ubuntu-mozilla-daily PPA will always lose in any contest with packages from other repositories, even if they have a higher version. | |||
Create the file: | |||
<ol><li>/etc/apt/preferences.d/ubuntu-mozilla-daily-pin-400 | |||
</li><li>Add the following to the file:</li></ol> | |||
Code: | |||
<pre><nowiki> | <pre><nowiki> | ||
Package: * | Package: * | ||
Pin: release | Pin: release o=LP-PPA-ubuntu-mozilla-daily | ||
Pin-Priority: | Pin-Priority: 400 | ||
</nowiki></pre> | </nowiki></pre> | ||
Use the following commands, before and after, to check that the Pin-Priority has been updated. | |||
<pre><nowiki> | <pre><nowiki> | ||
apt-cache policy | |||
</nowiki></pre> | </nowiki></pre> | ||
<pre><nowiki> | <pre><nowiki> | ||
apt-cache policy firefox-3.5 | |||
</nowiki></pre> | </nowiki></pre> | ||
Make sure the file name does not have a dot in it! | |||
== Links == | |||
These documents were used as a foundation for this page, and might give you more background information: | These documents were used as a foundation for this page, and might give you more background information: | ||
* For Basic apt-get usage and instructions see [[UbuntuHelp:AptGetHowTo|AptGetHowTo]] | * For Basic apt-get usage and instructions see [[UbuntuHelp:AptGetHowTo|AptGetHowTo]] | ||
* [http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html The official | * [http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html The official Debian documentation] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 23:53的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/PinningHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/af | • {{#if: UbuntuHelp:PinningHowto|Afrikaans| [[::PinningHowto/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ar | • {{#if: UbuntuHelp:PinningHowto|العربية| [[::PinningHowto/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/az | • {{#if: UbuntuHelp:PinningHowto|azərbaycanca| [[::PinningHowto/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/bcc | • {{#if: UbuntuHelp:PinningHowto|جهلسری بلوچی| [[::PinningHowto/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/bg | • {{#if: UbuntuHelp:PinningHowto|български| [[::PinningHowto/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/br | • {{#if: UbuntuHelp:PinningHowto|brezhoneg| [[::PinningHowto/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ca | • {{#if: UbuntuHelp:PinningHowto|català| [[::PinningHowto/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/cs | • {{#if: UbuntuHelp:PinningHowto|čeština| [[::PinningHowto/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/de | • {{#if: UbuntuHelp:PinningHowto|Deutsch| [[::PinningHowto/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/el | • {{#if: UbuntuHelp:PinningHowto|Ελληνικά| [[::PinningHowto/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/es | • {{#if: UbuntuHelp:PinningHowto|español| [[::PinningHowto/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/fa | • {{#if: UbuntuHelp:PinningHowto|فارسی| [[::PinningHowto/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/fi | • {{#if: UbuntuHelp:PinningHowto|suomi| [[::PinningHowto/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/fr | • {{#if: UbuntuHelp:PinningHowto|français| [[::PinningHowto/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/gu | • {{#if: UbuntuHelp:PinningHowto|ગુજરાતી| [[::PinningHowto/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/he | • {{#if: UbuntuHelp:PinningHowto|עברית| [[::PinningHowto/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/hu | • {{#if: UbuntuHelp:PinningHowto|magyar| [[::PinningHowto/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/id | • {{#if: UbuntuHelp:PinningHowto|Bahasa Indonesia| [[::PinningHowto/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/it | • {{#if: UbuntuHelp:PinningHowto|italiano| [[::PinningHowto/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ja | • {{#if: UbuntuHelp:PinningHowto|日本語| [[::PinningHowto/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ko | • {{#if: UbuntuHelp:PinningHowto|한국어| [[::PinningHowto/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ksh | • {{#if: UbuntuHelp:PinningHowto|Ripoarisch| [[::PinningHowto/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/mr | • {{#if: UbuntuHelp:PinningHowto|मराठी| [[::PinningHowto/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ms | • {{#if: UbuntuHelp:PinningHowto|Bahasa Melayu| [[::PinningHowto/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/nl | • {{#if: UbuntuHelp:PinningHowto|Nederlands| [[::PinningHowto/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/no | • {{#if: UbuntuHelp:PinningHowto|norsk| [[::PinningHowto/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/oc | • {{#if: UbuntuHelp:PinningHowto|occitan| [[::PinningHowto/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/pl | • {{#if: UbuntuHelp:PinningHowto|polski| [[::PinningHowto/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/pt | • {{#if: UbuntuHelp:PinningHowto|português| [[::PinningHowto/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ro | • {{#if: UbuntuHelp:PinningHowto|română| [[::PinningHowto/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/ru | • {{#if: UbuntuHelp:PinningHowto|русский| [[::PinningHowto/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/si | • {{#if: UbuntuHelp:PinningHowto|සිංහල| [[::PinningHowto/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/sq | • {{#if: UbuntuHelp:PinningHowto|shqip| [[::PinningHowto/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/sr | • {{#if: UbuntuHelp:PinningHowto|српски / srpski| [[::PinningHowto/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/sv | • {{#if: UbuntuHelp:PinningHowto|svenska| [[::PinningHowto/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/th | • {{#if: UbuntuHelp:PinningHowto|ไทย| [[::PinningHowto/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/tr | • {{#if: UbuntuHelp:PinningHowto|Türkçe| [[::PinningHowto/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/vi | • {{#if: UbuntuHelp:PinningHowto|Tiếng Việt| [[::PinningHowto/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/yue | • {{#if: UbuntuHelp:PinningHowto|粵語| [[::PinningHowto/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/zh | • {{#if: UbuntuHelp:PinningHowto|中文| [[::PinningHowto/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/zh-hans | • {{#if: UbuntuHelp:PinningHowto|中文(简体)| [[::PinningHowto/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PinningHowto | UbuntuHelp:PinningHowto | {{#if: | :}}PinningHowto}}/zh-hant | • {{#if: UbuntuHelp:PinningHowto|中文(繁體)| [[::PinningHowto/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:PinningHowto|:PinningHowto|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :PinningHowto/zh | | {{#ifexist: PinningHowto/zh | | {{#ifeq: {{#titleparts:PinningHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:PinningHowto|1|-1|}} | zh | | }}
This wiki page will discuss some advanced things you can do to packages to accomplish specific goals. The first thing described is Pinning, this is useful if you want only some things from a newer version of Ubuntu. There is also package holding, which allows you to not update the package.
Introduction to 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. Note however that the processes described below will only work if things like libc6 versions match, so you should probably not do this on an Ubuntu system. I strongly recommend you look at UbuntuBackports before doing this.
Pinning Methods
There are 3 main files you must edit for pinning to even function. It is important to start out by setting your default release to avoid accidentally upgrading all packages, by editing /etc/apt/apt.conf [in intrepid that is /etc/apt/apt.conf.d/01ubuntu, "intrepid" rather than "hardy"] as follows:
APT::Default-Release "hardy";
The second file is: /etc/apt/sources.list An example configuration is as follows:
# official ubuntu sites deb http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
In this example, we're pulling from hardy and intrepid (the current development version of Ubuntu). The next file involved is: /etc/apt/preferences The 'preferences' file is where the actual pinning takes place. To pin a package, set its Pin-Priority to higher number. Here's an example:
Package: firefox-3.0 Pin: release a=hardy Pin-Priority: -10 Package: firefox-3.0 Pin: release a=intrepid Pin-Priority: 900
In this example, we're giving a higher priority to Firefox from intrepid because we want rc1 instead of beta5. This of course can be done with any package, or even all packages - although in the above example, you likely want to change hardy and intrepid Pin-Priority values around so that hardy is default. For further information please read: man apt_preferences
Debugging Package Priorities
To print out the priorities of each source, run `apt-cache policy`. For priorities for packages, run `apt-cache policy packagename[s]`.
Recommended alternative to pinning
In Ubuntu, most times, the libc6 version is updated from version to version - it is not the purpose of this page to describe what libc6 is, but needless to say it breaks the above example. A better method for grabbing things from a development version while not committing your entire machine to that version is as follows: Add the following line to /etc/apt/sources.list
deb-src http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse
Then you'll need to update your repos:
sudo apt-get update
Now we need to install some packages so we can build the desired software in intrepid:
sudo apt-get build-dep firefox-3.0
Now we can do the following to get the package built from intrepid on our hardy machine:
sudo apt-get -b source -t intrepid firefox-3.0
It will output lots of info on the screen, when it's done (could take a while), you will have rc1 instead of beta5!
Introduction to Holding Packages
Holding a package basically means you're telling the package manager to keep the current version no matter what. This is useful if more recent version of a currently working program breaks after an update. The following will describe the process of actually holding the package, there are several options to accomplish this:
Synaptic
First way to hold a package is in Synaptic:
- Open Synaptic: System -> Administration -> Synaptic Package Manager
- Click Search and type the package's name in the Search box
- Highlight the version you want to pin Make sure that you select the correct version
- Once the correct package is selected, Click Package -> Lock Version
- Close Synaptic
<
>
Apt/Dpkg
Second way is to hold it with Apt/Dpkg:
- Open a terminal
- sudo -s and hit enter
- Enter your password for sudo
echo libxfont1 hold | dpkg --set-selections
Replace libxfont1 with the package you want to pin
- Now run sudo apt-get update and then sudo apt-get upgrade
Removing a Hold
To remove a package from hold, you can run "sudo apt-get install libxfont1" (replacing libxfont1 with the package you wish to remove). To see what the next version of the package is, use `apt-cache policy packagename` (see Debugging Package Priorities above).
Synaptic
To remove the pin in Synaptic:
- Open Synaptic
- Search for the correct package
- Click on package to highlight it
- Once the correct package is selected, Click Package -> Lock Version to remove the checkmark
- Close Synaptic
Apt/Dpkg
To remove pin from Apt/Dpkg:
- Open a terminal
- sudo -s and hit enter
- Enter your password for sudo
echo libxfont1 install | dpkg --set-selections Replace libxfont1 with the package you want to pin
- Now run sudo apt-get update and then sudo apt-get upgrade
NOTE At the time of the making this Wiki there is not a known way to Pin a package with Update Manager. Pinning should never be used for installing Debian binary packages on Ubuntu. Ubuntu strongly recommends against using Debian binary packages on Ubuntu,
Karmic Example
Pinning the ubuntu-mozilla-daily PPA
"I regularly use a package from the Ubuntu Daily Mozilla PPA. Unfortunately the PPA also contains snapshot builds of Firefox 3.5 and XulRunner 1.9.1, which I want to keep at their standard Ubuntu versions". The Pinning Solution To make apt-get upgrading as painless as possible set a lower Pin-Priority on the PPA, this will stop unwanted package versions from installing. Once set, packages from the ubuntu-mozilla-daily PPA will always lose in any contest with packages from other repositories, even if they have a higher version. Create the file:
- /etc/apt/preferences.d/ubuntu-mozilla-daily-pin-400
- Add the following to the file:
Code:
Package: * Pin: release o=LP-PPA-ubuntu-mozilla-daily Pin-Priority: 400
Use the following commands, before and after, to check that the Pin-Priority has been updated.
apt-cache policy
apt-cache policy firefox-3.5
Make sure the file name does not have a dot in it!
Links
These documents were used as a foundation for this page, and might give you more background information:
- For Basic apt-get usage and instructions see AptGetHowTo
- The official Debian documentation