apt-get upgrade で、以下のパッケージは保留されます:linux-image-amd64 と表示された時の対処方法

未分類

本ページは広告が含まれています。気になる広告をクリック頂けますと、サーバ運営費になります(^^

事象

現在動いているカーネル

Linux TestDB 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29)                                                     x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debianバージョン

# cat /etc/debian_version
12.8

apt-get update すると

# apt-get update
取得:1 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
ヒット:2 http://deb.debian.org/debian bookworm InRelease
取得:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
取得:4 http://security.debian.org/debian-security bookworm-security/main Sources [133 kB]
取得:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [236 kB]
取得:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [139 kB]
612 kB を 1秒 で取得しました (955 kB/s)
パッケージリストを読み込んでいます... 完了

さらに apt-get upgrade すると アップグレードが保留されている事が分かる

# apt-get upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージは保留されます:
  linux-image-amd64
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 1 個

詳しく調べてみる

apt list –upgradable -a

一覧表示… 完了
linux-image-amd64/stable-security 6.1.119-1 amd64 [6.1.55-1 からアップグレード可]
linux-image-amd64/stable 6.1.115-1 amd64
linux-image-amd64/now 6.1.55-1 amd64 [インストール済み、6.1.119-1 にアップグレード可]

原因

カーネルのアップグレードは、ユーザの意思によって行われるべきという意味ではないかな。勝手にアップグレードされず、保留される。

対処

アップグレードテスト

# apt-get -s dist-upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージが新たにインストールされます:
  linux-image-6.1.0-28-amd64
以下のパッケージはアップグレードされます:
  linux-image-amd64
アップグレード: 1 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
Inst linux-image-6.1.0-28-amd64 (6.1.119-1 Debian-Security:12/stable-security [amd64])
Inst linux-image-amd64 [6.1.55-1] (6.1.119-1 Debian-Security:12/stable-security [amd64])
Conf linux-image-6.1.0-28-amd64 (6.1.119-1 Debian-Security:12/stable-security [amd64])
Conf linux-image-amd64 (6.1.119-1 Debian-Security:12/stable-security [amd64])

エラー表示はないので、このままdist-upgrade を行っても大丈夫そう

# apt-get dist-upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージが新たにインストールされます:
  linux-image-6.1.0-28-amd64
以下のパッケージはアップグレードされます:
  linux-image-amd64
アップグレード: 1 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
69.0 MB のアーカイブを取得する必要があります。
この操作後に追加で 408 MB のディスク容量が消費されます。
続行しますか? [Y/n]

アップグレード完了

# apt-get dist-upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージが新たにインストールされます:
  linux-image-6.1.0-28-amd64
以下のパッケージはアップグレードされます:
  linux-image-amd64
アップグレード: 1 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
69.0 MB のアーカイブを取得する必要があります。
この操作後に追加で 408 MB のディスク容量が消費されます。
続行しますか? [Y/n]
取得:1 http://security.debian.org/debian-security bookworm-security/main amd64 linux-image-6.1.0-28-amd64 amd64 6.1.119-1 [69.0 MB]
取得:2 http://security.debian.org/debian-security bookworm-security/main amd64 linux-image-amd64 amd64 6.1.119-1 [1,476 B]
69.0 MB を 6秒 で取得しました (12.5 MB/s)
changelog を読み込んでいます... 完了
以前に未選択のパッケージ linux-image-6.1.0-28-amd64 を選択しています。
(データベースを読み込んでいます ... 現在 50283 個のファイルとディレクトリがインストールされています。)
.../linux-image-6.1.0-28-amd64_6.1.119-1_amd64.deb を展開する準備をしています ...
linux-image-6.1.0-28-amd64 (6.1.119-1) を展開しています...
.../linux-image-amd64_6.1.119-1_amd64.deb を展開する準備をしています ...
linux-image-amd64 (6.1.119-1) で (6.1.55-1 に) 上書き展開しています ...
linux-image-6.1.0-28-amd64 (6.1.119-1) を設定しています ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.1.0-13-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-6.1.0-13-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-6.1.0-28-amd64
I: /initrd.img is now a symlink to boot/initrd.img-6.1.0-28-amd64
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.1.0-28-amd64
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.1.0-28-amd64
Found initrd image: /boot/initrd.img-6.1.0-28-amd64
Found linux image: /boot/vmlinuz-6.1.0-13-amd64
Found initrd image: /boot/initrd.img-6.1.0-13-amd64
Found linux image: /boot/vmlinuz-6.1.0-9-amd64
Found initrd image: /boot/initrd.img-6.1.0-9-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
linux-image-amd64 (6.1.119-1) を設定しています ...

アップデート直後のカーネル

# uname -r
6.1.0-13-amd64

再起動したら、最新のカーネルにアップデートされています。

Linux TestDB 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22)                              x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

後始末

新しいカーネルで

# apt-get update
ヒット:1 http://deb.debian.org/debian bookworm InRelease
ヒット:2 http://security.debian.org/debian-security bookworm-security InRelease
ヒット:3 http://deb.debian.org/debian bookworm-updates InRelease
パッケージリストを読み込んでいます... 完了

した後に、

# apt-get upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
  linux-image-6.1.0-9-amd64
これを削除するには 'apt autoremove' を利用してください。
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。

不要なパッケージができていたので削除します。

# apt autoremove
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
以下のパッケージは「削除」されます:
  linux-image-6.1.0-9-amd64
アップグレード: 0 個、新規インストール: 0 個、削除: 1 個、保留: 0 個。
この操作後に 408 MB のディスク容量が解放されます。
続行しますか? [Y/n]

まとめ

業務利用中のサーバのアップデート、特にカーネルアップグレードは気を使います。再起動のタイミングなども事前に告知しておかないといけないし。万一、アップグレード後に起動しないなんて事があったらゾッとします。

うちは同じサーバを数台運用してるので、影響範囲の少なそうなサーバからアップグレードし、機能に問題がない事を確認した後、メインサーバのアップグレードをしています。

タイトルとURLをコピーしました