Project

General

Profile

Actions

Apt Pinning

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.

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.

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.

Example of apt-pinning always preferring osmocom packages over upstream

Create a file /etc/apt/preferences.d/osmocom with the following content

Package: *
Pin: release o=obs://osmocom/osmocom:nightly/Raspbian_10
Pin-Priority: 1001

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).

When you now use apt-cache policy to list the priorities you should get something like:

root@raspi:~# apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://archive.raspberrypi.org/debian buster/main armhf Packages
     release o=Raspberry Pi Foundation,a=oldstable,n=buster,l=Raspberry Pi Foundation,c=main,b=armhf
     origin archive.raspberrypi.org
1001 https://downloads.osmocom.org/packages/osmocom:/nightly/Raspbian_10 ./ Packages
     release o=obs://osmocom/osmocom:nightly/Raspbian_10,n=Raspbian_10,l=osmocom:nightly,c=
     origin downloads.osmocom.org
 500 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=rpi,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=non-free,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=contrib,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=main,b=armhf
     origin raspbian.raspberrypi.org

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.

Updated by fixeria 20 days ago · 2 revisions

Add picture from clipboard (Maximum size: 48.8 MB)