0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

備忘録: Debian12(bookworm)サーバーをDebian13(trixie)にアップグレードした話

Posted at

前書き

Debian13(trixie)が2025年8月9日、リリースされました。
これは自宅サーバーのDebian12をDebian13にアップグレードした話です。

手順

Debian12または13のLiveインストーラーを用意しておく

先ず、後述するトラブルに備えて、Debian12/13いずれかのUSB Liveインストーラーを用意しておいてください。
KNOPPIXやUbuntu等、Linuxパーティションが操作可能なディストリビューションが入ったLive CD/DVD/USBメモリでも構いません。

現在の環境を最新の状態にアップデート

現在の環境を最新の状態にアップデートします。

root@debian:~# apt update
root@debian:~# apt upgrade

APTソースリストを新形式に書き換え

APTソースリスト(sources.list等)を、可読性の高い新形式かつDebian13(trixie)のデータを参照するように書き換えます。

/etc/apt/sources.list.d/debian.sources
Types: deb
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
URIs: https://deb.debian.org/debian-security
Suites: trixie-security
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

こんな感じ。

従来形式のAPTソースリストを退避

従来のAPTソースリストを、適当な場所へ退避します。

root@debian:~# mv /etc/apt/sources.list ~/

Debian13へアップグレード

公式ではちゃんとバックアップを取れと書いてますが華麗に無視して アップグレードを開始します。

root@debian:~# apt update
root@debian:~# apt upgrade
root@debian:~# apt full-upgrade

Bootローダーの構造を確認(GPTパーティションの場合)

再起動前に、Bootローダーの構造を確認します。

root@debian:~# tree /boot/efi/EFI/      
/boot/efi/EFI/
`-- debian
    |-- BOOTX64.CSV
    |-- fbx64.efi
    |-- grub.cfg
    |-- grubx64.efi
    |-- mmx64.efi
    `-- shimx64.efi

2 directories, 6 files

本来上記のようになっているはず(いなければならないはず)ですが、下記のようになっている場合があります(というか、実際なっていた)。

root@debian:~# tree /boot/efi/EFI/      
/boot/efi/EFI/
|-- debian
|   |-- BOOTX64.CSV
|   |-- fbx64.efi
|   |-- grub.cfg
|   |-- grubx64.efi
|   |-- mmx64.efi
|   `-- shimx64.efi
`-- BOOT
    |-- BOOTX64.CSV
    |-- fbx64.efi
    |-- grub.cfg
    |-- grubx64.efi
    |-- mmx64.efi
    `-- shimx64.efi
2 directories, 6 files

BOOTディレクトリの方が正のはず ですが、何故か拙宅では debianディレクトリのみを残しておかないとOSが起動しません でした。
もし再起動後OSが起動せず、UEFIメニューに飛ばされた場合は、 インストールメディアから適宜Live環境を起動して、/boot/efi/EFI/BOOT ディレクトリを適当なディレクトリに退避 してください。

再起動後の確認

リゾルバ(DNS)の確認

再起動後、OSが立ち上がってきたらリゾルバが書き換わっていないか確認します。
拙宅では虚無(0KB)になっていました。なんで?????

root@debian:~# cat /etc/resolv.conf

UFWの確認

/etc/sysctl.conf を用いるのが正道(諸説あります)ですが、何故か /etc/ufw/sysctl.conf を用いるようになっている場合があります(というか、実際なっていた)。

# /etc/default/ufw
#

# Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
# accepted). You will need to 'disable' and then 'enable' the firewall for
# the changes to take affect.
IPV6=yes

# Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_INPUT_POLICY="DROP"

# Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_OUTPUT_POLICY="ACCEPT"

# Set the default forward policy to ACCEPT, DROP or REJECT.  Please note that
# if you change this you will most likely want to adjust your rules
DEFAULT_FORWARD_POLICY="ACCEPT"

# Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
# note that setting this to ACCEPT may be a security risk. See 'man ufw' for
# details
DEFAULT_APPLICATION_POLICY="SKIP"

# By default, ufw only touches its own chains. Set this to 'yes' to have ufw
# manage the built-in chains too. Warning: setting this to 'yes' will break
# non-ufw managed firewall rules
MANAGE_BUILTINS=no

#
# IPT backend
#
# only enable if using iptables backend
# ↓ここ↓
IPT_SYSCTL=/etc/sysctl.conf 
# ↑ここ↑

# Extra connection tracking modules to load. IPT_MODULES should typically be
# empty for new installations and modules added only as needed. See
# 'CONNECTION HELPERS' from 'man ufw-framework' for details. Complete list can
# be found in net/netfilter/Kconfig of your kernel source. Some common modules:
# nf_conntrack_irc, nf_nat_irc: DCC (Direct Client to Client) support
# nf_conntrack_netbios_ns: NetBIOS (samba) client support
# nf_conntrack_pptp, nf_nat_pptp: PPTP over stateful firewall/NAT
# nf_conntrack_ftp, nf_nat_ftp: active FTP support
# nf_conntrack_tftp, nf_nat_tftp: TFTP support (server side)
# nf_conntrack_sane: sane support
IPT_MODULES=""

もしも /etc/ufw/sysctl.conf を参照するようになっている場合は、 /etc/sysctl.conf に参照先を変更して sysctl -p してから、ufw reload します。
念の為再起動して、再起動後にちゃんと通信出来るか確認してください。

root@debian:~# sysctl -p
root@debian:~# ufw reload
root@debian:~# shutdown -r now

なお拙宅ではこのサーバーがルーターを担っていましたが、サーバー自体はインターネットへ疎通あり・サーバー <-> LAN間も疎通あり・LAN <-> インターネット間が疎通なしという意味不明な状態に陥り、最終的にUFWが原因であると特定するのに1時間半費やしました。

その他

  • vfio-pciドライバを当てているのに勝手にxeドライバがインストールされた
    ( /etc/modules-load.d/blacklist-xe.conf を新たに作成してxeドライバとi915ドライバを無効化し、 initramfs -k all -c して再起動)

  • 上記に伴いsensorsの配列順序が変わってしまい、fancontrol.service が起動に失敗した
    (上記対応後は元の配列順序に戻ったので解消)

  • 上記以外の理由でkea-dhcp4-server.serviceが起動に失敗した
    (バインドするインターフェイスを2箇所で明示的に指定する必要があった)

  • LXCコンテナはDebian12のままなのでそのままだとアップデートがエラーになる
    (順次対応中)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?