I believe many have heard of the (U) EFI interface, which is increasingly being found on PCs with Intel processors. Despite the fact that Intel likes to paint the benefits, booting through EFI has a significant drawback - installing some operating systems, including most Linux distributions (of which I know EFI out of the box has recently started to support only Ubuntu and its fork). In this post I will try to explain the “pitfalls” and their solution.
The essence of the problem
Actually, the subject:
Sony VAIO SV-E14A1S1R (
specifications )
Shortly before the acquisition, there was a desire to try some other distribution other than Xubuntu and the choice fell on Debian; in case of problems with the Internet, the repository was additionally downloaded (8 DVD).
')
So, there is a laptop, there are disks, we start ... And then the first problem arises: until I saw the boot option switch from EFI to the traditional “Legacy BIOS” in the BIOS settings, the installation menu did not appear and immediately loaded Windows.
However, after the installation was completed, I was greeted by the message “Operating system not found” (if you did not remove the distribution disk from the drive and select “Boot from the first boot disk,” the system would boot, but who would like to occupy the drive?), And with EFI only the vents were loaded.
Decision
After several unsuccessful install-reinstall cycles with different parameters, I stumbled upon a similar problem in one of the ENT themes, which the author of the topic, he said,
partially solved,
having collected GRUB on a virtual machine with EFI enabled (it is possible that you can do without a virtual machine and get to Debian, but I did not check).
Suppose that you already have an EFI partition on your hard disk, then we will need:
- Actually, a machine with a 64-bit Linux distribution and EFI (I used Ubuntu, launched from VirtualBox)
- GRUB2 sources (I took these , with the versions below, I simply did not intend the bootloader)
- make , gcc , bison and flex
Putting the EFI image of GRUB
- First we extract the source code:
$ wget ftp://alpha.gnu.org/gnu/grub/grub-1.99~rc2.tar.gz $ tar -xvf grub-1.99~rc2.tar.gz $ cd ./grub-1.99~rc2
- Compile bootloader:
$ ./configure --with-platform=efi --target=x86_64 $ make
After that, the directory will look something like this.
- Create an EFI image:
$ cd ./grub-core $ ../grub-mkimage -d . -o bootx64.efi -O x86_64-efi -p /efi/grub `find *.mod | xargs | sed -e 's/.mod//g'`
The first command is to go to the directory with the GRUB modules, the second one is to assemble the image, connecting all the modules in the directory to it.
- Moving the file to the EFI partition of the target computer (N is the index number of the partition)
- Transfer the module files (*. Mod), configuration file (grub.cfg), fonts (unicode.pf2) and, if necessary, language files and background image to the directory specified when building the image (in this case, / efi / grub)
Most likely, the grub.cfg generated during the installation will not work (it is unlikely that there will be instructions from the main disks like (hd0, gptN)), and it will be easier to take UUIDs from it and write a new one from the template. At the end of the article - an excerpt of my grub.cfg, which will help to understand.
If something went wrong, you can
remove grub.cfg from the EFI partition - GRUB will launch its command shell and you can try to load the OS from there and find the source of the problem.
If all is well, go on!
Finishing Touches: Adding Windows 7 to the Boot Menu
There is nothing difficult - we only need to know the UUID of the Windows disk and the path to the bootloader from Microsoft bootmgfw.efi (I had it located in the / EFI / Microsoft / Boot / directory)
And by analogy with the menu items for loading Linux, we create the corresponding item for loading Windows:
menuentry "Windows 7" { search --fs-uuid --no-floppy --set=root 48EC-30CC set root='(hd0,gpt3)' chainloader ($root)/efi/microsoft/boot/bootmgfw.efi boot }
Conclusion
I believe that this post will be useful to someone, since computers with EFI are becoming more and more, and I hardly found any information in RuNet.
Below I present a excerpt of grub.cfg and links to materials without which I would hardly have solved this problem:
Part of grub.cfg set root='(hd0,gpt3)' set locale_dir=/EFI/Boot/grub/locale set lang=en insmod gettext loadfont ($root)/EFI/grub/unicode.pf2 set timeout=10 set default=0 set gfxmode=640x480 set gfxpayload=keep terminal_output gfxterm insmod part_gpt insmod png background_image -m normal ($root)/EFI/grub/spacefun-grub.png set color_normal=light-gray/black set color_highlight=white/black insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 510c2ef3-0412-4d42-ba6b-15d1f680e150 menuentry 'Debian GNU/Linux, with Linux 3.5.3' --class debian --class gnu-linux --class gnu --class os { insmod part_gpt insmod ext2 set root='(hd0,gpt7)' search --no-floppy --fs-uuid --set=root 510c2ef3-0412-4d42-ba6b-15d1f680e150 echo 'Loading Linux 3.5.3 ...' linux /boot/vmlinuz-3.5.3 root=UUID=510c2ef3-0412-4d42-ba6b-15d1f680e150 ro quiet echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.5.3 }
LOR themegrub-efi article sectionUPD: Thank you very much for the comments and “easier options”! If there is more ─ do not hesitate and write: perhaps, make life easier for those who face my problem and do not want such red eyes.