2015-09-28

UEFI Simplified, a quicker version
https://www.kubuntuforums.net/showth...l=1#post379977

First, to be clear on something, my original UEFI for Kubuntu is this (May 28th):

UEFI for Kubuntu--simplified. And ... some dual-booting tips for Kubuntu
https://www.kubuntuforums.net/showth...l=1#post373198

The new version is this (a day ago):

UEFI Simplified, a quicker version
https://www.kubuntuforums.net/showth...l=1#post379977

The new version is shorter, more to the point, and omits some of the verbiage and graphics (text and quote boxes boxes, extra formatting, etc.). It is, largely, a re-write of the original. It includes the same topics, nothing is left out. Importantly, the Cheat Sheet is re-designed. The new Cheat Sheet is now appended to both versions of the how-to. To expedite things for your quick review, I've placed another copy of it below--but refer to the how-to's for the latest version of it, as changes are made occasionally.

In terms of word count, character count, with/without spaces, and page count, the new quicker version is approximately 50% as long as the original; but, again, they contain the same main topics. The new version is more focused, direct, to the point. You could use it, and refer to the original as needed. Experts or long-time Kubuntu users can safely stick with the quicker version (which has less hand-holding on things like using Konsole commands).

How the hell does this happen? ;)

Fact is, I wrote the lengthy GRUB Legacy how-to, as many of you know, 2009,

HOW TO: GRUB Methods - Toolkit
https://www.kubuntuforums.net/showth...ethods-Toolkit

