Thank you for your quick response. It does not seem to resolve the problem. I am getting the same error with your solution. Although your solution seems correct, the root cause is one of the package which is not accessible it seems.
Oh my … ok … some new news. If we attempted to run the “old recipe” and it fails and then we try and run the “new” recipe, apparently that too will fail … because there is “left over” stuff from the original old recipe failure. In a post inside Google support, I found a recipe … I have no proof that it is right or will help … but here it is:
---- snip ----
The second real problem which I ran into, was once you figure out usually on your own you’ve installed the wrong thing. You find the correct ops agent script and you try to install the ops agent and it fails. The reason it fails is because its getting 404 from the legacy monitoring agent source list. If you don’t do the below, the correct script will continue to fail due to the 404 of the previous install script sources.
bigboy2002@instance-2:~$ sudo bash add-google-cloud-ops-agent-repo.sh --also-install
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://deb.debian.org/debian bullseye-backports InRelease
Hit:4 http://security.debian.org/debian-security bullseye-security InRelease
Hit:5 http://packages.cloud.google.com/apt google-compute-engine-bullseye-stable InRelease
Hit:6 http://packages.cloud.google.com/apt cloud-sdk-bullseye InRelease
Hit:7 https://packages.cloud.google.com/apt google-cloud-ops-agent-bullseye-all InRelease
Hit:9 https://dl.yarnpkg.com/debian stable InRelease
Get:8 https://ftp.nluug.nl/db/mariadb/mariadb-10.9.5/repo/debian bullseye InRelease [4,634 B]
Hit:10 https://d17k9fuiwb52nc.cloudfront.net bullseye InRelease
Err:8 https://ftp.nluug.nl/db/mariadb/mariadb-10.9.5/repo/debian bullseye InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1656F24C74CD1D8
Reading package lists... Done
W: GPG error: https://ftp.nluug.nl/db/mariadb/mariadb-10.9.5/repo/debian bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1656F24C74CD1D8
E: The repository 'http://mirror.mariadb.org/repo/10.9/debian bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
[2023-03-23T00:43:35+0000] Could not refresh the google-cloud-ops-agent apt repositories.
Please check your network connectivity and make sure you are running a supported
debian distribution. See https://cloud.google.com/stackdriver/docs/solutions/ops-agent/#supported_operating_systems
for a list of supported platforms.
If you encounter difficulties when upgrading Ops-agent, it is recommended to first uninstall the older version and then proceed with the reinstallation process.