Ubuntuローカルストアで「ハッシュ合計の不一致」エラーが発生する

Ubuntuローカルストアで「ハッシュ合計の不一致」エラーが発生する

Ubuntu 20サーバーを更新するためにUbuntu 20サーバーを構成し、最近次のエラーが発生し始めたため、ローカルリポジトリサーバーを使用してすべてのLinuxバージョンを更新しています。rm -rf /var/lib/apt解決策として、別のスレッドで見つかったフォルダの内容を削除してみてください。

Commands-amd64.xzハッシュが一致しないことが確認され、ローカルリポジトリからファイルを手動で削除しようとした後、カールコマンドを実行して再ダウンロードし、問題が解決しました。ただし、毎日のスケジュールに応じて、Ubuntuのデフォルトリポジトリからリポジトリを再同期すると再発生します。

curl -o Commands-amd64.xz http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/cnf/by-hash/SHA256/68a13b187a08d10f59ed448a305317ca202fd001ac2c62b18f851853c29fc6d5

エラーフラグメント:

    Get:48 https://localIPaddress/ubuntu20/mirror/archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [580 B]
Fetched 23.9 MB in 3s (6,846 kB/s)
Reading package lists... Done
E: Failed to fetch https://<localserverIP>/ubuntu20/mirror/archive.ubuntu.com/ubuntu/dists/focal-updates/main/cnf/Commands-amd64.xz  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:14840 [weak]
    - SHA256:68a13b187a08d10f59ed448a305317ca202fd001ac2c62b18f851853c29fc6d5
    - SHA1:dd6e6a72880a22a264a7a40bca6cd9e8ec4dbbbf [weak]
    - MD5Sum:4917444606f7c42d4579abfaddddfbe4 [weak]
   Hashes of received file:
    - SHA256:75d0ec77f608b4ed82a8863208eb909deefe518143a2faa1a38b386541306304
    - SHA1:b9c4e3efbce29c5701b8889872091ab943b92240 [weak]
    - MD5Sum:080f9750feeef30269fed50447a5922a [weak]
    - Filesize:14840 [weak]
   Last modification reported: Mon, 21 Mar 2022 17:17:39 +0000
   Release file created at: Mon, 21 Mar 2022 15:10:25 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

ベストアンサー1

私はapt-mirror(https://github.com/apt-mirror/apt-mirror)ローカル18.04および20.04リポジトリの場合。 Commands-amd64.xzファイルのハッシュ合計の不一致やファイルサイズの不一致などの問題があります。ミラー同期後すぐにリリースファイルをダウンロードして問題を解決しました。私のpostmirror.shファイル:

#!/bin/bash
cd /var/www/html/ubuntu_repo/mirror
for p in {focal,bionic}{,-{backports,updates}}/{main,restricted,universe,multiverse};do >&2 echo "${p}"
  wget -q -r "http://azure.archive.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-amd64.xz"
  wget -q -r "http://azure.archive.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-i386.xz"
done
for p in {focal-security,bionic-security}/{main,restricted,universe,multiverse};do >&2 echo "${p}"
  wget -q -r "http://security.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-amd64.xz"
  wget -q -r "http://security.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-i386.xz"
done
for p in {focal,bionic}{,-{backports,updates}}/{Release,InRelease,Release.gpg};do >&2 echo "${p}"
  wget -q -r "http://azure.archive.ubuntu.com/ubuntu/dists/${p}"
done
for p in {focal-security,bionic-security}/{Release,InRelease,Release.gpg};do >&2 echo "${p}"
  wget -q -r "http://security.ubuntu.com/ubuntu/dists/${p}"
done

私がミラーリングしたリポジトリはAzure Ubuntu用です。使用するリポジトリに置き換えます。

おすすめ記事