Debian 12 apt update GPG error: NO_PUBKEY

debian 11 版本更新 到 12,update出现两个错误。

,Hit:5 https://packages.microsoft.com/debian/12/prod bookworm InRelease

Err:5 https://packages.microsoft.com/debian/12/prod bookworm InRelease
The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.microsoft.com/debian/12/prod bookworm InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF

解决办法:

1 下载 https://packages.microsoft.com/config/debian/12/prod.list 替换 /etc/apt/sources.list.d/microsoft-prod.list

2 直接修改 /etc/apt/sources.list.d/microsoft-prod.list 为以下内容:

deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/12/prod bookworm main

Hit:6 https://packages.sury.org/php bookworm InRelease

W: https://packages.sury.org/php/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: Failed to fetch https://packages.microsoft.com/debian/12/prod/dists/bookworm/InRelease The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
W: Some index files failed to download. They have been ignored, or old ones used instead.

解决办法,执行以下命令:

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg