我尝试在预装了 Windows7 的笔记本电脑(Lenovo Z580)上使用 Live CD 安装 Ubuntu 12.04。
在安装时,我创建了root
(15GB)sda1
和swap
(4GB)的分区sda2
。成功安装 Ubuntu 并重新启动后,我重新安装了grub
。
经过多次修改后,按照 Linux 论坛的建议,重新安装并更新 grub,现在 grub 显示 Ubuntu 12.04 和 Windows7 的选项,Ubuntu 运行良好。
这是我用来获取 grub 条目的过程:我在这里使用了选项 2:http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7
巫师,
从 livecd 启动 ubuntu,打开终端并运行:
sudo -i mount /dev/sda7 /mnt mount /dev/sda6 /mnt/boot #如果没有单独的 /boot 分区,请跳过此步骤 grub-install --root-directory=/mnt/ /dev/sda
如果您丢失了“grub.cfg”文件,请使用以下命令重新创建:
mount --bind /proc /mnt/proc mount --bind /dev /mnt/dev mount --bind /sys /mnt/sys chroot /mnt update-grub umount /mnt/sys umount /mnt/dev umount /mnt/proc 退出
选择 Windows7 后,我得到:
error: device not found ...<UUID>...
error: file not found
请帮我解决这个问题。
我的启动信息摘要结果文件如下:
> **Boot Info Script 0.61 [1 April 2012]**
------------------------------------
**
>
>
>============================= Boot Info Summary: ===============================
>
>=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
> the same hard drive for core.img. core.img is at this location and looks
> for (,msdos1)/boot/grub on this drive.
>
>sda1: __________________________________________________________________________
>
> File system: ext4
> Boot sector type: -
> Boot sector info:
> Operating System: Ubuntu 12.04 LTS
> Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img
>
>sda2: __________________________________________________________________________
>
> File system: swap
> Boot sector type: -
> Boot sector info:
>
>============================ Drive/Partition Info: =============================
>
>Drive: sda _____________________________________________________________________
>
>Disk /dev/sda: 750.2 GB, 750156374016 bytes
>255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
>Units = sectors of 1 * 512 = 512 bytes
>Sector size (logical/physical): 512 bytes / 4096 bytes
>
>Partition Boot Start Sector End Sector # of Sectors Id System
>
>/dev/sda1 * 63 39,062,562 39,062,500 83 Linux
>/dev/sda2 39,070,080 49,303,484 10,233,405 82 Linux swap / Solaris
>
>
>"blkid" output: ________________________________________________________________
>
>Device UUID TYPE LABEL
>
>/dev/sda1 f7f81676-bd83-4fd9-96bc-a657785a491f ext4 ubuntu_12.04
>/dev/sda2 df6ae95d-e88d-4f4a-a010-b01a8d642f0a swap
>/dev/sr0 iso9660 Ubuntu 12.04 LTS i386
>
>================================ Mount points: =================================
>
>Device Mount_Point Type Options
>
>/dev/sda1 / ext4 (rw,errors=remount-ro)
>/dev/sr0 /media/Ubuntu 12.04 LTS i386 iso9660 >(ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks)
>
>
>=========================== sda1/boot/grub/grub.cfg: ===========================
>
>--------------------------------------------------------------------------------
>### BEGIN /etc/grub.d/00_header ###
>insmod part_msdos
>if [ -s $prefix/grubenv ]; then
> set have_grubenv=true
> load_env
>fi
>set default="0"
>if [ "${prev_saved_entry}" ]; then
> set saved_entry="${prev_saved_entry}"
> save_env saved_entry
> set prev_saved_entry=
> save_env prev_saved_entry
> set boot_once=true
>fi
>
>function savedefault {
> if [ -z "${boot_once}" ]; then
> saved_entry="${chosen}"
> save_env saved_entry
> fi
>}
>
>function recordfail {
> set recordfail=1
> if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; >fi; fi
>}
>
>function load_video {
> insmod vbe
> insmod vga
> insmod video_bochs
> insmod video_cirrus
>}
>
>insmod part_msdos
>insmod ext2
>set root='(hd0,msdos1)'
>search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
>if loadfont /usr/share/grub/unicode.pf2 ; then
> set gfxmode=auto
> load_video
> insmod gfxterm
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> set locale_dir=($root)/boot/grub/locale
> set lang=en_IN
> insmod gettext
>fi
>terminal_output gfxterm
>if [ "${recordfail}" = 1 ]; then
> set timeout=-1
>else
> set timeout=10
>fi
>### END /etc/grub.d/00_header ###
>
>### BEGIN /etc/grub.d/05_debian_theme ###
>set menu_color_normal=white/black
>set menu_color_highlight=black/light-gray
>if background_color 44,0,30; then
> clear
>fi
>### END /etc/grub.d/05_debian_theme ###
>
>### BEGIN /etc/grub.d/10_linux ###
>function gfxmode {
> set gfxpayload="${1}"
> if [ "${1}" = "keep" ]; then
> set vt_handoff=vt.handoff=7
> else
> set vt_handoff=
> fi
>}
>if [ "${recordfail}" != 1 ]; then
> if [ -e ${prefix}/gfxblacklist.txt ]; then
> if hwmatch ${prefix}/gfxblacklist.txt 3; then
> if [ ${match} = 0 ]; then
> set linux_gfx_mode=keep
> else
> set linux_gfx_mode=text
> fi
> else
> set linux_gfx_mode=text
> fi
> else
> set linux_gfx_mode=keep
> fi
>else
> set linux_gfx_mode=text
>fi
>export linux_gfx_mode
>if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
>menuentry 'Ubuntu, with Linux 3.2.0-37-generic-pae' --class ubuntu --class gnu-linux >--class gnu --class os {
> recordfail
> gfxmode $linux_gfx_mode
> insmod gzio
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> linux /boot/vmlinuz-3.2.0-37-generic-pae root=UUID=f7f81676-bd83-4fd9-96bc-a657785a491f ro quiet splash
>$vt_handoff
> initrd /boot/initrd.img-3.2.0-37-generic-pae
>}
>menuentry 'Ubuntu, with Linux 3.2.0-37-generic-pae (recovery mode)' --class ubuntu >--class gnu-linux --class gnu --class os {
> recordfail
> insmod gzio
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> echo 'Loading Linux 3.2.0-37-generic-pae ...'
> linux /boot/vmlinuz-3.2.0-37-generic-pae root=UUID=f7f81676-bd83-4fd9-96bc-a657785a491f ro recovery nomodeset
> echo 'Loading initial ramdisk ...'
> initrd /boot/initrd.img-3.2.0-37-generic-pae
>}
>submenu "Previous Linux versions" {
>menuentry 'Ubuntu, with Linux 3.2.0-23-generic-pae' --class ubuntu --class gnu-linux >--class gnu --class os {
> recordfail
> gfxmode $linux_gfx_mode
> insmod gzio
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=f7f81676-bd83-4fd9-96bc-a657785a491f ro quiet splash $vt_handoff
> initrd /boot/initrd.img-3.2.0-23-generic-pae
>}
>menuentry 'Ubuntu, with Linux 3.2.0-23-generic-pae (recovery mode)' --class ubuntu >--class gnu-linux --class gnu --class os {
> recordfail
> insmod gzio
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> echo 'Loading Linux 3.2.0-23-generic-pae ...'
> linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=f7f81676-bd83-4fd9-96bc-a657785a491f ro recovery nomodeset
> echo 'Loading initial ramdisk ...'
> initrd /boot/initrd.img-3.2.0-23-generic-pae
>}
>}
>### END /etc/grub.d/10_linux ###
>### BEGIN /etc/grub.d/20_linux_xen ###
>### END /etc/grub.d/20_linux_xen ###
>### BEGIN /etc/grub.d/20_memtest86+ ###
>menuentry "Memory test (memtest86+)" {
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> linux16 /boot/memtest86+.bin
>}
>menuentry "Memory test (memtest86+, serial console 115200)" {
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos1)'
> search --no-floppy --fs-uuid --set=root f7f81676-bd83-4fd9-96bc-a657785a491f
> linux16 /boot/memtest86+.bin console=ttyS0,115200n8
>}
>### END /etc/grub.d/20_memtest86+ ###
>### BEGIN /etc/grub.d/30_os-prober ###
>### END /etc/grub.d/30_os-prober ###
>### BEGIN /etc/grub.d/30_uefi-firmware ###
>### END /etc/grub.d/30_uefi-firmware ###
>### BEGIN /etc/grub.d/40_custom ###
># This file provides an easy way to add custom menu entries. Simply type the
># menu entries you want to add after this comment. Be careful not to change
># the 'exec tail' line above.
>menuentry "Windows 7" {
>insmod part_gpt
>insmod ntfs
>insmod search_fs_uuid
>insmod chain
>search --fs-uuid --no-floppy --set=root df6ae95d-e88d-4f4a-a010-b01a8d642f0a
>chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
>}
>### END /etc/grub.d/40_custom ###
>### BEGIN /etc/grub.d/41_custom ###
>if [ -f $prefix/custom.cfg ]; then
> source $prefix/custom.cfg;
>fi
>### END /etc/grub.d/41_custom ###
>--------------------------------------------------------------------------------
>=============================== sda1/etc/fstab: ================================
>--------------------------------------------------------------------------------
># /etc/fstab: static file system information.
>#
># Use 'blkid' to print the universally unique identifier for a
># device; this may be used with UUID= as a more robust way to name devices
># that works even if disks are added and removed. See fstab(5).
>#
># <file system> <mount point> <type> <options> <dump> <pass>
>proc /proc proc nodev,noexec,nosuid 0 0
># / was on /dev/sda1 during installation
>UUID=f7f81676-bd83-4fd9-96bc-a657785a491f / ext4 errors=remount-ro >0 1
># swap was on /dev/sda2 during installation
>UUID=df6ae95d-e88d-4f4a-a010-b01a8d642f0a none swap sw >0 0
>--------------------------------------------------------------------------------
>=================== sda1: Location of files loaded by Grub: ====================
> GiB - GB File Fragment(s)
> 2.222815990 = 2.386730496 boot/grub/core.img 1
> 2.216872692 = 2.380348928 boot/grub/grub.cfg 1
> 8.361613750 = 8.978214400 boot/grub/stage2 1
> 1.656280041 = 1.778417152 boot/initrd.img-3.2.0-23-generic-pae 4
> 1.755408764 = 1.884855808 boot/initrd.img-3.2.0-37-generic-pae 2
> 8.359111309 = 8.975527424 boot/vmlinuz-3.2.0-23-generic-pae 1
> 1.461738110 = 1.569529344 boot/vmlinuz-3.2.0-37-generic-pae 1
> 1.656280041 = 1.778417152 initrd.img 4
> 1.656280041 = 1.778417152 initrd.img.old 4
> 8.359111309 = 8.975527424 vmlinuz 1
>
>========= Devices which don't seem to have a corresponding hard drive: =========
>sdb
>=============================== StdErr Messages: ===============================
>xz: (stdin): Compressed data is corrupt
我也尝试添加GRUB_PRELOAD_MODULES="part_msdos"
文件/etc/default/grub
和
菜单项“Windows 7”{ insmod part_msdos insmod ntfs insmod search_fs_uuid insmod chain search --fs-uuid --no-floppy --set=root df6ae95d-e88d-4f4a-a010-b01a8d642f0a chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi }
在/etc/grub.d/40_custom
文件中,并更新了 grub - 按照另一个论坛的建议尝试配置 grub 中的菜单选项。
还有一件事..我无法在 Ubuntu 中看到 Windows7 分区,正如您在 bootinfosummary 中看到的那样!这是否意味着我已经格式化了 Windows 分区?
$ sudo fdisk -l
Disk /dev/sda: 750.2 GB, 750156374016 bytes 255 heads, 63
sectors/track, 91201 cylinders, total 1465149168 sectors Units =
sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512
bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000ec888
Device Boot Start End Blocks Id System
/dev/sda1 * 63 39062562 19531250 83 Linux
Partition 1 does not start on physical sector boundary. /dev/sda2
39070080 49303484 5116702+ 82 Linux swap / Solaris