cover image

GRUB が Windows を認識しなくなった、のを直したメモ。

Summary

Before

$ sudo update-grub            
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-6.1.0-9-amd64
Found initrd image: /boot/initrd.img-6.1.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-21-amd64
Found initrd image: /boot/initrd.img-5.10.0-21-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

Fix: Enable os-prober by modifying /etc/default/grub

# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
GRUB_DISABLE_OS_PROBER=false

After

$ sudo update-grub            
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-6.1.0-9-amd64
Found initrd image: /boot/initrd.img-6.1.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-21-amd64
Found initrd image: /boot/initrd.img-5.10.0-21-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

Note

事の始まりは深く考えずに apt full-upgrade で Debian のバージョンもその他諸々も全てアップグレードしたことだ。Warining を読み流して再起動しようとしたら、そもそも起動できなくなってしまっていた。雑に生きているのでこういったトラブルは日常茶飯事である。dmesg やらなんやらでエラーを読み、新しく追加された non-free-firmware の存在を知って firmware-realtek と nvidia-driver を入れ直したら起動自体はできるようになった。これに比べたら GRUB に Windows が表示されないことなんて些末すぎて、一ヶ月ほど放置してしまっていたが、微妙に不便だったので今回ちょっと調べて直した。

そもそも GRUB とは Grand Unified Bootloader の略である。毎度忘れて調べている。Summary で使っている update-grubgrub-mkconfig -o /boot/grub/grub.cfg を実行して GRUB の設定ファイルを生成するコマンドで、最初の実行結果では Linux しか見つけられていない。ここで warning を読む。無視してはいけない。読まなければならない。

Warning: os-prober will not be executed to detect other bootable partitions.

どうやら os-prober というマシン上の他の OS を検出してくれるコマンドが実行されていないらしい、ということが分かる。これは /etc/default/grub にある GRUB_DISABLE_OS_PROBER を変更することで設定し直せた。この os-prober は、セキュリティを理由としてデフォルトでは disable となっているらしい。最近の変更ではなさそうなのにどうして今この問題に直面したのかは不明。

いろいろ書いたが DualBoot/Windows10 - Debian Wiki に解決策が載っているので、似たようなトラブルに見舞われた人は読むと良いです。