0

I've added KeePassXC's official PPA and apt knows about the latest version, but it's not installing it:

$ apt list -a keepassxc
Listing... Done
keepassxc/bionic,now 2.6.1-1ppa1~bionic1 amd64
keepassxc/bionic 2.5.3-1ppa1~bionic1 amd64 [installed]
keepassxc/bionic 2.3.1+dfsg.1-1 amd64

Selecting version 2.6.1 manually works, but apt will later downgrade it to 2.5.3.

Why is this and how can I make it use the latest version?

gronostaj
  • 58,482

1 Answers1

3

The issue can be diagnosed by executing apt-cache policy keepassxc:

keepassxc:
  Installed: 2.5.3-1ppa1~bionic1
  Candidate: 2.5.3-1ppa1~bionic1
  Version table:
     2.6.1-1ppa1~bionic1 500
        500 http://ppa.launchpad.net/phoerious/keepassxc/ubuntu bionic/main amd64 Packages
 *** 2.5.3-1ppa1~bionic1 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     2.3.1+dfsg.1-1 500
        500 http://pl.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

The 2.5.3 package has non-standard priority 1001 which is higher than the default 500 used for other packages.

Why is that the case?

2.3.1 package comes from Ubuntu repository.
2.5.3 is provided by Pop!_OS repository.
2.6.1 is the official KeePassXC PPA.

Pop!_OS is based on Ubuntu, but provides its own modified version of some packages. This is achieved by giving their repository higher priority in apt. Apt will first look at package priorities and if there's more than one with the higher priority, only then the version is taken into account. Otherwise the package with highest priority is installed, no matter the version.

Pop's keepassxc package inherits priority 1001 from its repository. It's higher than the default 500 for Ubuntu and KeePassXC PPA packages, so 2.5.3 is installed despite not being the latest version.

This issue is fixed by setting KeePassXC's PPA priority higher than 1001. Create the file /etc/apt/preferences.d/keepassxc-official-ppa as root with following contents:

Package: *
Pin: release o=LP-PPA-phoerious-keepassxc
Pin-Priority: 1100

Then sudo apt update and sudo apt upgrade keepassxc. Latest version should be installed and apt-cache policy keepassxc should reflect the changes:

keepassxc:
  Installed: 2.6.1-1ppa1~bionic1
  Candidate: 2.6.1-1ppa1~bionic1
  Version table:
 *** 2.6.1-1ppa1~bionic1 1100
       1100 http://ppa.launchpad.net/phoerious/keepassxc/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     2.5.3-1ppa1~bionic1 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu bionic/main amd64 Packages
     2.3.1+dfsg.1-1 500
        500 http://pl.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

(LP-PPA-phoerious-keepassxc string in the preferences file comes from apt-cache policy output.)

gronostaj
  • 58,482