
我現在使用的是 Debian 6.0.6 Squeeze,我是在 Windows XP 上安裝的。
它只是我第一次安裝 Windows XP 的一個硬碟,然後使用一些 Windows 工具來建立分割區,後來我在其中安裝了 Debian
現在,我可以輕鬆地啟動 Debian,但沒有 Windows 的跡象。我嘗試了網上推薦的一些方法,但仍然無法正常工作
我嘗試過os-prober
,嘗試編輯grub.cfg
(我設法將 Windows XP 添加到菜單,但這只是空鏈接,當我輸入什麼也沒有發生(空白屏幕)時,它應該鏈接到哪裡?)
同樣,在 fdisk -l 之後:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c0014
Device Boot Start End Blocks Id System
/dev/sda1 2 4663 37447484+ f W95 Ext'd (LBA)
/dev/sda2 4664 4864 1614532+ 82 Linux swap / Solaris
/dev/sda5 2 2032 16313976 7 HPFS/NTFS
/dev/sda6 2033 4663 21133476 83 Linux
更新 grub
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
done
答案1
從我之前收集的答案來看,您可能正在使用 grub2。手動新增選單項目的正確方法是透過目錄/etc/grub.d/
。
建立一個檔案01_windows_xp
(根據你想要的順序更改數字,linux有10_
)並在其中添加以下內容:
echo "Adding Windows XP to the Menu..."
cat << EOF
menuentry "Windows XP"
set root=(hd0,5)
chainloader +1
}
EOF
然後重新運行update-grub
。之後就可以查看生成的結果了/boot/grub/grub.cfg
。這樣,新的選單項目將在核心更新後繼續存在,其中 update-grub 將自動運行。
答案2
假設您沒有覆蓋 Windows 安裝(您說您是「覆蓋」Windows XP 安裝的?),以下命令應該就夠了。如果沒有,請用他們的輸出更新您的問題:
sudo update-grub
Sudo grub-install /dev/sda
答案3
使用您喜歡的文字編輯器和 sudo 編輯 /boot/grub/menu.lst。新增以下行:
title Microsoft Windows XP
root (hd0,5)
chainloader +1
跑步:
sudo update-grub
sudo grub-install /dev/sda
重新啟動並完成
如果使用 grub2:
設定檔位於此處:
/boot/grub/grub.cfg
新增的行應該是:
menuentry "Microsoft Windows XP" {
set root=(hd0,5)
chainloader +1
}
跑步:
sudo update-grub
sudo grub-install /dev/sda