一般安裝Linux, Windows雙系統都是先安裝Windows然後安裝Linux,這種情況下Grub會自動檢測到Windows並添加到啟動列表中。如果安裝順序顛倒則可以有以下解決方法:
新版的Ubuntu使用的是Grub2,命令與Grub稍微有一些不同,大致操作如下
my-desktop:~$ sudo grub-setup -d /media/disk/boot/grub /dev/sda
其中disk和sda需要根據Linux所在硬盤進行調整。
以下是grub-setup的幫助信息
my-desktop:~$ sudo grub-setup --help
Usage: grub-setup [OPTION]... DEVICE
Set up images to boot from DEVICE.
DEVICE must be a GRUB device (e.g. `(hd0,1)').
-b, --boot-image=FILE use FILE as the boot image [default=boot.img]
-c, --core-image=FILE use FILE as the core image [default=core.img]
-d, --directory=DIR use GRUB files in the directory DIR [default=/boot/grub]
-m, --device-map=FILE use FILE as the device map [default=/boot/grub/device.map]
-r, --root-device=DEV use DEV as the root device [default=guessed]
-f, --force install even if problems are detected
-s, --skip-fs-probe do not probe for filesystems in DEVICE
-h, --help display this message and exit
-V, --version print version information and exit
-v, --verbose print verbose messages
Report bugs to <[email protected]>.