LoginSignup
27
27

More than 5 years have passed since last update.

apt-get update 時にHash Sum mismatch エラーが出力される場合の対処

Last updated at Posted at 2015-12-12

履歴

2016/03/16: @noromanba さんの編集リクエストより、sed で書き換える例を追加

エラーの事象

apt-get update 時に次のようなエラーが出力されることがあります。

HushSummismatchエラーの内容
Hit http://security.ubuntu.com vivid-security/multiverse Translation-en
Hit http://security.ubuntu.com vivid-security/restricted Translation-en        
Hit http://security.ubuntu.com vivid-security/universe Translation-en          
Fetched 525 kB in 6s (81.6 kB/s)                                               
W: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/vivid-updates/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/vivid-updates/main/binary-i386/Packages  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

解決法1: 参照しているリポジトリを変更してみる

apt-get が参照しているリポジトリを別のものに変更することで解決する場合があります。
例えば、あなたのUbuntu がJP を参照しているのならば、それをUS に変更してみる手順は次の通りです。

参照先リポジトリの変更
$ cd /etc/apt/
$ sudo cp sources.list /root

以下のコマンドを実行し、向き先をUS に変更します。

vimで開いて...
$ sudo vi sources.list
...vim内で一括置換・保存
" ex-command
:%s;http://jp.archive.ubuntu.com;http://us.archive.ubuntu.com;g
:wq " or ノーマルモードで ZZ

もしくは sed でバックアップと置換を一気に行います。

sed
# セパレータ ;  バックアップ sources.list.bak
$ sudo sed -i.bak -e 's;http://jp.archive.ubuntu.com;http://us.archive.ubuntu.com;g' /etc/apt/sources.list

リポジトリの向き先を変更したら、apt-get update コマンドを実行して、エラーが出ないことを確認します。

apt-getupdateコマンドの実行
$ sudo apt-get update

解決法2: /var/lib/apt/lists ディレクトリ配下のファイルを一旦削除する

apt-get update コマンドを実行した時にパッケージのリストが保存されるディレクトリ/var/lib/apt/lists 配下のファイルを一旦削除することで解消されるケースもあるようです。

/var/lib/apt/lists配下の削除
$ sudo rm -rf /var/lib/apt/lists/*

削除したら、apt-get update コマンドを実行します。

apt-getupdate
$ sudo apt-get update

参考

UbuntuのHash Sum mismatch問題
http://d.hatena.ne.jp/ytooyama/20150512/1431440734
Trouble downloading packages list due to a “Hash sum mismatch” error
http://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error
27
27
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
27
27