Ubuntu

Ubuntu18.04 Unattended upgrade returned: False

サーバー管理者宛におかしなメールが飛んできた。

Unattended upgrade returned: False

Warning: A reboot is required to complete this upgrade.

Packages that attempted to upgrade:
…

なんだろこれ?



広告


メールを読み進めていくと、こんなことが書かれている。

…
Log started: 2021-08-18  06:37:52
Removing linux-modules-extra-4.15.0-151-generic (4.15.0-151.157) ...
Removing linux-image-4.15.0-151-generic (4.15.0-151.157) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-151-generic
/etc/kernel/postrm.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... 

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub-legacy-ec2: line 1101: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1
dpkg: error processing package linux-image-4.15.0-151-generic (--remove):
 installed linux-image-4.15.0-151-generic package post-removal script subprocess returned error exit status 1
Log ended: 2021-08-18  06:37:59
…

/boot/grub/menu.lstが見つからないといっている。

環境

ESXiが動いていて、CPUが対応していないのに無理矢理7.0U2aにバージョンを上げた状態。
BIOS起動していた仮想マシンを、UEFI起動するように変更した直後の出来事。

対策

そのファイルがないのか確認してみた。

$ ll /boot/grub/menu.lst
ls: cannot access '/boot/grub/menu.lst': No such file or directory

確かにない。でも、他のVMにもないし、まっさらからVMware Playerにインストールした環境にもない。
このファイルがないことが問題ではないのかもしれないが、でも、ないから上手くいかないと云っている。

調べてみたところ、この手順でファイルが作られて問題が解消するようだ。
ask ubuntu / Ubuntu Server 18.04 apt-get Fails

空ファイルを作って、update-grubを実行。

$ sudo touch /boot/grub/menu.lst

$ sudo update-grub2
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-154-generic
Found initrd image: /boot/initrd.img-4.15.0-154-generic
Found linux image: /boot/vmlinuz-4.15.0-153-generic
Found initrd image: /boot/initrd.img-4.15.0-153-generic
Adding boot menu entry for EFI firmware configuration
done

update-grub、ではなく、update-grub2を実行しているが何が違うのか…。というと違いはないようだ。
ask ubuntu / What is the difference between update-grub and update-grub2?

$ ll /usr/sbin/update-grub*
-rwxr-xr-x 1 root root    64 Feb 24 01:23 /usr/sbin/update-grub*
lrwxrwxrwx 1 root root    11 Feb 25 04:47 /usr/sbin/update-grub2 -> update-grub*
-rwxr-xr-x 1 root root 45019 Mar 24  2018 /usr/sbin/update-grub-legacy-ec2*

気を取り直して、以下を実行。

$ sudo apt update
$ sudo apt upgrade

アップグレードの途中で、この問い合わせを2回受けた。インストールされているカーネルの数の影響なのか。
どちらもmaintainer’s versionをインストールする選択とした。

     lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
     x A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally   x
     x modified.                                                                                                 x
     x                                                                                                           x
     x What would you like to do about menu.lst?                                                                 x
     x                                                                                                           x
     x                        install the package maintainer's version                                           x
     x                        keep the local version currently installed                                         x
     x                        show the differences between the versions                                          x
     x                        show a side-by-side difference between the versions                                x
     x                        show a 3-way difference between available versions                                 x
     x                        do a 3-way merge between available versions (experimental)                         x
     x                        start a new shell to examine the situation                                         x
     x                                                                                                           x
     x                                                                                                           x
     x                                                  <Ok>                                                     x
     x                                                                                                           x
     mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

※罫線がアルファベットで表現されているが…ご愛敬。

不要になっているカーネルとかモジュールを削除。

$ sudo apt autoremove

これらの操作の結果として、menu.lstに中身が作られた。

/boot/grub/menu.lst

…
title       Ubuntu 18.04.5 LTS, kernel 4.15.0-154-generic
root        (hd0)
kernel      /boot/vmlinuz-4.15.0-154-generic root=UUID=b275e549-c177-4a21-a5e8-1e596c81ff24 ro console=hvc0
initrd      /boot/initrd.img-4.15.0-154-generic

title       Ubuntu 18.04.5 LTS, kernel 4.15.0-154-generic (recovery mode)
root        (hd0)
kernel      /boot/vmlinuz-4.15.0-154-generic root=UUID=b275e549-c177-4a21-a5e8-1e596c81ff24 ro  single
initrd      /boot/initrd.img-4.15.0-154-generic

title       Ubuntu 18.04.5 LTS, kernel 4.15.0-153-generic
root        (hd0)
kernel      /boot/vmlinuz-4.15.0-153-generic root=UUID=b275e549-c177-4a21-a5e8-1e596c81ff24 ro console=hvc0
initrd      /boot/initrd.img-4.15.0-153-generic

title       Ubuntu 18.04.5 LTS, kernel 4.15.0-153-generic (recovery mode)
root        (hd0)
kernel      /boot/vmlinuz-4.15.0-153-generic root=UUID=b275e549-c177-4a21-a5e8-1e596c81ff24 ro  single
initrd      /boot/initrd.img-4.15.0-153-generic

### END DEBIAN AUTOMAGIC KERNELS LIST
…

なんだかそれっぽい感じにはなっている。

これで問題がないか、再起動して確認してみたところ、問題なく起動してきている。
恐らくこれで解決。

さいごに

menu.lstが必要なのかどうか分からないが、しばらくはこれで様子を見る。

広告
ろっひー

コメントはこちらから お気軽にどうぞ ~ 投稿に関するご意見・感想・他