apt-get update 時の"The following signatures couldn't be verified because the public key is not available" と "404  Not Found" エラー達をなんとかした

##環境
WSL Ubuntu 18.04です。

```console
nana@LAPTOP:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
```

##エラーの内容
久々にapt-get updateしたら二種類のエラーに遭遇した

```console
nana@LAPTOP:~$ sudo apt-get update
Get:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease [3626 B]
Hit:2 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic InRelease
Ign:3 http://ppa.launchpad.net/aseering/wsl/ubuntu bionic InRelease
Err:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:5 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Err:7 http://ppa.launchpad.net/aseering/wsl/ubuntu bionic Release
  404  Not Found [IP: 91.189.95.83 80]
Get:8 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease: The following signatures couldn't be verified bec
ause the public key is not available: NO_PUBKEY 51716619E084DAB9
E: The repository 'https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ 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.
E: The repository 'http://ppa.launchpad.net/aseering/wsl/ubuntu bionic Release' does not have a Release file.
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.
```
##対処法
###その１

まずは最初のエラー↓の対処

```console
Err:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
```
パブリックキーの期限切れ等によるエラーです。
apt-key advコマンドで更新します。

```console
nana@LAPTOP:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
Executing: /tmp/apt-key-gpghome.UfENnbgHmi/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
gpg: key 51716619E084DAB9: public key "Michael Rutter <marutter@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
```
再度apt-get updateすると

```console
nana@LAPTOP:~$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic InRelease
Get:2 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease [3626 B]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Ign:5 http://ppa.launchpad.net/aseering/wsl/ubuntu bionic InRelease
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Err:7 http://ppa.launchpad.net/aseering/wsl/ubuntu bionic Release
  404  Not Found [IP: 91.189.95.83 80]
Get:8 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:9 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages [76.8 kB]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/aseering/wsl/ubuntu bionic Release' does not have a Release file.
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.
```

パブリックキーのエラーは無くなりました。

###その２
次はこちらのエラー↓をなんとかします。

```console
Err:7 http://ppa.launchpad.net/aseering/wsl/ubuntu bionic Release
  404  Not Found [IP: 91.189.95.83 80]
```
[Silver Searcher](https://qiita.com/thermes/items/e1e0c94e2875df96921c) を使って/etc/apt/以下のppaの記載があるファイルを探します。

```console
nana@LAPTOP:~$ ag ppa /etc/apt/
/etc/apt/sources.list.d/aseering-ubuntu-wsl-bionic.list
1:deb http://ppa.launchpad.net/aseering/wsl/ubuntu bionic main
2:# deb-src http://ppa.launchpad.net/aseering/wsl/ubuntu bionic main

/etc/apt/sources.list.d/ansible-ubuntu-ansible-bionic.list
1:deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main
2:# deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main

/etc/apt/sources.list.d/aseering-ubuntu-wsl-bionic.list.save
1:deb http://ppa.launchpad.net/aseering/wsl/ubuntu bionic main
2:# deb-src http://ppa.launchpad.net/aseering/wsl/ubuntu bionic main
```

記載のある行を全てコメントアウトします。

```console
nana@LAPTOP:~$ sudo vi /etc/apt/sources.list.d/ansible-ubuntu-ansible-bionic.list
  1 # deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main
  2 # deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main
```

そして再度apt-get updateをしてみると

```console
nana@LAPTOP:~$ sudo apt-get update
Hit:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 252 kB in 7s (34.3 kB/s)
Reading package lists... Done
```

これでひとまず全てのエラーは無くなりました。



##参考
https://chrisjean.com/fix-apt-get-update-the-following-signatures-couldnt-be-verified-because-the-public-key-is-not-available/
https://hibiki-press.tech/learn_prog/dev-env/apt-update-gpg/1976
https://yuis-programming.com/?p=2048