0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Ubuntu で apt-get update が失敗する

Posted at

Ubuntu で apt update apt-get update が失敗する

apt update apt-get update コマンドで 404 Not Found が発生してエラーになる

$ sudo apt update

Err:11 http://jp.archive.ubuntu.com/ubuntu zesty/universe Sources
  404  Not Found

404 Not Found の解決方法(1)

古いUbuntuを使っているので /etc/apt/source.list を書き換える。

# バックアップ
$ sudo cp -p /etc/apt/sources.list /etc/apt/sources.list.back
# 置換
$ sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
# キャッシュ削除
$ sudo rm -rf /var/lib/apt/lists/*

404 Not Found の解決方法(2)

sources.list を作り直す場合

ValueErrorが出てエラー終了する

$ lsb_release -s -i
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in <module>
    main()
  File "/usr/bin/lsb_release", line 59, in main
    distinfo = lsb_release.get_distro_information()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 398, in get_distro_information
    distinfo = guess_debian_release()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 288, in guess_debian_release
    get_distro_info(distinfo['ID'])
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 48, in get_distro_info
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 48, in <lambda>
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
ValueError: could not convert string to float: '6.06 LTS'

ValueErrorの解決方法

Pythonスクリプト /usr/share/pyshared/lsb_release.py を修正する

-RELEASES_ORDER.sort(key=lambda n: float(n[0])) 
+RELEASES_ORDER.sort(key=lambda n: float(n[0].split()[0]))
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?