Acquire::By-Hash apt オプションが機能しません。

Acquire::By-Hash apt オプションが機能しません。

apt-getを使用しようとしていますAcquire::By-Hash optionしたがって、パッケージのバージョンではなく、暗号化ハッシュとして識別するパッケージをダウンロードします。これにより、apt-getのインストールを試みるときに発生する競合状態や「ハッシュ合計の不一致」エラーを防ぐことができます。

私はこの方法を使用するためにapt-getを取得できません。頑張った

  1. Acquire::By-Hash "force";に投資する/etc/apt/apt.conf.d/51acquire_by_hash
  2. ソースリストの変更: deb [by-hash=force] http://ftp.us.debian.org/debian/ buster main contrib non-free
  3. -o Acquire::by-hash=forceapt-getオプションのどれも効果がありません。 apt-getはまだ古い方法を使用しています(リクエストするURLを確認してください)。
# apt-get -o Acquire::by-hash=force -o Debug::Acquire::http=true install fortunes
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  fortunes
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,117 kB of archives.
After this operation, 2,611 kB of additional disk space will be used.
0% [Working]GET /debian/pool/main/f/fortune-mod/fortunes_1.99.1-7_all.deb HTTP/1.1
Host: ftp.us.debian.org
User-Agent: Debian APT-HTTP/1.3 (1.8.2.1)


0% [Waiting for headers]Answer for: http://ftp.us.debian.org/debian/pool/main/f/fortune-mod/fortunes_1.99.1-7_all.deb
HTTP/1.1 200 OK
Date: Sun, 09 Aug 2020 05:28:00 GMT
Server: Apache
Last-Modified: Thu, 15 Aug 2013 03:54:21 GMT
ETag: "110cf4-4e3f46de0807d"
Accept-Ranges: bytes
Content-Length: 1117428

Get:1 http://ftp.us.debian.org/debian buster/main amd64 fortunes all 1:1.99.1-7 [1,117 kB]
Fetched 1,117 kB in 18s (60.6 kB/s)                                                                                                              
Selecting previously unselected package fortunes.
(Reading database ... 159825 files and directories currently installed.)
Preparing to unpack .../fortunes_1%3a1.99.1-7_all.deb ...
Unpacking fortunes (1:1.99.1-7) ...
Setting up fortunes (1:1.99.1-7) ...

ミラーはBy-Hashをサポートします。

$ wget http://ftp.us.debian.org/debian/dists/buster/InRelease 2>/dev/null -O - | grep By-Hash
Acquire-By-Hash: yes

そのオプションを使用するための適切な方法についてのアイデアはありますか?ありがとうございます。

ベストアンサー1

このマニュアルはapt.conf(5)次のように教えてくださいAcquire::By-Hash

ダウンロードしてみてください索引予測ファイルのハッシュと合計で構成されたURIを渡します。

(私の強調)

私のテストでは、次のことが期待どおりに機能します(クリーンアップ後/var/lib/apt/listsapt clean正しく実行されないようです)。ローカルミラーがあるため、そのログで要求されたインデックスを確認することもできます。

apt{,-get} update -o Acquire::By-Hash="force" -o Debug::Acquire::http=true

だからマニュアルは正確で正確です。ハッシュを介してパッケージ自体をインポートすることはサポートされておらず、インデックス付けのみがサポートされています。

おすすめ記事