

`sudo apt update`を行った際、以下のエラーで正常にupdateを実行できません。

[code]

    $ sudo apt update
    
    ...
    
    Err:2 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CDFB5FA52007B954
    
    ...
    
    Reading package lists... Done                            
    W: GPG error: http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CDFB5FA52007B954
    E: The repository 'http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid 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.
    
[/code]

`apt-purge`にて`http://downloads.metasploit.com/data/releases/metasploit-
framework/apt`の除外も試みてみましたが、こちらの操作も同様にgpgエラーで阻まれてしまいました。

[code]

    sudo ppa-purge ppa:http://downloads.metasploit.com/data/releases/metasploit-framework/apt
    Updating packages lists
    W: GPG error: http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CDFB5FA52007B954
    E: The repository 'http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease' is not signed.
    Warning:  apt-get update failed for some reason
    
[/code]

解決方法があればご教授をお願いします。

## 追記

> 試す環境が無いのでキーワードで検索しただけですが、以下のページが参考になるかもしれません。

`$ sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys
`こちらを実行してみましたが、以下の結果となりエラーが発生しました。

[code]

    $ sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 
    
    Executing: /tmp/apt-key-gpghome.50autdvTgt/gpg.1.sh --keyserver hkp://keys.gnupg.net --recv-keys CDFB5FA52007B954
    gpg: key CDFB5FA52007B954: public key "Metasploit <metasploit@rapid7.com>" imported
    gpg: Total number processed: 1
    gpg:               imported: 1
    gpg: invalid key resource URL '/tmp/apt-key-gpghome.50autdvTgt/home:manuelschneid3r.asc.gpg'
    gpg: keyblock resource '(null)': General error
    gpg: key 7721F63BD38B4796: 2 signatures not checked due to missing keys
    gpg: key 1488EB46E192A257: 1 signature not checked due to a missing key
    gpg: key 3B4FE6ACC0B21F32: 3 signatures not checked due to missing keys
    gpg: key D94AA3F0EFE21092: 3 signatures not checked due to missing keys
    gpg: key 871920D1991BC93C: 1 signature not checked due to a missing key
    gpg: Total number processed: 7
    gpg:       skipped new keys: 7
    
[/code]

`sudo apt update`の実行結果についても同様のエラー内容で失敗しています。

## 実行環境

[code]

    $ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
    
[/code]


CC BY-SA 4.0
2020-12-29T04:44:08.307
72957
2022-09-12T02:05:10.400
2020-12-30T12:09:38.237
3060
9616
question
ubuntu apt gpg
apt update時にgpgエラーが発生して失敗する


試す環境が無いのでキーワードで検索しただけですが、以下のページが参考になるかもしれません。

[GPG error when updating, key expired
#7336](https://github.com/rapid7/metasploit-framework/issues/7336)

>
[code]

>     $ sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys
> CDFB5FA52007B954
>  
[/code]


CC BY-SA 4.0
2020-12-29T06:13:30.500
72958
2020-12-29T06:13:30.500
3060
72957
answer


**Livepatch** > **その他のソフトウェア**  
から

`http://downloads.metasploit.com/data/releases/metasploit-framework/apt`

の項目を削除することでエラーを解消することができました。


CC BY-SA 4.0
2020-12-29T06:37:36.947
72960
2020-12-29T06:37:36.947
9616
72957
answer