How to install Stretch-live on a UEFI computer
Users with Win8/10 machines or new motherboards are familiar with the issues of UEFI, GRUB2 and Secure Boot. Here is a recipe for dealing with them.
1. At bootup, you need to access the UEFI setup menus. On old BIOS machines, you would see a message like "Press Del to enter setup". But Windows now has "Fast Startup" that hides these messages. So you need to know the "hot key" like F2 in advance. By pressing it repeatedly as the machine boots, you can get into the menus. Some
googling may yield the hot key for your particular machine.
If not, let Windows start, then find the back-door into the UEFI firmware settings. There are instructions
here and
here.
Hint: On most machines, click the On/Off icon, then shift-click on Restart. Select Troubleshooting > UEFI firmware settings > Restart.
2. Your first task in the UEFI setup is to disable Secure Boot. Most PC's have this option located somewhere in the menus. (It may be in a "Boot" submenu.) Then look for any Fast Boot options and disable them too. This will give you more time at bootup to press the hot key.
3. Note that we are leaving the machine as a UEFI boot device. We are NOT switching it back to "Legacy" or "CSM" mode. Any settings like Load Legacy Option ROM should (usually) be set to Disable.
4. If you are planning to dual-boot Windows, you MUST also disable its hibernation feature. Do this from within Windows - read
here.
Hint:
- Right-click the Start button. Select Command prompt (admin). Type: powercfg.exe /h off
- Right-click the Start button. Select Power options > Choose what power buttons do. Set "power button = shutdown".
- Confirm that there are NO options for hibernating.
5. Build a UEFI-bootable flash drive. You can do this from either Windows or Linux.
a. Get a flash drive formatted as FAT32.
b. Download the uefi-grub2.iso from
here.
c. Click on the file to mount it. Copy its contents onto the flash drive. There is a folder named EFI and three files.
d. Download a Stretch-live ISO and click-mount it. Copy the entire "live" folder onto the flash drive.
e. Also copy the whole ISO file onto the drive. You will need it to do a hard drive install.
6. Boot the flash drive.
a. Press the hot key to open the UEFI menus.
b. Locate the boot priority list and set USB first. If you cannot find the list, read the
Update below.
c. Save and exit.
7. With any luck, the flash drive should boot. There will be a brief menu about locating a grub.cfg file. For now, ignore it.
8. The main GRUB2 menu has two choices. Try "Porteus boot" first. If it fails with a "cheat code is incorrect" error, reboot and try "live-boot" instead.
9. Please note that neither of these boot setups allow for persistence - having a save file/folder on the USB drive. The intent is to do a frugal install onto the hard drive. You will need a Linux-compatible partition there.
a. Stretch-Live has Gparted in its Preferences menu. In my experience, you can safely shrink a Windows main C: partition by 10-20GB. Then make a new ext4 partition in the empty space. YMMV.
b. Your flash drive has the stretch-live-frugal-install tool. Read
here for instructions. Do a frugal install into the ext partition.
c. Run the GRUB2 converter tool to generate a menu entry for your frugal install.
10. You have two choices for how the system will boot:
a. Dual-boot with Windows. The safest procedure for Linux is to boot off the flash drive, then jump to the hard drive. Copy/paste the GRUB2 entry from above into your flash drive's grub.cfg. This will be a Porteus boot with a save folder in the ext partition.
Or add an entry like this to your flash drive's grub.cfg:
Code: Select all
menuentry "Hard drive installs" {
set root=(hd1,2)
configfile /grub2.txt
}
Also: See the example
here.
b. Scrap Windows and start an all-Linux system. Using Gparted, delete the Windows partitions. Make a FAT32 "UEFI boot" partition and one or more ext partitions. (If there is already a FAT32 partition, leave it but delete the contents.) Set up the boot partition for UEFI with the same content as your flash drive. See the
Update for how to replace the UEFI Windows boot entry with your own.
11. Is everything working? There may still be a small bug. If you re-boot off the flash drive, GRUB2 may find your hard drive's grub.cfg instead. Unlike Grub4Dos, GRUB2 searches all the available drives for a grub.cfg, NOT just the boot drive. At the brief initial menu, select "Manually specify location". In GRUB2 syntax, your flash drive will probably be drive 1, partition 1. Enter:
Update: Some UEFI setups don't have a conventional boot priority list. So you have to press another hot key like F12 in order to boot from USB.
This is awkward if you need to do it each time. Here is how to add a permanent USB boot option.
1. Press F2 and open the Boot section.
2. Select: File browser add boot entry
3. Select the cryptic entry that looks like your USB drive.
4. Drill down and select the file: EFI/boot/bootx64.efi
5. Name the entry: USB.
6. Select Boot Option #1 and set it to USB. Windows should become Option #2.
7. Save and reboot. If the USB drive is present, it will boot instead of Windows.
--------------------