当前位置: 首页>>技术教程>>正文


为Ubuntu&创建可引导(UEFI GRUB)USB Windows 7安装

, , , ,

问题描述

我想创建一个可启动的EFI USB以安装Ubuntu& Windows 7(可能带有PartedMagic之类的实用程序)。我以前使用MultiSystem做到了。但是,我使用的是GPT,因此需要以EFI模式启动Windows安装才能在GPT系统上安装。我想我必须改为使用GRUB EFI?如果没有像MultiSystem这样的应用程序可以创建GRUB EFI可启动USB,我该如何自己创建一个?

我想将USB格式化为GPT,并在其上安装GRUB EFI(如何?)。然后,我需要配置GRUB EFI以加载Ubuntu& Windows 7是否安装在EFI中?我该怎么办?

更新

这是我尝试过的

  • 在我的USB上创建2个分区(GPT,100 + MB FAT32(/dev /sdc1,设置启动标志),其余FAT32,/dev /sdc2,用于安装)

  • 提取Windows 7& Ubuntu 11.10 iso进入Installer分区,有2个不同的文件夹

  • 使用sudo elilo -b /dev/sdc1 –autoconf –efiboot -v进行了尝试


jiewmeng@JM:~$ sudo elilo -b /dev/sdc1 --autoconf --efiboot -v
elilo: backing up existing /etc/elilo.conf as /etc/elilo.conf-
Loaded efivars kernel module to enable use of efibootmgr
elilo: Checking filesystem on /dev/sdc1...
elilo: Mounting /dev/sdc1...
e    lilo: 44298KB needed, 78781KB free, 42192KB to reuse
elilo: Installing primary bootstrap /usr/lib/elilo/elilo.efi onto /dev/sdc1...
elilo: Installing /tmp/elilo.k8NWXX on /dev/sdc1...
elilo: Installing /vmlinuz on /dev/sdc1...
elilo: Installing /vmlinuz.old on /dev/sdc1...
elilo: Installing /initrd.img on /dev/sdc1...
elilo: Installing /initrd.img.old on /dev/sdc1...
elilo: Updating EFI boot-device variable...
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
elilo: An error occured while updating boot menu, we'll ignore it
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
elilo: Installation complete.

sudo modprobe efivars没有输出但是出现了相同的错误吗,我认为是因为我没有启动到EFI Ubuntu中?

接下来,我将尝试使用USB启动盘创建程序以EFI模式引导到实时系统中,然后重试

更新

我很迷茫,是Windows 1st安装了故障吗?我格式化了&用UNetBootIn为Ubuntu Alternate创建了可启动的USB,它也因没有可用内核的相同错误而失败。如果我制作了Ubuntu桌面,我将无法配置apt源

ubuntu桌面的系统日志安装http://pastebin.com/CdbUPXax

我觉得我最好不要浪费时间并尽快恢复到MBR …这将意味着我必须以某种方式备份所有数据1st …这就是为什么我将其推迟到万不得已时…有什么想法吗?

更新

我尝试以BIOS模式(Non-EFI)引导Ubuntu 11.10 Alternate,安装正常,除非无法安装引导加载程序。它显示致命错误。然后,我通过以恢复模式启动USB来安装GRUB。可行,但无法启动。引导时显示空白屏幕。如果我尝试进入恢复模式(在安装了ubuntu的HDD上),键盘似乎出现故障,但是鼠标点亮。

最佳办法

我正在对此问题/答案进行更新。这不会没有错误,但是当我使用@jiewmeng时,我发现目标是使用USB将Windows和Ubuntu安装到一个硬盘驱动器UEFI上。花费了一段时间,我找到了解决方案,但我们需要清除问题和答案。也许也可以回答原始问题,但由于目标更多是在安装方面,因此单引导UEFI USB似乎不那么重要。我目前正在使用两个USB memory 棒,一个用于Windows,一个用于Ubuntu。这是一个要尽快更新的在制品

我已经花了几天的时间在这里闲逛,终于有了一个USB,它将启动并提供Windows 7和Ubuntu的安装。我的配置是64位特定的,您可以尝试更改以适应32位intall,但文件名有很多差异。如果需要32位,请跟进。那就是…

您无法从GPT格式的USB安装Windows 7。您可以使用gdisk或parted来创建GPT USB,该USB将通过UEFI引导。您将能够配置UEFI引导管理器以从USB加载Windows安装程序,但是安装程序将搜索执行安装所需的文件和数据,并且它无法识别GPT USB,而会找到MBR USB 。

但是,这无关紧要,因为UEFI会查看MBR /GPT和EFI分区,请参阅Wikipedia entry on UEFI Booting

尽管USB使用std MBR,也可以通过UEFI将其安装到GPT磁盘上。

以下在64位UEFI Asus Sabertooth上使用64位安装进行工作。每个主板上的固件都是非常特定的,每个主板UEFI固件搜索UEFI引导的方式有所不同。您的主板可能找不到启动数据,但以下各项在我的ASUS上均可使用。

