The instructions at https://tutorials.ubuntu.com/tutorial/tutorial-how-to-verify-ubuntu#3 suggest that you can download an ISO for installing an OS, along with the checksums and a signature. You then attempt to verify the signature with
gpg --keyid-format long --verify SHA256SUMS.gpg SHA256SUMS
which, if you don't already have the required keys, will give an error like:
gpg: Signature made Thu Apr 5 22:19:36 2018 EDT using DSA key ID 46181433FBB75451 gpg: Can't check signature: No public key gpg: Signature made Thu Apr 5 22:19:36 2018 EDT using RSA key ID D94AA3F0EFE21092 gpg: Can't check signature: No public key
It then suggests that "This is actually a really useful message..." since it tells us which keys to download. It then proceeds to tell the user how to download the keys from a keyserver.
What I don't understand is this: if I have somehow downloaded a compromised file, why would I ever trust the key IDs given when I attempt to verify the file? If the file is compromised, it could be signed with a different key. My understanding of keyservers is that anyone can upload keys, and they keep in sync with each other, and so doing
gpg --keyid-format long --keyserver hkp://keyserver.ubuntu.com --recv-keys ... would simply download the wrong key, tell me the file is verified and lure me in to a false sense of security. What have I missed?