apt modernize-sourcesするとzabbixリポジトリが正常に変換されない
こんばんは、tukapiyoです。
うちではDebianとRHELをメインのディストリビューションとして稼働させています。
Debianのサーバについては、2025/8/9にリリースされたDebian 13にアップグレードしました。
アップグレードの際はドキュメントを必ず読むようにしていますが、今回、aptのsources.listの書式がdeb822形式に移行中だという記載がありました。
今回はこれに関するお話です。
目次
Deb822形式への変換方法
ドキュメントには手動での書き換え方法は載っていたものの、変換方法についての記載がありませんでした。
Debian Wikiによるとどうやらapt modernize-sourcesを使えば変換できるようでしたが、Debian 12では実行できませんでしたのでDebian 13へアップグレードしてから対応しました。
Deb822形式へ変換してみる
Debian 13へアップグレード後、早速変換をしてみました。
以下のログを見てもらうと分かりますが、当方ではzabbixリポジトリ(zabbix、zabbix-tools)の追加がされています。
# apt modernize-sources The following files need modernizing: - /etc/apt/sources.list - /etc/apt/sources.list.d/zabbix-tools.list - /etc/apt/sources.list.d/zabbix.list Modernizing will replace .list files with the new .sources format, add Signed-By values where they can be determined automatically, and save the old files into .list.bak files. This command supports the 'signed-by' and 'trusted' options. If you have specified other options inside [] brackets, please transfer them manually to the output files; see sources.list(5) for a mapping. For a simulation, respond N in the following prompt. Rewrite 3 sources? [Y/n] y Modernizing /etc/apt/sources.list... - Writing /etc/apt/sources.list.d/debian.sources Modernizing /etc/apt/sources.list.d/zabbix-tools.list... - Writing /etc/apt/sources.list.d/zabbix-tools.sources Modernizing /etc/apt/sources.list.d/zabbix.list... - Writing /etc/apt/sources.list.d/zabbix.sources Warning: Could not determine Signed-By for URIs: https://repo.zabbix.com/zabbix/7.0/debian/, Suites: trixie
実行すると、zabbixリポジトリのGPG鍵が特定できなかったとWarningが表示されました。
それはさておき、apt updateをしてみます。
# apt update Hit:1 http://security.debian.org/debian-security trixie-security InRelease Hit:2 http://ftp.jaist.ac.jp/debian trixie InRelease Hit:3 http://ftp.jaist.ac.jp/debian trixie-updates InRelease Hit:4 https://repo.zabbix.com/zabbix-tools/debian-ubuntu trixie InRelease Hit:5 https://repo.zabbix.com/zabbix/7.0/debian trixie InRelease All packages are up to date. Notice: Skipping acquire of configured file 'main/binary-amd64/Packages' as repository 'https://repo.zabbix.com/zabbix-tools/debian-ubuntu trixie InRelease' doesn't support architecture 'amd64' Notice: Missing Signed-By in the sources.list(5) entry for 'https://repo.zabbix.com/zabbix/7.0/debian'
すると、
- zabbix-toolsリポジトリのamd64アーキテクチャをサポートしておらずスキップした旨のNotice
- zabbixリポジトリのGPG鍵が設定されていない旨のNotice
が表示されました。
後者はapt modernizeを実行した際に出力されたWarningによるものでしょう。
正常に変換できなかったリポジトリを修正する
さて、ここまでで2つの問題が分かりました。
- アーキテクチャの指定が不十分
- GPG鍵の未指定
これらについて解消していきます。
アーキテクチャの指定
原因の特定
まず、amd64アーキテクチャをサポートしていないと言われたzabbix-toolsリポジトリの中を覗いてみましょう。
https://repo.zabbix.com/zabbix-tools/debian-ubuntu/dists/trixie/main/を開いてみると、binary-allというディレクトリはあるものの、binary-amd64というディレクトリは存在しません。
(先ほどの出力を見れば、aptはbinary-amd64フォルダにアクセスしようとして失敗していることが分かります。)
そこで、amd64ではなくallというアーキテクチャを指定するのが良さそうです。
アーキテクチャの指定方法
アーキテクチャの指定方法は、sources.listのマニュアルを見ることにします。
どうやらArchitecturesオプションを設定することで、アーキテクチャの指定ができるようです。
リポジトリファイルの修正
/etc/apt/sources.list.d/zabbix-tools.sourcesファイルを編集します。
Types: deb deb-src URIs: https://repo.zabbix.com/zabbix-tools/debian-ubuntu/ Suites: trixie Components: main Architectures: all Signed-By: /etc/apt/trusted.gpg.d/zabbix-tools.gpg
上記のように、Architecturesオプションでallを指定しました。
この状態でapt updateをすればメッセージが表示されなくなります。
zabbixリポジトリは?
ところで、zabbixリポジトリのhttps://repo.zabbix.com/zabbix/7.0/debian/dists/trixie/main/を開いてみると、binary-allとbinary-amd64が存在することが分かります。
この場合、アーキテクチャにallとamd64を指定してあげなくて良いのでしょうか?
確認のため、binary-allに含まれるパッケージの一つであるzabbix-apache-confの情報を見てみます。
# apt info zabbix-apache-conf Package: zabbix-apache-conf Version: 1:7.0.20-1+debian13 Priority: optional Section: net Source: zabbix Maintainer: Zabbix Packager <info@zabbix.com> Installed-Size: 504 kB Depends: zabbix-frontend-php, apache2 | httpd, libapache2-mod-php | php Homepage: https://www.zabbix.com Download-Size: 492 kB APT-Sources: https://repo.zabbix.com/zabbix/7.0/debian trixie/main all Packages Description: Zabbix network monitoring solution - apache configuration for front-end Zabbix is the ultimate enterprise-level software designed for real-time monitoring of millions of metrics collected from tens of thousands of servers, virtual machines and network devices. . This package provides automatic configuration of zabbix frontend with apache web server. Notice: There are 3 additional records. Please use the '-a' switch to see them.
allのパッケージが無事表示されました。
どうやら、amd64があれば指定する必要はないようです。
実際、変換後のDebian公式のリポジトリも同様にアーキテクチャは指定されておらず、binary-allしか存在しない場合に問題が発生するようです。
GPG鍵の指定
これについては、Signed-Byオプションが設定されていない(変換時にGPG鍵を特定できなかった)のが原因です。
GPG鍵が保存されているディレクトリの中を覗いてみます。
# ls -l /etc/apt/trusted.gpg.d/zabbix-* -rw-r--r-- 1 root root 2275 May 29 2023 /etc/apt/trusted.gpg.d/zabbix-official-repo-apr2024.gpg -rw-r--r-- 1 root root 1183 May 29 2023 /etc/apt/trusted.gpg.d/zabbix-official-repo.gpg -rw-r--r-- 1 root root 2254 May 29 2023 /etc/apt/trusted.gpg.d/zabbix-tools.gpg
今回の場合、zabbix-official-repo-apr2024.gpgが対象のGPG鍵なので、これを設定します。
Types: deb deb-src URIs: https://repo.zabbix.com/zabbix/7.0/debian/ Suites: trixie Components: main Signed-By: /etc/apt/trusted.gpg.d/zabbix-official-repo-apr2024.gpg
これでapt updateを実行すればメッセージが表示されなくなります。
なお、どのキーか分からない場合は、とりあえず指定してみてapt updateをしてみましょう。
例えば/etc/apt/trusted.gpg.d/zabbix-official-repo.gpgを指定すると、以下の様にキーが見つからないというエラーが表示されます。
(..snip..) Err:5 https://repo.zabbix.com/zabbix/7.0/debian trixie InRelease Sub-process /usr/bin/sqv returned an error code (1), error message is: Missing key 4C3D6F2CC75F5146754FC374D913219AB5333005, which is needed to verify signature. (..snip..)



最近のコメント