A practical guide to resolve NO_PUBKEY and EXPKEYSIG errors from Microsoft and Spotify repositories, and fix .NET package conflicts on Ubuntu 22.04 / Pop!_OS.
After running sudo apt update, you may see errors like:
W: GPG error: https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease:
The following signatures couldn't be verified because the public key is not available:
NO_PUBKEY EB3E94ADBE1229CF
W: GPG error: https://repository.spotify.com stable InRelease:
The following signatures were invalid: EXPKEYSIG C85668DF69375001
The following signatures couldn't be verified because the public key is not available:
NO_PUBKEY 5384CE82BA52C83A
E: The repository '...' is not signed.
These happen because GPG keys expire or are rotated by repository maintainers, and because sources.list entries use a signed-by= path that points to a keyring file that is missing or outdated.
Spotify rotated its signing keys. Import the latest one:
curl -sS https://download.spotify.com/debian/pubkey_5384CE82BA52C83A.gpg \
| sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify-2025.gpg
sudo chmod 644 /etc/apt/trusted.gpg.d/spotify-2025.gpgIf the URL returns a 404, fall back to a keyserver:
sudo gpg --no-default-keyring \
--keyring /tmp/spotify-new.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 5384CE82BA52C83A \
&& sudo cp /tmp/spotify-new.gpg /etc/apt/trusted.gpg.d/spotify-2025.gpg \
&& sudo chmod 644 /etc/apt/trusted.gpg.d/spotify-2025.gpgcat /etc/apt/sources.list.d/*.list | grep microsoft
cat /etc/apt/sources.list.d/*.sources 2>/dev/null | grep -A5 microsoftYou may find different paths, for example:
/usr/share/keyrings/microsoft-prod.gpg(used bymicrosoft-prod.list)/usr/share/keyrings/microsoft.gpg(used byvscode.sources)
sudo gpg --no-default-keyring \
--keyring /tmp/ms-new.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys EB3E94ADBE1229CFsudo gpg --no-default-keyring \
--keyring /tmp/ms-new.gpg \
--export EB3E94ADBE1229CF \
| sudo tee /usr/share/keyrings/microsoft-prod.gpg > /dev/null
# If vscode.sources points to a different file, copy it there too
sudo cp /usr/share/keyrings/microsoft-prod.gpg /usr/share/keyrings/microsoft.gpg
sudo chmod 644 /usr/share/keyrings/microsoft-prod.gpg /usr/share/keyrings/microsoft.gpgKey insight: placing the key in
/etc/apt/trusted.gpg.d/will NOT work when thesources.listentry usessigned-by=. The key must be placed at the exact path specified insigned-by.
The gpg --no-default-keyring --keyring command creates a keybox format file (.kbx), which apt cannot read. If you accidentally copied such a file to trusted.gpg.d, remove it:
sudo rm -f /etc/apt/trusted.gpg.d/microsoft-eb3e.gpgIf you have both the Microsoft ubuntu/22.04/prod repository and the ppa:dotnet/backports PPA enabled at the same time, apt upgrade may fail with:
dotnet-host-8.0 : Conflicts: dotnet-host
netstandard-targeting-pack-2.1-8.0 : Conflicts: netstandard-targeting-pack-2.1
This happens because the Microsoft repository ships generic unversioned packages (dotnet-host, netstandard-targeting-pack-2.1) that conflict with the versioned packages installed from Ubuntu / the PPA.
| Version | packages.microsoft.com/ubuntu/22.04/prod |
ppa:dotnet/backports |
Ubuntu repos |
|---|---|---|---|
| .NET 6 | ✅ | ❌ | ✅ |
| .NET 8 | ✅ | ❌ | ✅ |
| .NET 9 | ✅ | ✅ | ❌ |
| .NET 10 | ❌ | ✅ | ❌ |
Since Ubuntu already ships .NET 6 and 8, and the PPA covers .NET 9 and 10, the Microsoft ubuntu/22.04/prod repository is redundant and conflicting. Disable it without deleting it:
# The .list format does not support "Enabled: no", so rename the extension
sudo mv /etc/apt/sources.list.d/microsoft-prod.list \
/etc/apt/sources.list.d/microsoft-prod.list.disabledTo re-enable it later:
sudo mv /etc/apt/sources.list.d/microsoft-prod.list.disabled \
/etc/apt/sources.list.d/microsoft-prod.listNote: If your sources file uses the newer DEB822 format (
.sourcesextension), you can instead addEnabled: noas a field inside the file — no renaming needed.
sudo apt update 2>&1 | grep -E "Err|GPG|NO_PUBKEY"
sudo apt upgradeA clean run should show only Hit: and Get: lines with no GPG warnings or errors.
# .NET 9
sudo apt install dotnet-sdk-9.0
# .NET 10
sudo apt install dotnet-sdk-10.0signed-by=in sources overridestrusted.gpg.d/— always place the key at the exact path specified.gpg --keyringcreates a keybox (.kbx) — not readable by apt. Always export with--export | teeto produce a proper binary keyring..listformat has noEnabled: no— rename the file extension to disable without deleting..sources(DEB822) format supportsEnabled: no— add it as a field inside the file.- Conflicting .NET sources — stick to one source per version to avoid unresolvable dependency conflicts.