debian 10 から11にアップグレードしてみた

2022年6月7日

はじめに

2021年8月14日にBullseyeが来てたっぽいので更新します

aptのリストを書き換える

「buster」から「bullseye」に書き換えつつ「buster/updates」は「bullseye-security」に書き換えます。

ビフォー

/etc/apt/sources.list
# 
deb http://ftp.jp.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
# stretch-updates, previously known as 'volatile'
deb http://ftp.jp.debian.org/debian/ buster-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ buster-updates main contrib non-free

アフター

/etc/apt/sources.list
# 
deb http://ftp.jp.debian.org/debian/ bullseye main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
# stretch-updates, previously known as 'volatile'
deb http://ftp.jp.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ bullseye-updates main contrib non-free

私の環境では「/etc/apt/sources.list.d」にも変更があります。具体的には以下のリストです。

  • backports.list
  • docker-ce.list
  • ookla_speedtest-cli.list
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-backports main contrib non-free
deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable
# deb-src [arch=amd64] https://download.docker.com/linux/debian bullseye stable
# this file was generated by packagecloud.io for
# the repository at https://packagecloud.io/ookla/speedtest-cli
deb https://packagecloud.io/ookla/speedtest-cli/debian/ bullseye main
deb-src https://packagecloud.io/ookla/speedtest-cli/debian/ bullseye main

アップグレード

apt-update

aptの書き換えができたら「apt update」を実行します。

もし下記のようなメッセージが出た場合、aptのソースリストが何かしら間違っているので、この先の作業を続行しないでください。

E: リポジトリ http://security.debian.org/debian-security bullseye-updates Release には Release ファイルがありません。
N: このようなリポジトリから更新を安全に行うことができないので、デフォルトでは更新が無効になっています。
N: リポジトリの作成とユーザ設定の詳細は、apt-secure(8) man ページを参照してください。

正しく成功すると下記のようになります。

取得:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]                                                                               
ヒット:2 http://ftp.jp.debian.org/debian bullseye InRelease                                                                                                           
ヒット:3 http://ftp.jp.debian.org/debian bullseye-updates InRelease                                                                                                   
ヒット:4 https://download.docker.com/linux/debian bullseye InRelease                                                                                                  
ヒット:5 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                      
取得:6 http://security.debian.org/debian-security bullseye-security/main Sources [11.4 kB]                 
取得:7 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [25.4 kB]                                
取得:8 http://security.debian.org/debian-security bullseye-security/main i386 Packages [25.4 kB]              
取得:9 http://security.debian.org/debian-security bullseye-security/main Translation-en [12.5 kB]                                     
ヒット:10 http://deb.debian.org/debian bullseye-backports InRelease                                                                   
ヒット:11 https://packagecloud.io/ookla/speedtest-cli/debian bullseye InRelease                                                                                       
119 kB を 11秒 で取得しました (10.5 kB/s)                                                                                                                             
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています       
状態情報を読み取っています... 完了
アップグレードできるパッケージが 2078 個あります。表示するには 'apt list --upgradable' を実行してください。

apt upgrade

「apt upgrade」を実行します。処理中以下のような画面が出る場合があります。

この画面はqキーで閉じます。

更新をGUI(デスクトップ画面)でやっている場合はディスプレイマネージャが死んでしまうので、cuiや再起動で復活させる注意事項が出ます。

設定は特に理由がなければ保持にします。(中身を見て編集がされていなければ上書きしても問題ありません)

smartmontools (7.2-1) を設定しています ...
設定ファイル '/etc/default/smartmontools'
 ==> これはインストールしてから (あなたかスクリプトによって) 変更されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** smartmontools (Y/I/N/O/D/Z) [デフォルト=N] ?
設定ファイル '/etc/smartd.conf'
 ==> これはインストールしてから (あなたかスクリプトによって) 変更されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** smartd.conf (Y/I/N/O/D/Z) [デフォルト=N] ?
設定ファイル '/etc/hdparm.conf'
 ==> これはインストールしてから (あなたかスクリプトによって) 変更されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** hdparm.conf (Y/I/N/O/D/Z) [デフォルト=N] ? 

sshのportなどを変更している場合以下のように聞かれます。

ローカルバージョンの保持を選択しないとsshが初期化されるので注意してください。

apt dist-upgrade

「 apt dist-upgrade 」を実行して最後の更新を行います。このアップグレードはパッケージの更新だけでなく、削除も自動的に行われるので注意してください。

再起動

すべてが終了したら再起動を行ってください。

再起動後カーネルのバージョンが変わっていれば更新ができています。

Linux server1 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux
Linux server1 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

後片付け

いらないパッケージ等を掃除します

sudo apt autoremove
sudo apt autoclean