September, 11, 2024 archives
Configuring third-party Apt repositories with Ubuntu
I just upgraded my primary development machine to the latest Ubuntu LTS (24.04.1) and it disabled the third-party sources I had set up for things like WezTerm, Tailscale, Syncthing, and the GitHub CLI. (It warned it would be doing this.)
When I re-enabled them, I finally made sure they were set up in the modern-ish way and no longer complained about keys that were installed using deprecated methods.
Now, the keychain for each repository is in the /usr/share/keyrings
directory in a file named something like tailscale-archive-keyring.gpg
. Some of the keys were mashed together in /etc/apt/trusted.gpg
before, but apt-key list
showed those were keys that I had individually under /usr/share/keyrings
so I just went ahead and deleted /etc/apt/trusted.gpg
entirely.
For each repository, there is either a repository
.list
or repository
.sources
file in /etc/apt/sources.list.d
. The .list
files are in “one line format”, and the .sources
files in a friendlier key-value format called “deb822”. The formats are explained the sources.list
(5) man page.
For example, here’s the /etc/apt/sources.list.d/tailscale.sources
:
Enabled: yes
Types: deb
URIs: https://pkgs.tailscale.com/stable/ubuntu
Suites: noble
Components: main
Signed-By: /usr/share/keyrings/tailscale-archive-keyring.gpg
And /etc/apt/sources.list.d/wezterm.list
:
deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *
The files in my /etc/apt/sources.list.d
were a bit of a jumble, where some had been renamed with an extra .distUpgrade
extension and the deb822-formated files had Enabled: no
. I moved everything back into the proper filenames and changed those yeses to nos, and now when I run apt update
it pulls all from all of the appropriate sources and doesn’t complain about any deprecated keys.
Instead of referencing a key file in the Signed-By
line of a source, you can also directly embed the ASCII representation of the key. With that, the tailscale.sources
looks like:
Enabled: yes
Types: deb
URIs: https://pkgs.tailscale.com/stable/ubuntu
Suites: noble
Components: main
Signed-By:
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF5UmbgBEADAA5mxC8EoWEf53RVdlhQJbNnQW7fctUA5yNcGUbGGGTk6XFqO
nlek0Us0FAl5KVBgcS0Bj+VSwKVI/wx91tnAWI36CHeMyPTawdT4FTcS2jZMHbcN
UMqM1mcGs3wEQmKz795lfy2cQdV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AQABiQI2BBgBCAAg
FiEEJZapnqqzOCGJPAp5RYyoMpV/WGgFAl5UmbgCGwwACgkQRYyoMpV/WGji9w/8
Di9yLnnudvRnGLXGDDF2DbQUiwlNeJtHPHH4B9kKRKJDH1Rt5426Lw8vAumDpBlR
EeuT6/YQU+LSapWoDzNcmDLzoFP7RSQaB9aL/nJXv+VjlsVH/crpSTTgGDs8qGsL
O3Y2U1Gjo5uMBoOfXwS8o1VWO/5eUwS0KH7hpbOuZcf9U9l1VD2YpGfnMwX1rnre
INJqseQAUL3oyNl76gRzyuyQ4AIA06r40hZDgybH0ADN1JtfVk8z4ofo/GcfoXqm
hifWJa2SwwHeijhdN1T/kG0FZFHs1DBuBYJG3iJ3/bMeL15j1OjncIYIYccdoEUd
uHnp4+ZYj5kND0DFziTvOC4WyPpv3BlBVariPzEnEqnhjx5RYwMabtTXoYJwUkxX
2gAjKqh2tXissChdwDGRNASSDrChHLkQewx+SxT5kDaOhB84ZDnp+urn9A+clLkN
lZMsMQUObaRW68uybSbZSmIWFVM1GovRMgrPG3T6PAykQhFyE/kMFrv5KpPh7jDj
5JwzQkxLkFMcZDdS43VymKEggxqtM6scIRU55i059fLPAVXJG5in1WhMNsmt49lb
KqB6je3plIWOLSPuCJ/kR9xdFp7Qk88GCXEd0+4z/vFn4hoOr85NXFtxhS8k9GfJ
mM/ZfUq7YmHR+Rswe0zrrCwTDdePjGMo9cHpd39jCvc=
=AIVM
-----END PGP PUBLIC KEY BLOCK-----
I converted the binary format of the key (the .gpg
file) into that text representation with:
$ gpg --keyring tailscale-archive-keyring.gpg --no-default-keyring --export -a