Announcement

Collapse
No announcement yet.

UEFI, GPT, ESP, GRUB2-EFI, dual-booting, fixing things

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

    UEFI, GPT, ESP, GRUB2-EFI, dual-booting, fixing things

    UEFI, GPT, ESP, GRUB2-EFI, (dual)-booting, fixing things


    This is a how-to guide to using UEFI on your Kubuntu system.

    =====
    NEW:
    Dual booting two (or more) *ubuntu operating systems in UEFI mode -- 1 drive or 2 drives, 1 ESP or 2 ESPs
    https://www.kubuntuforums.net/forum/...-esp-or-2-esps
    =====

    Making Comments:
    Please post comments/questions in the regular kubuntuforums.net Forums. This thread is locked for now (to make way for possible additions later).

    Actually, the components of this how-to guide have been placed already in a very long thread I wrote called

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


    The problem--I feel--with this is that the GRUB 2 Guide has become too long, containing 148 posts (as of 4-2-18), it started out specifically as simply a guide on using GRUB2, NOT GRUB2-EFI, and there isn't a concise table of contents to individual UEFI topics in that thread. I'm posting this present how-to specifically as a how-to on UEFI and related topics for Kubuntu users. If that makes any sense.

    Following is a list of topics for Kubuntu users and links to how-to's I have written at kubuntuforums.net, along with brief comments on each topic.

    ----------

    GPT, UEFI -- Study Guide
    https://www.kubuntuforums.net/showth...l=1#post346604

    Introduces the subject of UEFI and GPT; how the older BIOS-MBR works compared to how the new UEFI-GPT works; the structure of the older MBR; structure of new GPT. Details of the GPT layout. Discussion of sector sizes. BIOS Boot Partition. Specs of the ESP. Details of Kubuntu forum discussions started by Steve Riley. And all the links you will ever need on UEFI and GPT and ESPs.

    ----------

    UEFI for Kubuntu--simplified. And ... some dual-booting tips for Kubuntu
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page13?p=373198&viewfull=1#post373198

    For a quicker version of this link, see below: UEFI Simplified, a quicker version.

    This article starts from scratch and explains UEFI and GPT, covering the following topics:
    Sections 1 and 2: GPT structure, the ESP, BIOS Boot Partition, installing Kubuntu in UEFI mode and partitioning, are you booting in UEFI mode?, do you have a GPT?.
    Section 3 covers everything about GRUB: where its files are located, how it places its files into the UEFI-ESP setup; [re-]installing GRUB; two important commands: grub-install and update-grub; the general form of the GRUB2-EFI commands:
    sudo grub-install --efi-directory=DIR --bootloader-id=some_name [--no-uefi-secure-boot] [--no-nvram]
    and, finally: Re-install GRUB2-EFI from Live DVD/USB flash drive.
    Section 4 covers rEFInd.
    Section 5: How your UEFI firmware works, the UEFI boot process, and the main tools you need: efibootmgr, gdisk, changing boot order, exploring your ESP, finding GUIDs and UUIDs, how do NVRAM variables get created?, default boot loader, and many more details about using UEFI--see the table of contents to Section 5 (in the link).

    Section 6: All about dual-booting, 5 ways to do it, how to fix it; creating separate EFI subdirectories for your (K)Ubuntu OSs (using --no-uefi-secure-boot option).; creating and using more than one ESP, changing labels on UEFI boot entries (useful for multiple "ubuntu" entries).

    Dual-Booting: A summary of Your Options

    Cheat Sheet

    ----------

    UEFI Simplified, a quicker version
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=379977&viewfull=1#post379977

    A quicker version of the above how-to "UEFI for Kubuntu--simplified.And ... some dual-booting tips for Kubuntu." This may include a few more advanced tips. Includes the Cheat Sheet at the end.

    ----------

    Dual-booting: How to Use Multiple ESPs
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users?p=376040&viewfull=1#post376040

    This material is incorporated into the above two how-to's: "UEFI for Kubuntu--simplified.And ... some dual-booting tips for Kubuntu" and "UEFI Simplified, a quicker version."

    ----------

    Labels on UEFI Boot Entries -- using efibootmgr -L
    How to "change" an "ubuntu" label (/EFI/ubuntu)

    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users?p=378229&viewfull=1#post378229

    Detailed treatment of using/changing labels you see in your UEFI firmware boot entires (in NVRAM and in output listing from efibootmgr). This is also the method used to create and register boot entires in your UEFI firmware.

    ----------

    A new PC build and Kubuntu-only UEFI installation
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page12?p=368216&viewfull=1#post368216

    A fairly detailed example of starting from scratch: building a PC, getting your Kubuntu installed in UEFI mode, and how to explore your UEFI setup (commands to use, places to look on your system, etc.).

    ----------

    Installing Kubuntu -- Using the "Manual" Installation Type, with your own partitioning
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page14?p=377688#post377688

    Contents:
    Installing GParted (gparted)
    Setting up your partitions using GParted
    Special steps for UEFI: ESP; creating GPT
    Ways to use your live Kubuntu DVD/USB
    Using the Manual installation method when installing Kubuntu


    ----------

    Building a Kubuntu live USB flash drive installer using dd
    https://www.kubuntuforums.net/showth...712#post378712


    This shows you an almost sure-fire way to build your live Kubuntu USB installer using the dd command, with references. And, related:

    dd: Showing the progress as dd executes
    https://www.kubuntuforums.net/showthread.php/27726-The-dd-Command/page2?p=395805#post395805

    ----------

    Using Your Live Kubuntu DVD/USB to Fix Things
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users?p=379485&viewfull=1#post379485

    Part 1:
    How can you use your live Kubuntu DVD or USB flash drive to fix things? Here are some tasks you can perform.
    Part 2:
    "Comments, Tips, some Details" are given next, including some links.
    Part 3:
    If you need some basics of using Kubuntu, see the section at the end called "Basic Tasks in Kubuntu."


    ----------

    Re-install GRUB2 from Live DVD/USB flash drive
    https://www.kubuntuforums.net/showth...l=1#post374017


    For UEFI systems, but notes also for BIOS-MBR systems.
    Re-install GRUB2-EFI from live DVD/USB using chroot.

    ----------

    Fix UEFI+GPT with Testdisk & gdisk -- Deleted partitions & damaged GPT structure
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page12?p=372417#post372417

    Summary
    For a UEFI+GPT setup, if you damaged your GPT structure, or if you accidentally lost/damaged your partitions, you may be able to use TestDisk and gdisk to recover. One goal here is to see how TestDisk worked on GPT. Good news: It recovers deleted partitions. But: I could not use TestDisk to repair either the Partition Header or the Partition Table entries. For those two tasks, I used gdisk. I did five experiments. There are references included along the way for everything.


    ----------

    Remove GRUB from UEFI -- Instead, use rEFInd and/or UEFI firmware boot menus
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=378317#post378317

    If you have not yet installed Kubuntu, see Case 1 (install without GRUB).
    If you have already installed Kubuntu the normal way (installing GRUB with it), see Case 2.
    Then after doing either Case 1 or Case 2, read the section "After you remove GRUB".


    ----------

    Boot Kubuntu Using UEFI Only -- no GRUB, no bootloader, no rEFInd, no other boot manager/loader
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=396271#post396271

    f you have a newer computer, say 2010 or later, and the computer's firmware is the newer UEFI (not the older BIOS), and your kernel is 3.3.0 or later, your EFI firmware may be able to boot the kernel directly using the stub-loader method.

    ----------

    rEFInd
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page12?p=372221&viewfull=1#post372221

    How to install rEFInd -- a boot manager and loader for booting Kubuntu and for managing the booting on your computer.

    ----------

    rEFInd: Make a live CD to boot into your system

    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page14?p=376838&viewfull=1#post376838

    ----------

    rEFInd: Make a live USB flash drive to boot into your system

    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=379352&viewfull=1#post379352

    ----------
    GRUB and GPT partitioned disks

    https://www.kubuntuforums.net/showth...l=1#post403281

    This how-to, by oshunluvr, shows you how to do this:

    On a system that is not UEFI,
    use the GPT partition table,
    and install GRUB (using a BIOS Boot Partition) to your GPT.



    ----------

    Dual Boot Your Existing Windows 8/10 with Kubuntu

    See Post #4 below in this thread -->

    --------------------
    --------------------
    --------------------

    ... and if you'd like to read my old GRUB 2 Guide in Greek, here it is:
    https://forum.ubuntu-gr.org/viewtopic.php?f=9&t=7278

    ... or if you need my original GRUB Legacy Toolkit (2007):
    https://www.kubuntuforums.net/showthread.php/18855-HOW-TO-GRUB-Methods-Toolkit
    Last edited by Qqmike; Oct 22, 2024, 04:43 PM.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    #2
    Btw, I know at least a few of you copied , saved, or printed the Cheat Sheets from either of these how-to's:

    UEFI for Kubuntu--simplified. And ... some dual-booting tips for Kubuntu
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page13?p=373198&viewfull=1#post373198

    UEFI Simplified, a quicker version
    https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=379977&viewfull=1#post379977

    You might want to check the edited Cheat Sheet (it is the same Cheat Sheet for both those two how-to's) as there have been some changes-improvements made.
    Last edited by Qqmike; Jul 02, 2018, 11:21 AM.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      In Post #1, I have added another topic and link, this one:

      GRUB and GPT partitioned disks

      https://www.kubuntuforums.net/showth...l=1#post403281

      This how-to, by oshunluvr, shows you how to do this:

      On a system that is not UEFI,
      use the GPT partition table,
      and install GRUB (using a BIOS Boot Partition) to your GPT.
      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

      Comment


        #4
        Dual Boot Your Existing Windows 8/10 with Kubuntu

        Dual Boot Your Existing Windows 8/10 with Kubuntu


        This is not meant to be an authoritative how-to because I am no longer very active with Windows OSs, only casually. I only intend to document how I did this. This should work on either a laptop or a desktop PC. I'm posting this as there have been questions from users about how to do this or what to be aware of.

        Quick Summary:

        Download Kubuntu, check the MD5sum or the SHA256sum, and burn your iso to a DVD or a USB flash drive.

        Test Kubuntu on your computer (run the live installer and click: "Try Kubuntu")

        Insert the Kubuntu USB flash drive.
        Boot into BIOS, Turn OFF Fast Boot. Make sure CSM is OFF.
        Boot into Kubuntu from your flash drive (choose to boot the UEFI USB from your Boot Override menu in BIOS), and click: Try Kubuntu.

        In this live session, use Muon Package Manager to install gparted.
        Run gparted to shrink the existing Windows partition.
        In the unallocated space, make your Kubuntu partitions for root /, /home, and swap.
        Exit gparted.

        Now it's time to install Kubuntu:
        Click Install Kubuntu.
        (If that won't work, then leave your Kubuntu USB flash drive in the machine, re-boot, enter BIOS, choose to boot the UEFI USB from your Boot Override menu, and boot into Kubuntu screen, click: Install Kubuntu.)

        At the installation type screen, choose Manual.

        And proceed to install Kubuntu as you usually do (important details are included below).

        If you want to change your computer's Boot Order (between Windows and Kubuntu and anything else you have), boot into BIOS and do so on the Boot menu.

        Done. Re-boot to test everything--make sure you can boot into all your operating systems; make sure Kubuntu boots as you want it to.

        - - - - - - - - - - - - - - - - - - - -

        Details

        Setup:
        Laptop: ASUS Q501LA, with Windows 10 installed. (Specs of this laptop are given at the end.)
        This laptop's firmware is UEFI; the laptop is a 2014 model.

        To do:
        Install Kubuntu to dual boot with Windows on this laptop.
        (I did this with Kubuntu 18.04.1, KDE Plasma 5.12 LTS)

        If you have already made your Kubuntu installer (USB flash drive or DVD), you can skip down to:
        "OK, so let's say you now have made a live Kubuntu installer USB flash drive."

        First download Kubuntu, check the MD5sum or the SHA256sum, and burn your iso to a DVD or a USB flash drive:

        Download Kubuntu 18.04.
        Start here: https://kubuntu.org/news/kubuntu-18-...been-released/
        Then click Download to get here: http://cdimage.ubuntu.com/kubuntu/re...ionic/release/
        For UEFI, newer machines, you want the 64-bit version.
        This page also gives you links to the checksums: MD5SUMS and SHA256SUMS.

        Check the iso, either using sha256sum or md5sum:
        Open Konsole, change directories to the folder where you downloaded the iso, say, Desktop or Downloads:
        Code:
        [SIZE=3]mike@mike-desktop:~$ cd Desktop[/SIZE]
        ,
        Or this:
        Code:
        mike@mike-desktop:~$ cd Downloads

        Check the md5sum:
        Code:
        [SIZE=3]mike@mike-desktop:~/Downloads$ md5sum kubuntu-18.04.1-desktop-amd64.iso[/SIZE]
         [SIZE=3]Output:[/SIZE]
         [SIZE=3]784e7b0ae5b996a58b25ceaa0dbdbac5  kubuntu-18.04.1-desktop-amd64.iso[/SIZE]
        Or, you could use the sha256sum:
        Code:
        [SIZE=3]mike@mike-desktop:~/Downloads$ sha256sum kubuntu-18.04.1-desktop-amd64.iso[/SIZE]
         [SIZE=3]d22271e7702d87eb856a83964c91be7a6f73af19b9f0b76ad35ab9f831c72c73  kubuntu-18.04.1-desktop-amd64.iso[/SIZE]

        K3b will also compute the MD5Sum for you: Just open k3b and navigate to your iso file.


        Burning the iso to a DVD
        You can use K3b in Kubuntu to burn the iso to a DVD. (K > Applications > Multimedia > K3b)
        More on burning: (BurningIsoHowTo):
        https://help.ubuntu.com/community/BurningIsoHowto

        Using the iso to make a live Kububtu flash drive (a live USB):
        I did this using the command dd at Konsole.
        Using dd to create a live Kubuntu Flash Drive:
        https://www.kubuntuforums.net/showth...712#post378712
        (where the flash drive is seen as /dev/sdb):

        Code:
        [SIZE=3]mike@mike-desktop:~$ sudo dd if=/home/mike/Downloads/kubuntu-18.04.1-desktop-amd64.iso of=/dev/sdb bs=16M && sync[/SIZE]
         [SIZE=3]112+1 records in[/SIZE]
         [SIZE=3]112+1 records out[/SIZE]
         [SIZE=3]1881014272 bytes (1.9 GB) copied, 229.184 s, 8.2 MB/s[/SIZE]
        More links on making a live USB installer:
        How to Create Ubuntu Live USB in Windows
        https://itsfoss.com/create-live-usb-...tu-in-windows/
        Installation From USB Stick:
        https://help.ubuntu.com/community/In...n/FromUSBStick
        Covers: Startup Disk Creator, Unetbootin, doing it from Mac or Windows, and UEFI.

        --------------------

        OK, so let's say you now have make a live Kubuntu installer USB flash drive.
        Here are the steps I used to prepare the laptop hard drive and install Kubuntu:

        Test Kubuntu on the laptop

        Run the live Kubuntu USB to see how it runs on the laptop:
        Turn on the laptop while holding down the f2 key to enter BIOS (on this ASUS laptop),
        In BIOS, Save & Exit: that's where the Boot Override menu is, choose the UEFI USB.
        This boots the flash drive into the live Kubuntu operating system.
        Click: Try Kubuntu.
        Now simply test Kubuntu by trying different things you need Kubuntu to do. Exs.: Wifi, sound, video, browsers, various apps you like, and so on. Take your time here. You may want to do this testing several times over several days.

        Prepare the BIOS

        Boot into the BIOS. For the ASUS: Go to Boot, turn off Fast Boot. And I left Secure Boot "On" as Windows uses Secure Boot (even though it is not needed for Kubuntu). If I have to, I can always turn it off later/someday. Make sure CSM is Off (or on "Auto").

        From this BIOS, I went to Save & Exit: that's where the Boot Override menu is, choose the UEFI USB.
        This boots the flash drive into the live Kubuntu operating system.

        Click: Try Kubuntu to get into a live Kubuntu session.

        Prepare the laptop hard drive for Kubuntu

        Again, get booted into a live Kubuntu session ("Try Kubuntu") using your USB flash drive installer (you may already be there if you followed the steps above under Prepare the BIOS).
        While in the live session, install the partitioning program called gparted (do this using Muon Package Manager: K > Applications > System > Muon). Then open gparted ( K > Applications > System > gparted), and run it to explore the partitions on the laptop's hard drive (mine was sda; my flash drive was sdb):

        sda1 ESP FAT32 100 MB System boot,esp
        sda2 Basic Data Partition ntfs 900 MB Recovery (hidden)
        sda3 MRP 128 MB "Unknown" Microsoft Reserved Partition
        sda4 Basic Data Partition ntfs 677 GB OS
        in sda4: used: 45 GB
        in sda4: unused: 632 GB
        sda5 Basic Data Partition ntfs 20 GB Restore (hidden)

        Windows is on sda4 for me. Shrink sda4 down to 300 GB. Let Kubuntu have the rest of sda4:
        Make the three partitions for Kubuntu, root, home, and swap:
        I made: / root 50 GB, /swap:15 GB, and /home "the rest of sda4."
        (I did not have to make a new or another ESP since Windows already made one (on sda1), and I can also use that same ESP as Windows is using (for its Windows Boot Loader).)

        So when I'm done partitioning, it looks like this:

        sda1 ESP FAT32 100 MB System boot,esp
        sda2 Basic Data Partition ntfs 900 MB Recovery (hidden)
        sda3 MRP 128 MB "Unknown" Microsoft Reserved Partition
        sda4 Basic Data Partition ntfs 293 GB OS
        sda5 Basic Data Partition ntfs 20 GB Restore (hidden)
        sda6 to be linux / root ext4 49 GB
        sda7 to be linux /swap swap 15 GB
        sda8 to be linux /home ext4 312 GB


        Now you are done using gparted in the live Kubuntu session, so close gparted now.


        Next:
        You are still in the live Kubuntu session. So you could click Install Kubuntu if you want to--try it if you are ready, and if it will work OK. (If you have a problem here, simply re-boot your laptop again, choosing to boot the UEFI USB, and get booted into the live Kubuntu session, and click on Install Kubuntu.

        At this point you simply install Kubuntu as you normally would, BUT ... remember to select the Manual method or the Manual partitioning method when you are prompted to make a choice. It should be the last of three or four choice in a list.


        Notes on the Manual installation

        I copied this from another how-to I wrote on using the Manual method to install Kubuntu. This may differ slightly from what you see on your screen(s), but you will get the right idea from this text:

        Installation Type screen: Select Manual.

        Prepare Partition screen (the left side bar may say "Disk Setup"):

        You will see a list of all your partitions, including those you created in GParted for Kubuntu.
        Highlight a partition you want to use (for example, for root / or for /home or for swap).
        Hit the Change button.
        You will see a menu called Edit Partition.
        New size: do not change what you did in GParted, leave it as it is.
        The "Use as" menu:
        Format partition: No, do not check this box -- leave the format as you did it in GParted.
        Mount point: Drop-down list: you will see /, /home, swap, etc. Choose one (/, /home, or swap).
        Hit the OK button.
        Repeat this by highlighting another partition you wish to use for Kubuntu (/, /home, swap) until you do all three partitions: root, home and swap.
        Bootloader:
        You may also see a choice where to install the bootloader (GRUB2). You can say sdX, where X is the drive you wish GRUB to go on; if you are using UEFI mode, it doesn't matter what you say here: GRUB will go to the ESP, usually sda1, automatically; thus, you can simply choose sda.

        You are done with this partitioning screen and you can continue the installation, or you can click Back; or Quit if you wish to NOT install Kubuntu at this time, or if you make any mistakes or are not sure about what you did, there is a button called "Undo all changes."

        So now at this point you can continue on with the installation by hitting the next or the continue button on the installation screen.


        Note about configuring Secure Boot
        I can't remember where, but at some point in the installation screens, there was a checkbox for "Configure Secure Boot." I did not check that box. But I think I should have. It didn't matter because later on in the process of installing and finishing, I saw another option to configure Grub-MAK-or some-such-thing, and I clicked that. I don't think this matters, frankly. I think the installer will see that Windows is present, it uses Secure Boot, and so you will get a version of GRUB that takes secure boot into account (perhaps with a helper file, like a shim loader or whatever). IMO, Not to worry. In fact, since you do have Windows already installed, when you see that checkbox for "Configure Secure Boot," go ahead and check it.

        Note about a glitch I encountered
        When the installation was done, you will eventually see a screen telling you to remove the installation media and re-boot. You should remove the USB flash drive and hit Enter. This did not result in a re-boot for me (on this laptop or on another PC I tried this with). So I just hit the hard re-boot button on the PC; on the laptop, I wasn't sure what to do, so I simply hit the Power button on the laptop keypad and turned the laptop off. Then I turned it back on ... keep reading ...


        So, you installed Kubuntu and now you are re-booting the laptop.


        Do you want to change to laptop's Boot Order?
        If so, get re-booted, Enter BIOS, find the Boot menu where you can indicate the Boot Order you want between Windows and (K)Ubuntu. Save your changes, exit BIOS, and continue booting the laptop (into either Windows or (K)Ubuntu).


        You should be Done now.

        ----------

        Another how-to on using the Manual method is my how-to here:
        Installing Kubuntu -- Using the "Manual" Installation Type, with your own partitioning
        https://www.kubuntuforums.net/showth...l=1#post377688

        ----------

        Laptop specs:
        Asus - 15.6" Touch-Screen Laptop - 8GB Memory - 750GB Hard Drive - Black
        Model: Q501LA-BSI5T19
        15.6" Touch
        4th Gen Intel® Core™ i5-4200U mobile processor
        8GB system memory
        1920 x 1080 resolution, IPS
        Intel® HD Graphics 4400
        750 GB HDD
        Built-in 10/100/1000 Mbps Fast Ethernet LAN (RJ-45 connector)
        3 - USB 3.0 ports
        Battery: 4 hr, 38 min
        1.0MP webcam with microphone
        Voice recognition
        media reader: Secure Digital, Secure Digital High Capacity, SDXC and MultiMediaCard memory card
        Next-Gen Intel® Wireless-AC connectivity
        --no cd/dvd --
        Last edited by Qqmike; Aug 07, 2018, 07:25 AM.
        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

        Comment


          #5
          I added a Quick Summary to Post #4 above -- it's at the front of the article.
          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