Let’s say you’ve upgraded to Debian Trixie
Some apt repos suddenly are refusing to update their package lists during apt update because of missing package signing keys;
Sub-process /usr/bin/sqv returned an error code (1), error message is: Missing key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF, which is needed to verify signature.<br>All packages are up to date.<br>Warning: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. OpenPGP signature verification failed: https://download.mono-project.com/repo/debian stable-buster InRelease: Sub-process /usr/bin/sqv returned an error code (1), error message is: Missing key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF, which is needed to verify signature.
apt-key was deprecated, and isn’t on your system anymore, and nearly all of the guides you can find on this topic for some reason involve using apt-key to fetch the key from a keyserver before exporting it to the “modern” /etc/apt/trusted.gpg.d/, but apt-key is already deprecated so.. you don’t have apt-key.
You can just use gpg directly instead of apt-key; so here, downloading the mono repo (yeah ok, I know, don’t ask) gpg key (with the fingerprint 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF) from keyserver.ubuntu.com into an intermediate temporary keyring and then export it directly into the appropriate format / location in the correct format etc:
gpg --no-default-keyring --keyserver keyserver.ubuntu.com --keyring temp-keyring.gpg --recv-key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF gpg --no-default-keyring --keyring temp-keyring.gpg --output /etc/apt/trusted.gpg.d/mono-repo.gpg --export
You can also be explicit about which arch and key must be used by a given repo by adding the arch argument and the appropriate gpg keyfile signed-by argument.
So, for example, the repo definition for the mono project
deb https://download.mono-project.com/repo/debian stable-buster main
Instead would become
deb [ arch=amd64 signed-by=/etc/apt/trusted.gpg.d/mono-repo.gpg ] https://download.mono-project.com/repo/debian stable-buster main