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 buster/main armhf Packages
     release o=Raspberry Pi Foundation,a=oldstable,n=buster,l=Raspberry Pi Foundation,c=main,b=armhf
1001 ./ Packages
     release o=obs://osmocom/osmocom:nightly/Raspbian_10,n=Raspbian_10,l=osmocom:nightly,c=
 500 buster/rpi armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=rpi,b=armhf
 500 buster/non-free armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=non-free,b=armhf
 500 buster/contrib armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=contrib,b=armhf
 500 buster/main armhf Packages
     release o=Raspbian,a=oldstable,n=buster,l=Raspbian,c=main,b=armhf

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)