- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2023-10-15T16:06:14+09:00","","")
#author("2023-10-15T22:48:02+09:00","","")
#topicpath
////////////////////////////////////////////////////////////////////////////////
* 目次 [#w32711e9]
#contents();
////////////////////////////////////////////////////////////////////////////////
* grub プロンプトから起動する [#xa2d1aef]
- grub プロンプトを操作してシステムを起動する
+ どういう名前のディスクがあるかを確認する
grub> ls
(hd0), (hd0,gtp1), (hd0,gtp2), (hd0,gtp3), ...
-- どれが root ファイルシステムかわからない場合は、リストに出てきたものに / を付けて ls すると、中身が見えるので判断できる。
grub> ls (hd0,gtp2)/
boot home usr var <- / にあるはずのものが見えているので、どうやらこれが root ファイルシステムらしい、と判断できる
+ root ファイルシステムを指定する
grub> set root=(hd0,gtp2)
+ カーネルイメージと root ファイルシステムを指定する
grub> linux /boot/vmlinuz-4.19.0-10-amd64 root=/dev/sda2
-- ファイル名は bash 同様、Tab で補完できる。
+ initrd を指定する
grub> initrd /boot/initrd.img-4.19.0-10-amd64
+ boot する
grub> boot <run-level>
-- <run-level> は、必要なときだけ指定すれば良い
////////////////////////////////////////////////////////////////////////////////
* 起動時に [[runlevel>System/runlevel]] を変更する [#d1ccd42b]
+ grub の画面で "e" をタイプする
+ コマンドラインの編集画面が表示されると、以下のような行があるので、その後ろに [[runlevel>System/runlevel]] を数字で指定する。
linux /boot/vmlinuz-** root=** ro quiet
+ Ctrl-x または F12 キーで編集画面を終了し、起動処理が開始する。
* grub2 の install に失敗する [#g6e4d039]
root@benda:/home/kazu# /usr/sbin/grub-install /dev/sda
Installing for i386-pc platform.
/usr/sbin/grub-install: 警告: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/usr/sbin/grub-install: 警告: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-install: エラー: will not proceed with blocklists.
root@benda:/home/kazu# /sbin/fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000LM048-2E71
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: A7E01EA8-10EF-42FF-B030-18FD76481CDB
Device Start End Sectors Size Type
/dev/sda1 2048 585727 583680 285M EFI System
/dev/sda2 585728 390819839 390234112 186.1G Linux filesystem
/dev/sda3 390819840 1758007295 1367187456 651.9G Linux filesystem
/dev/sda4 1758007296 1953523711 195516416 93.2G Linux swap
root@benda:/home/kazu# /sbin/fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000LM048-2E71
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: A7E01EA8-10EF-42FF-B030-18FD76481CDB
Device Start End Sectors Size Type
/dev/sda1 2048 585727 583680 285M EFI System
/dev/sda2 585728 390819839 390234112 186.1G Linux filesystem
/dev/sda3 390819840 1758007295 1367187456 651.9G Linux filesystem
/dev/sda4 1758007296 1953523711 195516416 93.2G Linux swap
- この後、下記を実行することにより、grub が正常に立ち上がるようになった。
# update-grub
//////////////////////////////////////////////////////////////////////////////
* grub に他の OS の起動エントリを認識させる [#grub_disable_os_prober]
- debian12 以降の grub (grub 2.06-13)では、2つ以上の OS があるマシン上で、デフォルトでは Linux 以外の OS のエントリを検出しない設定に変わった。
- debian12 以降の grub (grub 2.06-13)では、2つ以上の OS があるマシン上で、デフォルトでは他の OS のエントリを検出しない設定に変わった。
- update-grub を実行しても存在するはずの他 OS を検出しない場合は、以下を行う:
++ 他の OS のエントリを認識するよう、設定変更する
# vi /etc/default/grub
#GRUB_DISABLE_OS_PROBER=false # ←この行の行頭の # を削除して有効化する
++ 他の OS のエントリを認識させる
# update-grub