[Debian][apt][注意あり] apt-get でエラーが出るようになってたので対応した。

2019-07-19 10:44:29AIX、UNIX、Linuxapt, debian, OpenMediaVault

How-to-configure-apt-in-Debian-Buster-after-release

Debian(Stretch)ベースでOpenMediaVaultを動作させていたサーバから、以下のようなエラーメッセージが出力されているのに気が付きました。

なんじゃらほいということで対応してみることにしました。

確認環境

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
# cat /etc/armbian-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=odroidxu4
BOARD_NAME="Odroid XU4"
BOARDFAMILY=odroidxu4
VERSION=5.60
LINUXFAMILY=odroidxu4
BRANCH=next
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

まず現状

Jul 18 00:18:04 odroidxu4 cron-apt: CRON-APT RUN [/etc/cron-apt/config]: Thu Jul 18 00:09:28 JST 2019
Jul 18 00:18:04 odroidxu4 cron-apt: CRON-APT SLEEP: 483, Thu Jul 18 00:17:31 JST 2019
Jul 18 00:18:04 odroidxu4 cron-apt: CRON-APT ACTION: 0-update
Jul 18 00:18:04 odroidxu4 cron-apt: CRON-APT LINE: /usr/bin/apt-get -o Acquire::http::Dl-Limit=25 update -o quiet=2
Jul 18 00:18:04 odroidxu4 cron-apt: E: Repository 'http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
Jul 18 00:18:04 odroidxu4 cron-apt: E: Repository 'http://security.debian.org stretch/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (main/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (main/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (contrib/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (contrib/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (contrib/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (contrib/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (non-free/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (non-free/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (non-free/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (non-free/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: E: Repository 'http://cdn-fastly.deb.debian.org/debian stretch Release' changed its 'Suite' value from 'stable' to 'oldstable'
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (main/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (main/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (contrib/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (contrib/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (contrib/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (contrib/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (non-free/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Packages (non-free/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (non-free/Contents-armhf) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1
Jul 18 00:18:04 odroidxu4 cron-apt: W: Target Contents-deb (non-free/Contents-all) is configured multiple times in /etc/apt/sources.list:7 and /etc/apt/sources.list.d/openmediavault-kernel-backports.list:1

問題部分

たぶん大事なメッセージは以下の部分ですよね。

N: Repository 'http://security.debian.org stretch/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'N: Repository 'http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'                                                                                              
N: Repository 'http://cdn-fastly.deb.debian.org/debian stretch Release' changed its 'Suite' value from 'stable' to 'oldstable'  

stableブランチがstretch(v9)からbuster(v10)へ移行し、現在、stretchがold-stable扱いに変わった、ということを出力しているようです。

Webで情報収集

対応その1

この場合はどうするのかな、と先に見つかった情報は以下のもの。

tl;dr : run once apt-get update --allow-releaseinfo-change
What happens here, is that the local apt database remembered your package-sources “release-information" to be “busterAsTesting", and when updating now “busterAsStable" is returned.
This results in the error, and the indication, that you need to “allow the change of the release version information".
Luckily, apt-get has an option for that, aptly named allow-releaseinfo-change
When running apt-get with this option, it notices -as without- the version discrepancy (the N:-lines), but now accepts it as told to do, and then updates the local database.

https://superuser.com/a/1457007
       --allow-releaseinfo-change
           Allow the update command to continue downloading data from a repository which changed its
           information of the release contained in the repository indicating e.g a new major release.
           APT will fail at the update command for such repositories until the change is confirmed to
           ensure the user is prepared for the change. See also apt-secure(8) for details on the concept
           and configuration.
           Specialist options (--allow-releaseinfo-change-field) exist to allow changes only for certain
           fields like origin, label, codename, suite, version and defaultpin. See also
           apt_preferences(5). Configuration Item: Acquire::AllowReleaseInfoChange.

新しいコードネームのものへ変更するもの、というもののようですが、実際に実行してみると以下のようになりました。

Hit:9 https://apt.armbian.com stretch InRelease                                                                           
Fetched 20.7 kB in 4s (4,783 B/s)                                                                                         
Traceback (most recent call last):                                                                                        
  File "/usr/sbin/omv-mkaptidx", line 91, in <module>                                                                     
    cache = apt.cache.Cache()                                                                                             
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 138, in __init__                                               
    self.open(progress)                                                                                                   
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 198, in open                                                   
    self._cache = apt_pkg.Cache(progress)                                                                                 
apt_pkg.Error: E:The value 'stable' is invalid for APT::Default-Release as such a release is not available in the sources 
Reading package lists... Done       

なーんかうまくいきません。自分の環境だけかもしれませんが。

さすがにアレなのでもう少し調べてみると、ドンピシャな情報が見つかりました。

対応その2

なるほど、Default-Releaseとして、stableのままになっているので、コードの差異が発生していた、ということになります。

       Default-Release
           Default release to install packages from if more than one version is available. Contains
           release name, codename or release version. Examples: 'stable', 'testing', 'unstable',
           'stretch', 'buster', '4.0', '5.0*'. See also apt_preferences(5).

現在の環境はDebian stretchなので、/etc/apt/apt.conf.d/99targetの記載内容を以下のように修正することで問題が解消しそうです。

-APT::Default-Release "stable";
+APT::Default-Release "stretch";

再度実行。

# apt-get update
Get:1 file:/var/cache/openmediavault/archives  InRelease
Ign:1 file:/var/cache/openmediavault/archives  InRelease
Get:2 file:/var/cache/openmediavault/archives  Release [816 B]
Hit:3 http://security.debian.org stretch/updates InRelease
Get:2 file:/var/cache/openmediavault/archives  Release [816 B]                                                            
Get:4 file:/var/cache/openmediavault/archives  Release.gpg                                                                
Ign:4 file:/var/cache/openmediavault/archives  Release.gpg                                                                
Get:5 https://openmediavault.github.io/packages arrakis InRelease [12.8 kB]                                               
Ign:6 http://cdn-fastly.deb.debian.org/debian stretch InRelease                                                           
Ign:7 https://dl.bintray.com/openmediavault-plugin-developers/arrakis stretch InRelease   
Ign:9 https://dl.bintray.com/openmediavault-plugin-developers/arrakis-sync stretch InRelease
Hit:10 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease
Hit:11 http://packages.openmediavault.org/public arrakis InRelease  
Get:12 https://dl.bintray.com/openmediavault-plugin-developers/arrakis stretch Release [4,389 B]    
Get:13 https://dl.bintray.com/openmediavault-plugin-developers/arrakis-sync stretch Release [3,540 B]                     
Hit:15 http://packages.openmediavault.org/public arrakis-proposed InRelease                                               
Hit:14 http://cdn-fastly.deb.debian.org/debian stretch-backports InRelease                                         
Hit:16 http://cdn-fastly.deb.debian.org/debian stretch Release                              
Hit:8 https://apt.armbian.com stretch InRelease                       
Fetched 20.7 kB in 4s (4,792 B/s)
Reading package lists... Done

問題なさそうです。

OSのバージョンアップによる移行期は色々と注意が必要になることを、改めて学習することが出来ました。

2019年7月29日:追記

色々と勘違いしていましたので、その2を書きました。

この記事を書いた人

kometchtech

うつ病を患いながら、IT業界の末席にいるおっさんエンジニア。科学計算をしたことがないのに、HPC分野にお邪魔している。

興味のある分野で学習したことをblogにまとめつつ、うつ病の経過症状のメモも置いておく日々。

じつはRouterboard User Group JPの中の人でもある。

Amazon欲しいものリスト / Arm板を恵んでくれる人募集中

2019-07-19 10:44:29AIX、UNIX、Linuxapt, debian, OpenMediaVault