Because of that, I felt an obligation to do the GRUB2 how-to when GRUB2 came on line (I really am not a fan of GRUB2, I'm just glad it works most of the time, you damn near have to be a programmer to understand it),

GRUB 2 A Guide for Users
https://www.kubuntuforums.net/showth...uide-for-Users

Because of that, I felt an obligation to try to update GRUB2 for EFI, and thus, there is

UEFI for Kubuntu--simplified. And ... some dual-booting tips for Kubuntu
https://www.kubuntuforums.net/showth...l=1#post373198

And because I feel that might be too much for people just wanting to get to the point, I wrote the new version of the above,

UEFI Simplified, a quicker version
https://www.kubuntuforums.net/showth...l=1#post379977

Fact is, most people don't need any of this. All they need is this:

Quote:

Use 64-bit Kubuntu

Configure your UEFI computer's firmware

Use GParted to do the partitioning and include an ESP (EFI System Partition)

Boot the Kubuntu installer in UEFI mode and install Kubuntu

and maybe the luxury of this insight for UEFI:

Quote:

--> Simple, conceptually: You install OSs as usual: root /, /home/swap. In addition, there is a UFI System Partition (ESP) where ALL the boot-loaders go for all your OSs. When you boot the computer, its firmware checks the ESP to see what to boot and how.

(I'm quoting myself here.)

(Technical note: If Windows UEFI is already installed, you can use its ESP and skip making your own in the partitioning step.)

Even if you dual-boot with other Linux OSs, you can probably just do it by common sense (see Methods #1, #2, #3 in the "UEFI Simplified, a quicker version."

If you enjoy learning this stuff, you will enjoy reading the how-to's as a starting point in your travels.

Or, if you have problems and need to trouble-shoot and therefore need some deeper understanding of the workings of UEFI+GPT, then these how-to's could come in real handy for you.

The how-to's will also be of interest to someone who wishes to play with and tweak and experiment with their system.

If you are dual-booting with Windows, let's face it, it will either be fairly straightforward, or it will be a headache. You know how to google. The big thing is to know how to re-install the Windows boot-loader, and there are references on that. But also, keep this in mind, my rescue how-to:

Using Your Live Kubuntu DVD/USB to Fix Things
https://www.kubuntuforums.net/showth...l=1#post379485

Quote:

Fortunately, you can make a rEFInd CD or USB flash drive in your live Kubuntu session, then re-boot using it, and from the rEFInd boot menu you will select what you wish to boot. After booting into your installed (broken) Kubuntu OS [or maybe even your Windows OS], you can ... [do whatever you want!] ...

The new Cheat Sheet (that goes with both how-to versions of UEFI) follows.

[[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]]

Cheat Sheet UEFI+GPT

Installing the OS in UEFI mode

Use 64-bit Kubuntu -- Configure UEFI firmware -- Partitioning: include ESP

Boot Kubuntu installer in UEFI mode and install Kubuntu

How will you know you are booting your OS in UEFI mode?

Run: sudo efibootmgr [-v]; /etc/fstab file contains an ESP; Open /boot/efi; /usr/lib/grub: x86_64.efi[-signed]? GRUB: grub-efi (not grub-pc); /sys/firmware/efi present? GPT?: sudo gdisk -l /dev/sdx

Important, useful commands

sudo efibootmgr [-v] (To check the UEFI firmware boot order)

sudo gdisk -l /dev/sdx (To check or fix the GPT)

df /boot/efi (To see the ESP sdxn, mounted as /boot/efi, used by the OS you are in now)

lsblk (To see sdxn: disks, partitions, mount points)

GUIDs: ls -l /dev/disk/by-partuuid/

UUIDs: ls -l /dev/disk/by-uuid/ ; or sudo blkid

To see ESP /boot/efi contents: tree /boot/efi; or Dolphin: open /boot/efi

gdisk: sudo gdisk -l /dev/sdx lists GPT partitions and ESPs with Code EF00

gdisk: interactively: sudo gdisk /dev/sdx, then ?, i, then partition #

inxi -Fxxx (Kubuntu, KDE versions; system information)

sudo dmidecode (BIOS/motherboard/system information)

Specialized commands

Change UEFI BootOrder: sudo efibootmgr -o 0003,0000,0002,0004, or sudo efibootmgr -o 3,0,2,4

Remove UEFI Boot variable BootXXX: sudo efibootmgr -b XXXX -B

Creating Boot entries, labels efibootmgr -c -L:

sudo efibootmgr -c -d /dev/sdx -p n -L NewLabel -l \\EFI\\<directory_current>\\<boot_loader>

grub-install: Separate /EFI subdirectories, /boot/efi/EFI/<some_name_for_LinuxX> :

sudo grub-install --bootloader-id=<some_name_for_LinuxX> --no-uefi-secure-boot

Bootable Kubuntu flash drive, using dd. If the flash drive is seen as /dev/sdX:

sudo dd if=/path/to/kubuntu_filename.iso of=/dev/sdX bs=16M

sync

ESP -- EFI System Partition

Specs: 100-512 MiB (prefer: 200 MiB-512 MiB); FAT32; GParted/libparted-based tools, set "boot" flag on ESP; CLI: partition type EF00

-- Mount point: /boot/efi. df /boot/efi shows the ESP the OS is using;
/etc/fstab:

# /boot/efi was on /dev/sda1 during installation

UUID=74D7-02F2 /boot/efi vfat defaults 0 1
-- Top-level directory of ESP: /boot/efi/EFI

-- Default boot-loader: /EFI/BOOT/bootx64.efi, mounted: /boot/efi/EFI/BOOT/bootx64.efi

-- See what's in your ESP: (1) Dolphin: /boot/efi. (2) CLI: cd /boot/efi, ls -l (3) tree /boot/efi

-- sudo gdisk -l /dev/sdx lists GPT partitions and ESP with Code EF00

GPT -- GUID Partition Table layout:

Protective MBR -- first 512 bytes (for BIOS/CSM/legacy-MBR compatibility)

Partition Table Header -- the next 512 bytes

The Partition Table entries (128 in this setup, each has 128 bytes).

The actual partitions (those listed in the Partition Table entries)

The end-of-disk backup to the Partition Table

The end-of-disk backup to the Partition Table Header called the Secondary Partition Table Header

All GPT partitions are at level of a primary partition, though not called primary; only partition with a boot flag is the ESP (it doesn't mean bootable; marks it as the, type EF00).

[Optional: Bios Boot partition, 1 MiB, no filesystem, flag: bios_grub; type EF02]

GRUB

Version: sudo grub-install -V; /usr/lib/grub; /boot/grub/grub.cfg; /etc/grub.d , /etc/default/grub;

UEFI: grubx64.efi in ESP /boot/efi/EFI/ubuntu (also shimx64.efi, grub.cfg, MokManager.efi)

Re-install while booted into Kubuntu: sudo grub-install; new boot menu: sudo update-grub

man page, grub-install: man grub-install

Boot managers: GRUB is a boot manager and boot-loader; so is rEFInd; UEFI is a boot manager.

Technical note: grub-install defaults to the standard ESP subdirectory (e.g., boot/efi/EFI/ubuntu). If dual-booting more than one Ubuntu-based OS, and you used the method "Separate EFI directories," then grub-install must be modified with --bootloader-id=some_name and --no-uefi-secure-boot.

Dual-booting Kubuntu: A summary of 5 options

3 facts: (1) GRUB from the last installed OS will take over the booting show. (2) All Ubuntu-based distributions use the (same) directory name ubuntu in the ESP: /boot/efi/EFI/ubuntu; the last installed will overwrite previous /EFI/ubuntu contents. Other non-Ubuntu OSs have their own /EFI subdirectory.

(3) The last-installed OS or boot manager becomes first in UEFI BootOrder.

--> Fix this using either efibootmgr -o; or if GRUB, using sudo grub-install (and sudo update-grub).

5 methods:

#1, #2, #3, do nothing special: (1) Use rEFInd. (2) Use GRUB2-EFI. (3) Use the UEFI firmware.

Or, try #4 or #5:

(4) Ubuntu-based OSs: set up separate subdirectories of EFI: /boot/efi/EFI/<some_ubuntu_distribution>

Set up the dual-boot: Both LinuxX and LinuxY are Ubuntu derivatives, using the same ESP.

Disable Secure Boot in firmware. Install LinuxX, boot into it, then:

Code:

sudo grub-install --bootloader-id=<some_name_for_LinuxX> --no-uefi-secure-boot

Repeat with LinuxY. Optional: adjust BootOrder and generate new boot menus.

(5) Separate ESPs:

GParted: set up the ESPs and the OS partitions you need, give each ESP a label you will recognize. Install each OS, in sequence, with this procedure: Turn off all ESPs (turn off their boot flags) except for the ESP you wish to be used by the OS you are about to install now. Install the OS installation using the Manual installation method. Repeat for each OS. Then turn on all ESPs (re-set their boot flags in GParted).

Labels: Setting labels for UEFI Boot variables--useful for "ubuntu" OSs

Fact: You can't edit or modify an existing boot entry. Instead, you must CREATE a new boot variable labeled whatever you wish. Then, if you wish, you can delete the old boot variable.
The setup: The UEFI boot variable BootXXXX uses ESP sdxn and the boot-loader file /EFI/<directory_current>/<boot_loader>. Goal: Change the label to NewLabel.
Solution

To create a new boot variable having the label NewLabel and pointing at the same ESP sdxn and same /EFI/<directory_current>/<boot_loader>, boot (in UEFI mode) the OS (represented by BootXXXX). Issue:

Code:

sudo efibootmgr -c -d /dev/sdx -p n -L NewLabel -l  \\EFI\\<directory_current>\\<boot_loader>

To delete the old boot variable (having the old label):

Code:

sudo efibootmgr -b XXXX -B

--> This deletes only the listing of the variable in UEFI firmware. It does not delete anything in the ESP or in the Linux filesystem. The output of efibootmgr -v is identical for both the old and the new boot variables: they point at the same /EFI/<directory_current>/<boot_loader>.
Updating GRUB2-EFI: Getting an update to GRUB or running sudo grub-install (which updates <boot_loader>) in this OS will not break either the new or the old boot variable.

[[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]]

Show more