【Ubuntu】apt-getでエラーが出力されてしまう

その他

エラー概要

Ubuntuでapt-getを行うと、以下のようなエラーが出力されて、アップデータできない。

student@myHost:/etc$ sudo apt-get update
Ign:1 http://jp.archive.ubuntu.com/ubuntu disco InRelease
Ign:2 http://jp.archive.ubuntu.com/ubuntu disco-updates InRelease
Ign:3 http://jp.archive.ubuntu.com/ubuntu disco-backports InRelease
Ign:4 http://jp.archive.ubuntu.com/ubuntu disco-security InRelease
Err:5 http://jp.archive.ubuntu.com/ubuntu disco Release
  404  Not Found [IP: 160.26.2.187 80]
Err:6 http://jp.archive.ubuntu.com/ubuntu disco-updates Release
  404  Not Found [IP: 160.26.2.187 80]

バージョンの確認

まず、以下で Ubuntu のバージョンが確認できます。

student@myHost:/etc$ less os-release
  • Ubuntuのバージョンが19.04であることが分ります。
  • バージョンのコードネーム(VERSION_CODENAME)がdiscoであることが分ります。
NAME="Ubuntu"
 VERSION="19.04 (Disco Dingo)"
 ID=ubuntu
 ID_LIKE=debian
 PRETTY_NAME="Ubuntu 19.04"
 VERSION_ID="19.04"
 HOME_URL="https://www.ubuntu.com/"
 SUPPORT_URL="https://help.ubuntu.com/"
 BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
 PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
 VERSION_CODENAME=disco
 UBUNTU_CODENAME=disco
 os-release (END)

apt/source.listの修正

エラーを1つずつ見てみます。以下のエラーはhttp://jp.archive.ubuntu.com/ubuntuにdisco Releaseが無いと言われています。

Err:5 http://jp.archive.ubuntu.com/ubuntu disco Release

まず、urlを開きdistを開きます。

コードネームのdiscoを探します。

Ubuntu 18.04 LTS (Bionic)、Ubuntu 19.10(eoan)などはパッケージがあるようですが、 Ubuntu 19.04 (disco) は見当たりません。ネットで探すと

http://old-releases.ubuntu.com/ubuntu

にありました。aptコマンドの参照先である /etc/apt/sources.listを編集します。

student@myHost:/etc/apt$ sudo emacs -nw /etc/apt/sources.list

接続先を全てhttp://old-releases.ubuntu.com/ubuntuに書き換え,保存します。

 deb http://old-releases.ubuntu.com/ubuntu disco main restricted

 deb http://old-releases.ubuntu.com/ubuntu disco-updates main restricted
 
 deb http://old-releases.ubuntu.com/ubuntu disco universe
 
 ~ 省 略 ~

再度、apt-get updateコマンドを打ち込み、以下のように正常終了することを確認します。

student@myHost:/etc/apt$ sudo apt-get update
[sudo] password for student:
Hit:1 http://old-releases.ubuntu.com/ubuntu disco InRelease
Hit:2 http://old-releases.ubuntu.com/ubuntu disco-updates InRelease
Hit:3 http://old-releases.ubuntu.com/ubuntu disco-backports InRelease
Hit:4 http://old-releases.ubuntu.com/ubuntu disco-security InRelease
Reading package lists... Done
スポンサーリンク
その他
Engineerをフォローする
レンサバ