2
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?

More than 1 year has passed since last update.

マルチブート:grub2のos-proberが機能しないので、カスタムファイルを作って強制マルチブート

Last updated at Posted at 2023-03-01

grub2のos-proberが機能しないので、grubのエントリを新しく作った。
grub-mkconfigで、os-proberが他のパーティションのOSを検出しないのである。

普通、grub-mkconfig -o /boot/grub/grub.cfgとすると、自動的にパーティションをスキャンしてブート可能なOSをgrubのエントリに登録してくれる。

ダメ

/etc/default/grubを弄ってみた。

GRUB_DISABLE_OS_PROBER=false
にしてもダメ。

pacman -S os-prober
でos-proberをインストールしてもダメ。

UbuntuでもArch linuxでも同じことが起こる。
archlinuxインストール時に、間違ってUEFIブート関係を弄ってしまったのが原因かな?

os-prober
として実行しても、何も出力されない。os-proberのバグかな。

対策

とにかく対策をと思ってgrubにカスタムのエントリが出てくるように、
次のファイルを作った。

/boot/grub/custom.cfg

menuentry "ubuntu Linux" {
        set root='hd0,msdos1'
        linux /boot/vmlinuz root=UUID=4eac0df4-ab0c-4055-969f-ab73ea55ef4d quiet
        initrd /boot/initrd.img
}

やっぱり手動が一番だね。

解説

menuentry "ubuntu Linux" {   #  grubの選択画面で出てくるタイトル

        set root='hd0,msdos1'  #  0 : ディスクの1番目

             #  msdos1 : パーティション1番目

        linux /boot/vmlinuz root=UUID=4eac0df4-ab0c-4055-969f-ab73ea55ef4d quiet     # linux カーネルのロード

             # /boot/vmlinuz : デフォルトのカーネル指定

             # root=UUID=<hoge>: ブートパーティションのUUID

             # quiet : 起動時にずらずらメッセージを出さない


        initrd /boot/initrd.img  # initrd : 初期ramdiskのロード

             # /boot/initrd.img : デフォルトのinitrd.img 指定
}

追記・原因

他のOSを含むパーティションをマウントしてなければos-proberはサーチしませんでした。 マウントしたらos-proberはちゃんと他のosを検知したので、この記事は必要なくなりましたが、カスタムコンフィグレーションの書き方として残しておきます。

2
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
2
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?