Project

General

Profile

Apt Pinning » History » Version 2

fixeria, 07/25/2022 04:59 PM
Fixed typos

1 1 laforge
h1. Apt Pinning
2
3 2 fixeria
When adding multiple package repositories (such as our [[Latest_Builds]] or [[Nightly_Builds]]) to your package manager, the situation might arise that multiple repositories offer a package.
4 1 laforge
5
This happens, for example, if your distribution offers one (typically older) version of osmo-bsc, while the osmocom feeds offer a newer version.  _Usually_ it works as our versions are higher, but sometimes package names change, or other aspects of the packages change, making the automatic guess not what you'd want.
6
7
_apt pinning_ is what you can use to help the apt package manager on Debian/Unbuntu based GNU/Linux distributions figuring out *which* of the packages to install in case there are multiple different repositories providing a package of the same name.
8
9
h2. Example of apt-pinning always preferring osmocom packages over upstream
10
11 2 fixeria
Create a file @/etc/apt/preferences.d/osmocom@ with the following content
12 1 laforge
13
<pre>
14
Package: *
15
Pin: release o=obs://osmocom/osmocom:nightly/Raspbian_10
16
Pin-Priority: 1001
17
</pre>
18
19 2 fixeria
Of course you'd have to adjust the @nightly@ vs @latest@ and use the correct distribution (the above example is for nightly feeds on Raspbian 10).
20 1 laforge
21
When you now use @apt-cache policy@ to list the priorities you should get something like:
22
<pre>
23
root@raspi:~# apt-cache policy
24
Package files:
25
 100 /var/lib/dpkg/status
26
     release a=now
27
 500 http://archive.raspberrypi.org/debian buster/main armhf Packages
28
     release o=Raspberry Pi Foundation,a=oldstable,n=buster,l=Raspberry Pi Foundation,c=main,b=armhf
29
     origin archive.raspberrypi.org
30
1001 https://downloads.osmocom.org/packages/osmocom:/nightly/Raspbian_10 ./ Packages
31
     release o=obs://osmocom/osmocom:nightly/Raspbian_10,n=Raspbian_10,l=osmocom:nightly,c=
32
     origin downloads.osmocom.org
33
 500 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
34
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=rpi,b=armhf
35
     origin raspbian.raspberrypi.org
36
 500 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
37
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=non-free,b=armhf
38
     origin raspbian.raspberrypi.org
39
 500 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
40
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=contrib,b=armhf
41
     origin raspbian.raspberrypi.org
42
 500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
43
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=main,b=armhf
44
     origin raspbian.raspberrypi.org
45
</pre>
46
47
Note the line with the osmocom repo has the highest priority (1001).  You're now all good: Packages from the osmocom repo will always be preferred over upstream raspbian packages.
Add picture from clipboard (Maximum size: 48.8 MB)