这是我制作可引导USB的方法,该USB具有Windows 7 64位DVD的可安装副本和Ubuntu ISO(在此示例中为11.10 64位桌面iso)。

使用16G USB,这是我手头的全部…将我的USB安装为/dev /sdc,将相关引用更改为适合您USB的设备。确保已安装7zip。

fdisk /dev/sdc
create new MBR, 'o' command
create new partition, part 1, size 8G, type ef, set bootable, write
mkfs.vfat -F32 /dev/sdc1
mkdir /mnt/USB
mount /dev/sdc1 /mnt/USB
insert Windows 7 x64 DVD, again, mine appeared as /media/UDF\ Volume, you need to change references below
# Extract/Copy the entire Windows DVD to the USB
cp -r /media/UDF\ Volume/* /mnt/USB
# I don't know what effect the following rename has, I copied blindly from another webpage.
mv /mnt/USB/sources/ei.cfg /mnt/USB/sources/ei.cfg_
cd /mnt/USB/efi/microsoft/boot/
7z e /mnt/USB/sources/install.wim 1/Windows/Boot/EFI/bootmgfw.efi
cp -r /mnt/USB/efi/microsoft/boot /mnt/USB/efi/
mv /mnt/USB/efi/boot/bootmgfw.efi /mnt/USB/efi/boot/bootx64.efi
# At this point I booted the USB, and installed Windows 7 to a GPT SSD
# Upon reboot I noticed the Windows Boot loader in my UEFI boot list (actually it made itself 1st).
# so, here we have a standalone Windows7 UEFI installer that will function correctly (64bit ASUS, at least).
# Now, on to adding Ubuntu
cd /mnt/USB
7z x /path2iso/ubuntu-11.10-desktop-amd64.iso
# If 7z finds prexisting files with the same name, just allow always overwrite
# (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit? A

# At this point I booted the USB, and installed Ubuntu x64 to a GPT SSD
# we have a standalone Ubuntu 64bit installer that install Ubuntu 64

# Now, on to add a boot manager that will allow us to select between Windows 7 and Ubuntu

# Get the target UUID of the USB partition, using either blkid or the following command
grub-probe --target=fs_uuid /mnt/USB/efi/Microsoft/Boot/bootmgfw.efi  
will print YOUR_UUID # Substitute into the following references to YOUR_UUID

# Append the following menuentry to /mnt/USB/boot/grub/x86_64-efi/grub.cfg

menuentry "Microsoft Windows x86_64 UEFI-GPT Setup" {
    insmod usbms  
    insmod part_gpt  
    insmod part_msdos  
    insmod fat  
    insmod search_fs_uuid  
    insmod chain  
    search --fs-uuid --no-floppy --set=root YOUR_UUID # <- CHANGE THIS TO YOUR UUID
    chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi  
}

瞧!使用grub作为启动管理器的工作USB memory 棒,允许通过UEFI安装将其安装到GPT磁盘。

如果您有任何错误,请随时与我联系,我会进行调查。

次佳办法

我会尽力回答这个问题,希望能为您指明正确的方向。

如您所知,只能通过EFI从GPT安装Win7 x64。更糟糕的是,您无法使用任何混合磁盘,因为Win7 x64将任何混合磁盘视为旧版MBR。因此,您必须将USB重新标记/重新分区为GPT。考虑到可移植性,这种类型的设置对于USB而言并不理想。我并不是说不要做一个,只是不希望有任何自动化工具存在。我实际上相信,在格式化驱动器之后,您也许可以使用多系统。如果自动安装的Grub2不支持EFI /GPT,请用正确的Grub2版本覆盖它。

因此,我认为您可能必须手动进行一些安装,而这整体而言超出了此答案的范围。虽然我应该可以让您入门…

使用当前版本的parted,用GPT重新标记驱动器。假设磁盘位于/dev /sdc,

 parted -s /dev/sdc mklabel gpt

现在,您必须对驱动器进行分区,最好是USB应该是单个主驱动器。对于我的可启动USB,我总是使用FAT32。

parted -s /dev/sdc mkpart primary fat32 0 -1

parted mkpart不会像mkpartfs那样创建FS。与parted的内置支持相反,parted DOC建议使用正确的mkfs

mkfs.vfat /dev/sdc1

现在,驱动器已准备就绪,可以处理数据。在这一点上,我希望您可以使用多系统来设置驱动器。

完成所有这些操作后…我们需要设置Grub2,显然,我们打算保留该配置。多系统可能具有从EFI引导的能力,但是无论如何,您都必须弄乱模块配置。

Grub2配置位于boot/grub/grub.cfg。您应该看到一些模块被注释掉了。我看过与GPT有关的内容,但对EFI不确定。我会进行一些测试,考虑阅读一些Grub2文档。

如果仍有问题,请回覆follow-up问题。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/9175.html,未经允许,请勿转载。