Raspberry Pi OS Lite(64bit) をWordpressのサーバとして使用しています。バージョンが上がるたびに、クリーンインストールを行いますが、その時に気が付いた差分を掲載します。
今回は、bookworm(Devian12)からtrixie(Devian13)にメジャーバージョンアップしたとき、特に変わったと思われるところを書いています。
もう一点、少し遅れて、Raspberry Pi Imagermも1.9.6から2.0.0にメジャーバージョンアップしたので合わせて書きます。
bulleseyes(Devian11)からbookworm(Devian12)にメジャーバージンアップしたときの記事は、下記を参照ください。
スワップ
swapの管理が、dphys-swapfileからrpi-swap パッケージで管理された、zram(メモリディスク)ベースのswap(圧縮RAMスワップ)に変更となりました。設定は systemd と連携して自動生成されます。
考え方が全く変わり、設定も検討する項目が増えます。記事にまとめているので参照ください。
swapは、メモリが無くなった時に、swapファイルを仮想メモリとして使用し、一時的なメモリの要求に対処します。
Linuxでは、空きメモリは無駄にしない方針で、未使用メモリを積極的にページキャッシュやバッファキャッシュに利用します。もちろん、必要になれば、キャッシュは即座に解放されるため、アプリケーションのメモリ確保を妨げません。
swapが頻繁に使用されるシーンでは、レスポンスの低下やディスク(mircroSDやSSD)の劣化が進みます。そのため、trixieでは、zram(メモリディスク)が標準で組み込まれて、その上にswapが設けられています。
メモリが無くなった時、zram(メモリディスク)に設定したswapファイルを使用しても、所詮メモリ、今後使い方を考えないといけなと思っています。
cloud-init
cloud-initは、元々、Amazon EC2用に開発された、主にOS設定の自動化で開発されたツールです。
trixieでは、Raspberry Pi Imagerで設定された内容を、Raspberry Pi OSの初期起動時に設定するためだけに使用されているようです。
最初の起動が終わってしまうと、特に使用することはないので、サービスを停止しました。
ここからは、cloud-initがどう設定されているか掲載しています。興味のある方は参照ください。
$ cat /etc/cloud/cloud.cfg.d/99_raspberry-pi.cfg
# configure cloud-init with NoCloud
datasource_list: [ NoCloud, None ]
datasource:
NoCloud:
seedfrom: file:///boot/firmware
# Leave SSH key emission to console disabled so that
# users can decide whether to enable it manually.
ssh:
emit_keys_to_console: false
no_ssh_fingerprints: true
# Disable SSH host key generation
# regenerate_ssh_host_keys.service will take care
# of it on first boot
ssh_deletekeys: false
# Disable generation as it could be that the new keys
# aren't available yet when the service runs.
# also they are really only needed for the ssh service
# which will only run after the keys are already present
# so we don't schedule cloud-init after key generation
# as that would delay first boot too much
ssh_genkeytypes: []
赤字の通り、/boot/firmwareにuser-dataとnetwork-configのファイルがあることが書かれています。
現在の設定されているuser-dataの内容は下記の通りです。Raspberry Pi Imagerで設定した内容です。
$ cat /boot/firmware/user-data
#cloud-config
hostname: raspberrypi
manage_etc_hosts: true
packages:
- avahi-daemon
apt:
conf: |
Acquire {
Check-Date "false";
};
timezone: Asia/Tokyo
keyboard:
model: pc105
layout: "jp"
enable_ssh: true
users:
- name: xxxxxxx
groups: users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo
shell: /bin/bash
lock_passwd: false
passwd: ---------------------------------------
ssh_pwauth: true
rpi:
interfaces:
serial: true
runcmd:
- [ rfkill, unblock, wifi ]
- [ sh, -c, "for f in /var/lib/systemd/rfkill/*:wlan; do echo 0 > \"$f\f"; done" ]
※赤字のところは、変更しているのでご注意ください。
また、network-configの内容は下記の通りです。WordPressのサーバで使用するのでWi-Fiを設定していなかったので、ほぼ全てコメントのままです。
$ cat /boot/firmware/network-config
# This file contains a netplan-compatible configuration which cloud-init will
# apply on first-boot (note: it will *not* update the config after the first
# boot). Please refer to the cloud-init documentation and the netplan reference
# for full details:
#
# https://netplan.io/reference
# https://cloudinit.readthedocs.io/en/latest/topics/network-config.html
# https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
#
# Please note that the YAML format employed by this file is sensitive to
# differences in whitespace; if you are editing this file in an editor (like
# Notepad) which uses literal tabs, take care to only use spaces for
# indentation. See the following link for more details:
#
# https://en.wikipedia.org/wiki/YAML
#
# Additionally, please be aware that if your boot sequence depends on active
# networking (e.g. if your cloud-init configuration pulls packages or SSH
# keys from the network), you *must* mark at least one interface as required
# ("optional: false") below. Otherwise, particularly on faster boards,
# cloud-init will start attempting to use the network before it is ready
# Some additional examples are commented out below
#network:
# version: 2
#
# ethernets:
# eth0:
# dhcp4: true
# optional: true
# wifis:
# wlan0:
# dhcp4: true
# optional: true
# access-points:
# myhomewifi:
# password: "S3kr1t"
# myworkwifi:
# password: "correct battery horse staple"
# workssid:
# auth:
# key-management: eap
# method: peap
# identity: "me@example.com"
# password: "passw0rd"
# ca-certificate: /etc/my_ca.pem
# regulatory-domain: GB
Raspberry Pi Imager2.0
2025/10/1 trixie(Debian13)がリリースされた後、少しの間Raspberry Pi Imagerのバージョンは1.9.6だったのですが、直ぐに2.0.0にメジャーバージョンアップしました。
ユーザインターフェースが大分変ったので、関連する記事を下記に掲載します。
(只今工事中)



