我刚刚在我的计算机上安装了 debian,该计算机之前装有 Windows 8(在存储硬盘上有 2 个硬盘安装了 debian),但是它直接启动到 Windows 8,而没有加载 grub 或任何其他内容。我该怎么做才能在启动时在 Windows 和 Debian 之间进行选择?
答案1
@user11177 可能你缺少 grub。您运行的是 UEFI 吗?无论如何看一下这里。
To install grub:
Getting the System to Boot
Here is a terse summary. For details, see section 4.
1.
Boot your system using a "live CD" or "live DVD".
2.
Open a shell window and become root: sudo su
3.
For clarity, let’s discuss things using the shell variables $partition and $device. An example might be: partition=/dev/sda6 ; device=/dev/sda
4.
You need to know which partition holds the Linux system you want to boot. If you remember this, define $partition and $device accordingly, and skip to the next step. If you need to figure it out,
get a list of disk devices: ls /dev/sd? /dev/hd?
look at each such device: cfdisk $device or fdisk -l $device
Look at the partition sizes and partition labels to find the partition that you want to boot. Define $partition and $device accordingly.
5.
Create a mountpoint: install -d /mnt/radicula
6.
Mount the partition containing your Linux: mount $partition /mnt/radicula
7.
Reinstall grub: grub-install --root-directory=/mnt/radicula $device
Beware: You want to install grub on the device (e.g. /dev/sda). If you install it on the partition (e.g. /dev/sda6), the grub-install program won’t complain, but the results won’t be what you wanted.
That’s probably enough to get you going. If you want to give it a try, shut down the live CD system, eject the CD, and reboot in the normal way from your favorite device (/dev/sda in the example).
If you want to improve your chances, you can do a little more work before rebooting.
8.
If the Live CD system has a /boot directory, move it out of the way: mv /boot /xxxboot
9.
Put the target system’s boot directory in its place: ln -s /mnt/radicula/boot /
10.
Back up the existing grub control file, namely grub.cfg (for Grub Version 2) and/or menu.lst (for Grub Version 1). If both exist, back up both of them. cd /boot/grub ; cp grub.cfg grub.cfg#1 ; cp menu.lst menu.lst#1
11.
Update the grub control file: update-grub.
Note that in Grub Version 1, update-grub writes the file menu.lst, whereas in Grub Version 2, it invokes grub-mkconfig to write the file grub.cfg.
Now you really should be ready to shut own the Live CD system, remove the CD, and reboot in the normal way.