NEED help - gpg keyserver error INVALID URI

Hello guys, need help to fix my problem with gpg to get the trustdb.gpg Ubuntu archive key.

sudo gpg --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 40976EAF437D05B5

Message:

gpg: keyserver receive failed: Invalid URI

And this:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

Executing: /tmp/user/0/apt-key-gpghome.PqaUauVzmB/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
gpg: keyserver receive failed: Permission denied

I tested it in a Ubuntu Mate Live DVD without errors.

On my system, don't work.

Strange :confused:

Host:

$ which gpg
/usr/local/bin/gpg

Live DVD:

$ which gpg 
/usr/bin/gpg

Please help to fix that.

Hello @mate2go ,

I tried your first "gpg" command and it worked well in a laptop running "Ubuntu MATE 20.04.4 LTS (Focal Fossa)". I've only added the "--verbose" switch to your command to get more information about what got done. I suggest that you also add that "--verbose" switch in your case (maybe it helps you in troubleshooting the issue):

$ sudo gpg --verbose --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 40976EAF437D05B5
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: no running Dirmngr - starting '/usr/bin/dirmngr'
gpg: waiting for the dirmngr to come up ... (5s)
gpg: connection to dirmngr established
gpg: data source: https://162.213.33.8:443
gpg: armor header: Version: Hockeypuck ~unreleased
gpg: armor header: Comment: Hostname:
gpg: key 40976EAF437D05B5: number of dropped non-self-signatures: 62
gpg: pub  dsa1024/40976EAF437D05B5 2004-09-12  Ubuntu Archive Automatic Signing Key <[email protected]>
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: using pgp trust model
gpg: key 40976EAF437D05B5: public key "Ubuntu Archive Automatic Signing Key <[email protected]>" imported
gpg: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: connection to agent established
gpg: Total number processed: 1
gpg:               imported: 1