Closed6
今後のAPTで推奨されなくなる可能性があるため、GPGキーの管理をアップデートしたい
Ubuntuのアップデート&アップグレードを行ったところ以下のようなものがでました。
実行コマンド
sudo apt update && sudo apt dist-upgrade
出力
Hit:1 https://dl.yarnpkg.com/debian stable InRelease
Hit:2 https://deb.nodesource.com/node_14.x jammy InRelease
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Hit:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 257 kB in 2s (170 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
libheif1 libde265-0
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
今回気になっている部分
W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
上記はyarnpkg
のリポジトリが古い形式のGPG
キーを使用していることに関する警告のようです。警告なので無視してもいいのですが時間があるのでこれを解決していこうと思います。
関連しそうな記事
古い GPG キーの削除
以下のコマンドを実行して古い GPG キーを削除してください。
実行コマンド
sudo apt-key del <古い GPG キーの ID>
出力
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
新しい GPG キーの取得と保存
新しい GPG キーの取得と保存を行います。
実行コマンド
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo tee /usr/share/keyrings/yarn-archive-keyring.gpg > /dev/null
このコマンドは、Yarn の公式リポジトリから新しい GPG キーをダウンロードし、/usr/share/keyrings/
に保存します。
yarnを削除し再インストール
上記を行っても同じエラーが発生したのでyarnを削除し再インストールすることにしました。
実行コマンド
sudo apt remove --purge yarn
出力
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
yarn*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 5431 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 40775 files and directories currently installed.)
Removing yarn (1.22.22-1) ...
GPGキーを取得して保存します。
実行コマンド
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarn.gpg > /dev/null
出力は特にありません。
新規でリポジトリを作成します。
実行コード
echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
出力
deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main
実行したので試しにアップデートしてみましょう。
実行コード
sudo apt update
出力
Hit:1 https://dl.yarnpkg.com/debian stable InRelease
Hit:2 https://deb.nodesource.com/node_14.x jammy InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W:
が出ませんでしたので成功ですね。続けて yarn をインストールしましょう。
実行コマンド
sudo apt install yarn
出力
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
yarn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 896 kB of archives.
After this operation, 5431 kB of additional disk space will be used.
Get:1 https://dl.yarnpkg.com/debian stable/main amd64 yarn all 1.22.22-1 [896 kB]
Fetched 896 kB in 0s (2451 kB/s)
Selecting previously unselected package yarn.
(Reading database ... 40756 files and directories currently installed.)
Preparing to unpack .../yarn_1.22.22-1_all.deb ...
Unpacking yarn (1.22.22-1) ...
Setting up yarn (1.22.22-1) ...
実行コード
yarn --version
出力
1.22.22
yarnがインストールできました。
念のためアップグレード
念のためアップグレードまでしてみましょう。
実行コード
sudo apt dist-upgrade
出力
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
libheif1 libde265-0
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
W:
が出ませんでしたね。これで一件落着です。
このスクラップは3ヶ月前にクローズされました