Announcement

Collapse
No announcement yet.

UEFI Simplified, a quicker version

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UEFI Simplified, a quicker version

    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:

    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:

    --> 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

    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.


    [[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]] [[[[[[[[[[]]]]]]]]]]
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    #2
    One of these days I will read and understand all this because for some reason I want to know, but for now I am going to ask a probably really stupid question. How big do I make the ESP partition?

    Comment


      #3
      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
      I make mine 512 MB. Windows seems to make theirs as low as 100 MB. I've also seen 200 MB. Fact is, 100-200 MB is probably more than enough for most people who have just 1-10 OSs installed normally. BUT, if you choose to start installing kernels/initrds to the ESP (like if you do away with GRUB totally), then you need more space, of course.

      So, since disk sizes are so big and cheap these days, I always use 512 MB.
      But if you made yours 200 MB, you'd be fine. Even, maybe 100 MB, and you'd be fine.
      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

      Comment


        #4
        OK. Stupid question #2. I'm on Kubuntu 15.04, new hardware and perfectly happy with performance and features. But out of ignorance I installed with legacy boot. I know it really doesn't make any difference (at least under 2 TB), but what if I wanted to switch to UEFI? No Windows installed.

        Comment


          #5
          So I looked at your question more closely.

          I have one HDD, sda. And three ESPs (for messing/experimenting).

          ESP sda1 is for Kubuntu 14.04, 15.04, Mint KDE, Debian.
          ESP sda7 is for a Mint.
          ESP sda10 is for a Kubuntu 14.04.

          In Kubuntu 14.04 (which uses sda1 as ESP), I mounted the other two ESPs and ran df -hT to see space used:

          Code:
          df -hT
           Filesystem     Type      Size  [U][B]Used[/B][/U] Avail Use% Mounted on
           /dev/sda2      ext4       29G  6.0G   22G  22% /
           none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
           udev           devtmpfs  3.9G   12K  3.9G   1% /dev
           tmpfs          tmpfs     787M  1.3M  785M   1% /run
           none           tmpfs     5.0M     0  5.0M   0% /run/lock
           none           tmpfs     3.9G  360K  3.9G   1% /run/shm
           none           tmpfs     100M   20K  100M   1% /run/user
           [COLOR=#ff3333]/dev/sda1 [/COLOR]     vfat      500M   [B]16M[/B]  484M   [B]4%[/B] /boot/efi
           /dev/sda3      ext4       96G  7.3G   84G   8% /home
           [COLOR=#000000]/dev/sdb1 [/COLOR]     vfat      3.8G  311M  3.5G   9% /media/mike/C0A2-EEE4
           [COLOR=#ff3333]/dev/sda7 [/COLOR]     vfat      500M  [B]3.4M[/B]  496M   [B]1%[/B] /mnt/sda7
           [COLOR=#ff3333]/dev/sda10[/COLOR]     vfat      500M  [B]3.4M[/B]  496M   [B]1%[/B] /mnt/sda10

          So for six OSs (using 3 ESPs), only a total of 22.8 MB is used of the 3 ESPs. And you can see the percent used for each ESP: 4%, 1%, and 1% -- basically, nothing.


          (Note: I am NOT keeping kernels/initrds stored in the ESPs, as you might if you went GRUB-less and relied only on UEFI and/or rEFInd boot managers. I do use rEFInd, but I also keep GRUB working.)
          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

          Comment


            #6
            I installed with legacy boot. I know it really doesn't make any difference (at least under 2 TB), but what if I wanted to switch to UEFI?
            Then you ask Rod Smith :
            A BIOS to UEFI Transformation
            http://www.rodsbooks.com/bios2uefi/index.html

            In general, these things get screwy. It isn't so hard to convert a MBR to a GPT; but BIOS --> UEFI gets interesting. I have zero experience with it. Would be prone to totally re-install after totally re-doing the HDD (as a GPT with an ESP, then installing in UEFI mode, etc.).
            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

            Comment


              #7
              Originally posted by Qqmike View Post
              Then you ask Rod Smith :
              A BIOS to UEFI Transformation
              http://www.rodsbooks.com/bios2uefi/index.html

              In general, these things get screwy. It isn't so hard to convert a MBR to a GPT; but BIOS --> UEFI gets interesting. I have zero experience with it. Would be prone to totally re-install after totally re-doing the HDD (as a GPT with an ESP, then installing in UEFI mode, etc.).
              Thanks Qqmike. Re-install was my thought to (but now with a bit more knowledge/understanding). I'll review link.

              Comment


                #8
                You have no Windows, probably just the one OS, 15.04. Piece of cake to re-do it:

                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
                Configure UEFI firmware:
                Turn OFF Secure boot, turn off CSM, turn Off Fast Boot.

                Partitioning: include ESP: also easy, using GParted live from a CD or USB, my how-to on that:

                Installing Kubuntu -- Using the "Manual" Installation Type, with your own partitioning
                https://www.kubuntuforums.net/showth...l=1#post377688

                Basically, make a GPT (partition table, as explained in the link); make an ESP; make, as usual, / root, /home (if you use a separate /home), and swap.
                Then install Kubuntu 15.04 in UEFI mode (see the link for what that means or ask again).
                An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                Comment

                Working...
                X