Announcement

Collapse
No announcement yet.

Dual booting two (or more) *ubuntu operating systems in UEFI mode -- 1 drive or 2 drives, 1 ESP or 2 ESPs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dual booting two (or more) *ubuntu operating systems in UEFI mode -- 1 drive or 2 drives, 1 ESP or 2 ESPs

    Dual booting two (or more) *ubuntu operating systems in UEFI mode -- 1 drive or 2 drives, 1 ESP or 2 ESPs

    This is not about Windows or non-*ubuntu's.
    This is about two or three Kubuntu's installed to 1 or 2 disks, including a SATA SSD and a PCIe M.2.
    It is also about the folder /boot/efi/EFI/ubuntu that holds the UEFI boot files for *ubuntu in the ESP.
    Here, I use only Kubuntu OSs to demonstrate. It should work for all *ubuntu OSs.
    This is also a beginner's guide to feeling more comfortable with your UEFI-BIOS firmware.

    This is written in a narrative, tutorial style. If you want it quick and dirty, try my how-to's:
    UEFI, GPT, ESP, GRUB2-EFI, dual-booting, fixing things
    https://www.kubuntuforums.net/forum/...-fixing-things
    Specifically, UEFI Simplified, a quicker version,
    https://www.kubuntuforums.net/forum/...820#post545820

    Comment Dual-booting depends a lot on the OS (operating system) and the computer's firmware. The *ubuntu OSs are not difficult -- EXCEPT for one thing in the ESP! (... more later) Your firmware may or may not be user-friendly. Mine is an ASUS motherboard -- one of the best for managing UEFI. But do not be discouraged because somebody somewhere probably has worked through every configuration you can think of. Start here if you have some OS- or PC-specific issue, like Windows or Macs: Rod Smith, Managing EFI Boot Loaders for Linux (see References at the end).

    Appendix Actually 12 appendices following the text. I included lots of details that might help beginners formulate their strategies. Intermediate users might find some useful material.

    References I put them at the end after the Appendix. Includes UEFI how-to's.

    The focus here is on how to boot and maintain the dual boot setup. And nuances of the way UEFI handles the *ubuntu distros in the ESP. I intentionally included a lot details. I did this for people who are really trying to learn this material and see examples of the output from the commands.​

    Table of Contents

    SECTION 1 Dual booting two OSs on the SSD with one ESP
    SECTION 2 Using two ESPs on one disk drive
    SECTION 3 Labels and NVRAM boot variables
    -- Changing labels of NVRAM boot variables in the efibootmgr list
    -- Creating NVRAM boot variables (to appear in UEFI-BIOS boot menus)
    -- sudo efibootmgr -c -d /dev/sdx -p n -L NewLabel -l \\EFI\\<directory_current>\\<boot_loader>
    SECTION 4 Creating separate NVRAM variables for two *ubuntu OSs
    -- sudo grub-install --bootloader-id=<some_name_for_the_OS> --no-uefi-secure-boot
    SECTION 5 Installing an SSD M.2 as a second drive -- using the disk name nvme_n_p_
    SECTION 6 Install Kubuntu 24.04 to the M.2 as a third OS (so, 2 drives, 3 OSs, 1 ESP)
    SECTION 7 Three OSs on two drives using an ESP on each drive (so, 2 drives, 3 OSs, 2 ESPs)
    SECTION 8 Concluding comment, and surviving (GRUB2) updates​

    APPENDIX

    Table of Contents
    1 -- Summary of key commands and some facts
    2 -- ESP -- how big?
    3 -- Partitioning with GParted
    4 -- Getting the new Kubuntu 24.04
    5 -- Making the live USB Kubuntu installer
    6 -- Experimenting -- accessing the ESP
    7 -- rEFInd
    8 -- Make a rEFInd flash drive
    9 -- How to re-enable os-prober so you can use the GRUB command update-grub
    10 -- The /boot/efi/EFI/ubuntu directory: An IMPORTANT fact about it
    11 -- Installing OSs to a system with two or more ESPs -- Calamares installer and another trick.
    12 -- How to boot into an operating system if it is no longer set as 'first in boot order'

    Start out with a basic setup -->​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 1 Dual booting two OSs on the SSD with one ESP
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    Current setup: Kubuntu 22.04 is already installed
    I'll start with my current setup, which is very basic: Kubuntu 22.04 is on the (SATA) SSD. Let's install Kubuntu 24.04.1 to the available space at the end of that disk.

    Motherboard. ASUS Prime Z590-P. Disk: Samsung 870 EVO 500GB 2.5 Inch SATA III SSD.
    Partitions:
    sda1 ESP (fat32) (200MiB) <-- See Appendix note on ESP--how big? (Answer: maybe should be 550 MiB)
    sda2 Kubuntu 22.04 root (/) partition (ext4) (46 GiB)
    sda3 /home (ext4) (186 GiB)
    sda4 swap (60 GiB ~ 2 x RAM, an old rule of thumb, my RAM is 32 GB)​

    The next step: Install another version of Kubuntu: 24.04.1

    You can use GParted to make a partition sda5 for Kubuntu 24.04.1. It can use the swap partition I already have. I did not make a separate /home partition for 24.04, but you could do that, too. Download the iso file for 24.04.1. Check the checksum. Then make a bootable USB flash drive for it (using the Konsole command "dd"). Appendix 2, 3, 4, and 5, for details on everything I just mentioned.

    (Optional details you can skip) To run the Kubuntu USB flash drive installer:
    Plug it into your machine. Re-boot. During the POST you must enter your computer's UEFI-BIOS by pressing a key (different on different machines; mine is F2). If you miss it, re-boot again (and maybe at POST press your magic key repeatedly). Now you are in UEFI-BIOS. Look for a Boot menu, or Boot Override menu. Find your UEFI USB listed and click on it to boot it. Your machine should then boot up to your Kubuntu screen saying Try or Install Kubuntu. Click install. Fill in the data. I chose a basic/normal installation. For partitioning, choose the Manual method. You will see the partitions. Highlight sda5, then Edit, then mount as / (root). To use the existing ESP on sda1, highlight it, click Edit, choose Keep (do not click Format), mount point should be set to /boot/efi, and Boot flag set on sda1.​

    Now we have two Kubuntu's installed on the SSD -- 22.04 & 24.04. How does it look?

    The two OSs share the same ESP (sda1, mounted at /boot/efi). You can boot into either OS and issue this command at Konsole to see the ESP that OS is using: df /boot/efi.

    K24.04 took over the booting.
    I had already installed K22.04 and then installed K24.04. So now when I re-boot the PC, it boots into K24.04 instead of K22.04. However, in doing so, the GRUB2 boot menu from K24.04 shows an option to boot into K22.04, so that is one way I could boot into K22.04.​

    rEFInd -- a boot manager and a boot loader (by stub loading).
    Another way to manage dual-booting (or multi-booting) is to use the boot manager by Rod Smith, called rEFInd. Piece of cake. See Appendix 7 and 8, and References at the end. I installed rEFInd in K22.04. I also made a rEFInd USB flash drive.

    How do you boot rEFInd?
    1 From your OS, re-boot. If you set rEFInd to boot FIRST, then it will come up. If rEFInd is not set to boot first, then when you re-boot, at the POST screen, press the magic key to enter your UEFI-BIOS, and from a Boot menu there you can select-click rEFInd, and it will boot.
    2 If you made a rEFInd USB flash drive, plug it into to your PC, re-boot, enter your UEFI-BIOS, and select your UEFI USB rEFInd to boot.

    So, what does rEFInd show you? A bunch of things. Of interest to us here are just the following. There is an icon for each option, use arrow keys to see descriptions. If you click one, rEFInd will take you there.
    Options of interest:
    1 Boot EFI\ubuntu\grubx64.efi from 196 MiB FAT volume => the ESP at sda1, and it points at the new 24.04.
    2 Boot \vmlinuz-5.15.0-122-generic from 46 GiB ext4 volume => the Kubuntu 22.04 root filesystem on sda2.
    3 Boot \vmlinuz-6.8.0-41-generic from K2404onSSD-sda5 => that's the 100 GiB root filesystem sda5 for the new Kubuntu 24.04 (with the Label K2404onSSD-sda5 that I set on that partition in GParted when I made the partition).
    --> Click on any one of those three options and rEFInd will boot to it.​

    Tip: Using labels
    Notice the 2nd option. I happen to know what it is ( K22.04 root filesystem on sda2). Whereas, see option 3, the K24.04 on sda5 where I set a label that clearly identifies it. To set a label on a partition, use GParted (from a live USB session or from another OS because the partition must be unmounted and you can not unmount it if you are in it). Highlight the partition, click the Partition tab at the top of screen, select Label (filesystem), and type your Label.

    What if you can't identify the choice you want in the rEFInd menu? Guess at it, and click it, see what happens. Keep guessing until you are able to get it and memorize it (or start using labels on your partitions/boot options, and ESPs).​

    Changing the boot order
    If you want the K22.04 to boot first when you start or re-boot your PC, do this:
    Boot into K22.04 (by rEFInd or from the GRUB2 boot menu of K24.04).
    Open Konsole. Type this command and press Enter:
    sudo grub-install​

    --> So, NOW, K22.04 is the last *ubuntu OS installed
    But now, how do you boot into K24.04? You can use rEFInd when you re-boot the PC (enter UEFI-BIOS to select rEFInd to boot). You can also make sure that the GRUB2 boot menu from your K22.04 contains an entry for booting into K24.04, by doing this:
    Re-enable os-prober. First, for some esoteric security reasons, you must re-enable something on your PC that scans your system for other OSs to boot. Do it as follows:
    Boot into K22.04.
    Open this file (using Kate): /etc/default/grub.
    (Open Konsole, type kate /etc/default/grub. Or navigate to /etc/default/grub and double-click to open it.)
    Add this line to the file: GRUB_DISABLE_OS_PROBER=false
    Save and close Kate.
    Open Konsole, and type this command, then press Enter:
    sudo update-grub
    After it executes, there will be a boot entry for K24.04 in your K22.04 GRUB2 boot menu.

    Let's look at the ESP and check the firmware

    efibootmgr -- your main tool for seeing how your firmware sees things

    To see how your UEFI firmware sees things, use this command at Konsole: sudo efibootmgr -v.
    I ran that before installing K24.04, with just K22.04 present on my system:

    sudo efibootmgr -v

    BootCurrent: 0000
    Timeout: 1 seconds
    BootOrder: 0000,0005,0001,0002,0003,0004
    Boot0000* ubuntu HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\ubuntu\shimx64.efi)
    Boot0001* UEFI: USB, Partition 2 PciRoot(0x0)/Pci(0x14,0x0)/USB(22,0)/HD(2,GPT,e7e777e5-ba64-4290-a759-837b96feb4ed,0x7023fc,0x2130)..BO
    Boot0002* UEFI:CD/DVD Drive BBS(129,,0x0)
    Boot0003* UEFI:Removable Device BBS(130,,0x0)
    Boot0004* UEFI:Network Device BBS(131,,0x0)
    Boot0005* rEFInd Boot Manager HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\refind\refind_x64.efi)​

    The entries "BootXXXX" are called NVRAM (boot) variables (nonvolatile random access memory). The only entries of interest are Boot 0000: Kubuntu 22.04, Boot0005: rEFInd. The other entries represent things that are not relevant to us here; or things from the past (that may or may not even exist now); or esoteric options the firmware picks up. In future output, I will omit that stuff in this text.

    Boot0000* ubuntu HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\ubuntu\shimx64.efi):
    Note that "ubuntu" refers to my Kubuntu 22.04. HD = Hard drive, partition 1, on a GPT disk, so it is sda1, and cfc63277-3e31-4939-bde9-db4429f4fa77 is the GUID of the partition sda1. This tells you the path to the (GRUB2) bootloader file in the ESP that will boot the Kubuntu 22.04 OS.
    File(\EFI\ubuntu\shimx64.efi). Since the ESP is mounted at /boot/efi (in the Kubuntu 22.04 OS), the full path to the boot file is /boot/efi/EFI/ubuntu/shimx64.efi. UEFI uses back slashes; Linux uses forward slashes.
    That GUID can help you identify the partition when it is not obvious to you. To see UUIDs and GUIDs, simply run (at Konsole): sudo blkid.​

    sudo efibootmgr -- After installing K24.04, and after re-installing GRUB2 to K22.04 so it boots first:
    It looks the same as before! Because we re-installed K22.04 (after installing K24.04).

    There is no UEFI boot variable entry for the new K24.04 OS we installed.

    Changing the boot order in UEFI firmware: sudo efibootmgr -o {list the boot order}
    Example: To make rEFInd first in boot order and K22.04 second, run this command (in Konsole):
    sudo efibootmgr -o 0005,0000,0006,0001,0002,0003

    An advantage of using rEFInd is that you don't have to perform the tricks to enter UEFI-BIOS firmware boot menu(s) each time you boot up. rEFInd will boot right up and show you a boot menu to choose from.​

    What does the ESP look like as far as Kubuntu goes?
    ESP = EFI System Partition. Let's assume you have only one ESP on your PC. The ESP is the partition that contains ALL the boot loaders for all the OSs on your PC. It is FAT32, size can be small (like 550 MiB -- See Appendix 2), and the "boot" flag is set on it (along with, sometimes, the "esp" flag -- these flags can be set in GParted or KDE Partition Manager).

    How to see what's in the ESP? If you have root privileges, you can simply open /boot/efi/EFI in your file manager. Unfortunately, that has been hard to do with Dolphin. See Appendix 6 for some options.
    One way, quite simply is to issue (at Konsole) this command:
    tree /boot/efi
    It shows you the folders and files in /boot/efi. You will see ubuntu: /boot/efi/EFI/ubuntu, and some boot loader files there.​

    --> Here is the problem: There is only one such folder, it is not called Kubuntu, it is used for ALL *ubuntu OSs on your system (e.g., Mint, Ubuntu), and, obviously, it holds boot information for just one such OS. That's why when we run efibootmgr, we see an entry for 22.04 now but no entry for 24.04 (or for Mint, etc. if we had such OSs installed) -- just one boot variable. The boot loader files in boot/efi/EFI/ubutnu are those for only the last *ubuntu OS that was installed (or re-installed as we did with K22.04). In our example, there is only ONE boot variable (NVRAM variable) in UEFI firmware for *ubuntu distros, and it is for the last *ubuntu OS installed/re-installed on the PC (and it over-wrote any previous *ubuntu OS that was there). Remember, we have only one ESP here.

    By the way, rEFInd will have its own boot file in the ESP: /boot/efi/EFI/refind.​

    Let's summarize what we've got so far.
    One (SATA SSD) disk on the PC, one ESP (= sda1). The PC had K22.04 on it. The PC would boot into it naturally, no problem. K22.04 was represented in the ESP (in /boot/efi/EFI/ubuntu) and the UEFI firmware could see it and had a NVRAM boot variable for it. (You can see it, too, with sudo efibootmgr -v) Then we installed a second OS, K24.04, on the same SSD as K22.04. Since it was installed last, it became the first to boot, it was represented in the ESP at /boot/efi/EFI/ubuntu -- over-writing the boot data from K22.04. We can deal with this in a couple ways:

    (1) Live with it. If we want one of the two OSs to be first in boot order, we boot into it and run the command sudo grub-install, and that OS will take over the booting, and it will have an entry for the other OS on its boot menu that we see when the PC boots up. Really not a problem. (To get that boot entry, we might need to run sudo update-grub in the OSs, AFTER re-enabling os-prober -- See Appendix 9).
    In this experiment, we chose the first option: we booted into K22.04 and re-installed it with sudo grub-install, making K22.04 first in boot order.

    (2) Install rEFInd as the boot manager. Using efibootmgr -o we can set it as first in the boot order. When we re-boot or boot up, rEFInd will appear and show a boot menu containing, along with many things, both OSs, K22.04 and K.24.04 (it helps us interpret that menu if we assign labels (in GParted) to each of the root partitions of those two OSs).

    (See Appendix 1, Summary of Key Commands)​

    End of story? For many users, Yes.
    But what if for some reason you want each OS boot loader to appear distinctly and separately in its own ESP boot file? That would help you identify them if you are using your UEFI-BIOS firmware boot menu(s) to boot from. It would certainly be very clear as entries in rEFInd's boot menu. It would even serve as a back-up of the boot files of the two OSs. For whatever reasons you may have, you can always use two (or more) ESPs. Let's do it to demonstrate the mechanics.​

    = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 2 Using two ESPs on one disk drive
    = = = = = = = = = = = = = = = = = = = = = = = = =

    Building two ESPs on the (SATA) SSD, using a different ESP for each OS
    Start over: We've got the one disk, SSD, with only K22.04 installed (root (/) is sda2), and it uses the ESP at sda1. Recall the original setup looks like this: sda1 ESP, sda2 Kubuntu 22.04 root (/), sda3 /home, sda4 swap.
    Use GParted to make another ESP at sda5, make a partition sda6 for 24.04 and install K24.04 to it using the ESP at sda5. ESP at sda5: 550 MiB, FAT32, set the boot flag on it, and I set a Label as ESP2-2404 so we can recognize it easily. sda6: 100 MiB for K24.04 (root (/) and home.
    So, after K24.04 is installed into sda6, we boot into it, and check, Is the new OS K24.04 actually using the new (and second) ESP on sda5? Yes:​

    df /boot/efi
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda5 562068 7932 554136 2% /boot/efi​

    Does the firmware see both OSs (the ESPs sda1 & sda5) and rEFInd (installed to sda1 ESP)? Yes, and note that K24.04 is set to boot first in boot order (see the HD(5,GPT,...)) -- the "5" is partition 5 = sda5 ESP. rEFInd is second in boot order. K22.04 is third in boot order. The NVRAM variable Boot0006 represents Kubuntu 22.04 with its boot files in its ESP (HD(1,GPT ... ) represents partition 1 = sda1: The /EFI/ubuntu is the default boot folder for *ubuntu OSs, and that's where the boot files of K22.04 were installed, and we didn't mess with it.
    sudo efibootmgr -v
    BootCurrent: 0000
    Timeout: 1 seconds
    BootOrder: 0000,0005,0006
    Boot0000* Ubuntu HD(5,GPT,0140ff60-4455-4398-8801-023ca5418719,0x24943800,0x113000)/File(\EFI\UBUNTU\SHIMX64.EFI)
    Boot0005* rEFInd Boot Manager HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\REFIND\REFIND_X64.EFI)
    Boot0006* ubuntu HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\UBUNTU\SHIMX64.EFI)

    And we can boot rEFInd and see that it includes boot options for both K22.04 and K24.04.​

    Boot into 24.04 and see the ESP using the command: tree /boot/efi.
    We can set the firmware to boot K22.04 first (if you want to do that). We'll set K22.04 first, rEFInd second, and K24.04 third:

    sudo efibootmgr -o 0006,0005,0000
    BootCurrent: 0005
    Timeout: 1 seconds
    BootOrder: 0006,0005,0000
    Boot0000* Ubuntu
    Boot0005* rEFInd Boot Manager
    Boot0006* ubuntu​

    How to select the ESP when installing Kubuntu
    For installing Kubuntu to your PC, Kubuntu uses the Calamares installer. It allows you to specify the ESP you wish to use for installing Kubuntu's UEFI GRUB2 boot files. If your installer does not have this feature, there are tricks to get the job done. See the Appendix 11 titled "Installing OSs to a system with two or more ESPs -- Calamares installer and another trick."​

    Summary of SECTION 2: What controls the booting?
    We now are dual-booting two versions of Kubuntu, 22.04 on sda2 and 24.04 on sda6. Each has its own ESP, on sda1 and sda5, respectively. The ESP of each OS appears clearly in the UEFI-BIOS firmware boot menus and in the rEFInd boot menu. It is true, though, that the OS installed last will control the booting. Also, whenever, for any reason (perhaps intentionally or even when the GRUB2 package is updated), grub-install is run from one of the OSs, then it will control the booting. In each OS, it is important to re-enable os-prober (see SECTION 1 or Appendix 9) and run sudo update-grub. In that way, each OS will include the other OSs in its GRUB2 boot menu. Using two ESPs is a "clean" option, and it's easy to understand.​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 3
    -- Changing labels of NVRAM boot variables in the efibootmgr list
    -- Creating NVRAM boot variables (that will appear in UEFI-BIOS boot menus)
    -- sudo efibootmgr -c -d /dev/sdx -p n -L NewLabel -l \\EFI\\<directory_current>\\<boot_loader>

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    In the last example (refer to it in SECTION 2, at sudo efibootmgr -v), note that we have two *ubuntu labels in the boot variable list: Ubuntu and ubuntu. We know that the first, Ubuntu, is K24.04, and the second, ubuntu, is K22.04 (check the GUIDs using sudo blkid; also note the partitions 1 and 5 in the output of efibootmgr -v). There is a way to change those names or labels, so you can easily recognize them. Let's do it now for the K22.04 label "ubuntu." We'll change it to K2204-sda1. We must first boot into the OS whose label we want to change. (I am already there, in K22.04). Here's the command to do it for our example:

    sudo efibootmgr -c -d /dev/sda -p 1 -L K2204-sda1 -l \\EFI\\ubuntu\\grubx64.efi
    BootCurrent: 0005
    Timeout: 1 seconds
    BootOrder: 0001,0006,0005,0000
    Boot0000* Ubuntu
    Boot0005* rEFInd Boot Manager
    Boot0006* ubuntu
    Boot0001* K2204-sda1

    The printed listing is automatic after executing the command, and it shows our new boot variable Boot0001 K2204-sda1, and it is first in boot order.
    We could also do this for K24.04 in the sda6 partition (using the ESP on sda5) -- we must first boot into K24.04 to do it, and use the same general command, like this:
    sudo efibootmgr -c -d /dev/sda -p 5 -L K2404-sda5 -l \\EFI\\Ubuntu\\grubx64.efi
    (note the "5" and the capitalized "Ubuntu")
    (We are not actually going to do it right now for this example.)​

    How do we know that "grubx64.efi" is the bootloader for K22.04 and K24.04? Well, grubx64.efi is THE GRUB2 bootloader! And we can see that both OSs have it in their ESPs when we run the command 'tree /boot/efi' (run this by first booting into each OS and then open Konsole and run it).

    The general case

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

    Key point: This actually creates (-c) a new NVRAM variable in the ESP /dev/sdx (partition number n: -p n), and it registers that NVRAM variable with the UEFI firmware.
    It points at the same boot files as does the ubuntu NVRAM variable 'ubuntu' (i.e., /EFI/ubuntu/grubx64.efi). L is the new label you wish to use. -l indicates the path to the boot loader.
    --> So, now, there are two ways -- two NVRAM variables -- to boot into K22.04: using ubuntu and using K2204-sda1. They are duplicates except for the label. You can delete the old one easily. For example, to delete the entry: Boot0006* ubuntu HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\UBUNTU\SHIMX64.EFI), do this:

    sudo efibootmgr -b 0006 -B
    BootCurrent: 0006
    Timeout: 1 seconds
    BootOrder: 0001,0005,0000
    Boot0000* Ubuntu
    Boot0001* K2204-sda1
    Boot0005* rEFInd Boot Manager

    This does NOT delete any NVRAM boot files in the ESP sda1! It ONLY removes the label 'ubuntu' from the listing in efibootmgr. For all of this stuff, see my UEFI how-to's in the References (if you wish).​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 4 Creating separate NVRAM variables for two *ubuntu OSs
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    sudo grub-install --bootloader-id=<some_name_for_the_OS> --no-uefi-secure-boot

    Technical note
    See Appendix 10 topic titled: The /boot/efi/EFI/ubuntu directory: An IMPORTANT fact about it
    This concerns a quirk of how *ubuntu OSs are set up in UEFI. Because of nuances/requirements of 'secure boot,' a pointer to the configuration file (.cfg) for GRUB2 is hard-coded in the GRUB bootloader executable grubx64.efi. The command you will learn in this section contains the option --no-uefi-secure-boot, and this is the reason for it.​

    NVRAM variables for two *ubuntu OSs

    Let's go back to the original setup. The one, single ESP is sda1. K22.04 is on sda2 (the root (/) partition). Then we install another Kubuntu 24.04 on sda5 ((/) partition). In the ESP, they share the /EFI/ubuntu folder but in this sense: Only the last Kubuntu installed can have its boot files there. So, if we installed K24.04 secondly, then only its GRUB2 boot files are in /EFI/ubuntu. That's how things work. But what if for some reason you want both OS boot loaders to appear distinctly and separately in the same ESP but under their own EFI folder, like /boot/efi/EFI/K2204 and /boot/efi/EFI/K2404, while there may still be a folder /boot/efi/EFI/ubuntu that holds the last Kubuntu GRUB2 boot files you installed. And each OS is to be 'registered' with the UEFI firmware with its own NVRAM boot variable (and, therefore, appear distinctly in the listing of sudo efibootmgr -v and in your UEFI-BIOS firmware boot lists). This is also one way to ensure a backup of your OS boot files. Here's a way to do it.​

    --> Again, start from the beginning.
    -- Secure boot is disabled in UEFI firmware. (I made sure of that.)
    -- We already installed the first Kubuntu OS, K22.04. (Thus, /boot/efi/EFI/ubuntu contains the GRUB boot files of K22.04.)
    -- While we are in K22.04, we re-install it using a special GRUB command and a distinct name, like this:
    sudo grub-install --bootloader-id=K2204ESPsda1 --no-uefi-secure-boot
    (I made up the name 'K2204ESPsda1', but you can make up any name. So we just created a new NVRAM variable for K22.04: /boot/efi/EFI/K2204ESPsda1, and it is registered with the UEFI firmware.)
    -- Install the second Kubuntu OS, K24.04, on sda5. (Or, maybe it is already installed.)
    (Thus, /boot/efi/EFI/ubuntu now contains the GRUB boot files of K24.04 -- over-writing the files of K22.04 that were there. But we still have the new NVRAM variable we created for K22.04, namely /boot/efi/EFI/K2204ESPsda1.)
    -- Boot into the second OS, K24.04. Create a new NVRAM variable for K24.04: /boot/efi/EFI/K2404ESPsda1, registered with the UEFI firmware. Again, I just made up the name K2404ESPsda1. Do so as follows:
    sudo grub-install --bootloader-id=K2404ESPsda1 --no-uefi-secure-boot
    -- Because we just ran grub-install for K24.04, it will boot first in the boot order. If you prefer that K22.04 boots first, boot into K22.04 and run the basic command: sudo grub-install (i.e., no parameters).
    -- You're done.
    -- TECHNICAL NOTE
    We'll look at what we have, but first one more technical note that might be of interest to some users:
    Two disks? Put the 2nd OS on the 2nd disk? Do the same thing. Just know that both OSs will use the same ESP located on the first disk. No problem except if you remove or radically change that 1st disk, it may mess up the booting of your 2nd OS.
    Two disks, two ESPs? Yes, you can do that, no problem. See the Appendix 11 topic titled "Installing OSs to a system with two or more ESPs -- Calamares installer and another trick."​

    Checking what you did
    You created two UEFI boot folders on your system: /boot/efi/EFI/K2204ESPsda1 and /boot/efi/EFI/K2404ESPsda1. They will (or 'should') show up in several ways:
    -- when you re-boot and enter your UEFI firmware boot menus;
    -- when you run the command tree /boot/efi;
    -- when you re-boot or boot into rEFInd, you will see boot options for the two new NVRAM variables;
    -- when you open /boot/efi/EFI, you will see the folders /K2204ESPsda1 and /K2404ESPsda1.
    --> Note that you will still see a "normal" folder for ubuntu, /boot/efi/EFI/ubuntu, and it will (always) contain the boot files for the most recently installed *ubuntu OS.

    Fixing something ...
    It may not always go as expected! On one of my (many) experiments, on the ASUS Prime Z590-P, the newly created NVRAM variable represented by /boot/efi/EFI/K2404ESPsda1 either did not show up! or it showed up as 'Ubuntu' (in efibootmgr output) but with the correct path (to /boot/efi/EFI/K2404ESPsda1). The name should have been 'EFI/K2404ESPsda1.' I fixed this by hitting it again with a command that creates NVRAM variables. It's the same command we used above to create labels. For the experiment, it was
    sudo efibootmgr -c -d /dev/sda -p 1 -L K2404ESPsda1 -l \\EFI\\K2404ESPsda1\\grubx64.efi
    and that worked to fix the issue. (By the way, grubx64.efi is the bootloader file, and I found it by opening /EFI/K2404ESPsda1 in Dolphin; or you could see it listed if you run the command 'tree' at Konsole.)​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 5 Installing an SSD M.2 as a second drive -- using the disk name nvme_n_p_
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    SSD = solid state device, used as a 'drive.' It is a nonvolatile memory (i.e., it doesn't require power to maintain the data on it). Two popular form factors (or connectors) are the standard 2.5-inch rectangular box-like form that fits into a drive bay or otherwise screws onto a plate on your PC case. The other form factor is the M.2, it looks like a big stick of gum with integrated chips, contacts, and a label. There are SATA SSDs and PCIe SSDs.
    My first time to use an M.2. ( $44 for this, Oct. 2024: Crucial P3 Plus PCIe 4.0NVMe M.2 SSD 500GB)
    Installation is not difficult. The mobo, the M.2 product, and on-line guides all tell how. PC Magazine has an excellent how-to that covers all cases of SSDs, see the References.
    After installing an M.2, check that it is actually recognized by your system. Open GParted or KDE Partition Manager and check.​

    PCIe SSDs: Naming drives and partitions nvme = non-volatile memory express
    It shows up in GParted and KDE Partition Manager as /dev/nvme0n1. If I put a partition on it, that partition will be named nvme0n1p1. Devices (i.e., "drives") are numbered starting from 0, nvme0, and a device/drive is often referenced as a device controller number, in this case it is zero; "namespaces" ("n") are numbered from 1: nvme0n1; partitions ("p") are numbered from 1: nvme0n1p1. A namespace is a (separate) range of logical block addresses. Thus, nvme0n1 is a separate thing from nvme0n2. Most users would only ever have one namespace on an M.2, thus nvme0n1. If you had two M.2's, it would be nvme0n1 and nvme1n1. A third M.2 would be nvme2n1. And so on. The naming of the devices (drives), the first number following nvme_, can change depending on the physical layout of the computer. For this reason, it is a good idea to go by the device UUID or partition UUID, PARTUUID, or GUID. In fact, a good idea is to use labels. (The order of partitions "p" will NOT change because it comes from the partition table.)​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 6 Install Kubuntu 24.04 to the M.2 as a third OS (so, 2 drives, 3 OSs, 1 ESP)
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    Start with this: one (SATA) SSD, an ESP on it, and two OSs (K22.04 and 24.04):
    sda1=ESP; sda2="/" of K22.04; sda3=/home of K22.04; sda4=swap; sda5="/" of K24.04.
    Then: Partition the M.2.
    Then install K24.04 to that partition on M.2

    (Optional reading, details: We can use GParted to put a partition on the M.2 (nvme0n1) and install K24.04 to that partition. First, open GParted, highlight the M.2 (/dev/nvme0n1), click Device tab (at the top) to create a partition table, select type gpt (GPT) from the drop-down menu. Click the check mark to apply that change. Next, put a 100GiB partition on it: Click Partition tab (at top), New, Size 100000MiB, Create as Primary Partition, Filesystem ext4, Label M2-K2404, Click the check mark to apply that change, then GParted tab > Quit. That completes the partitioning of the M.2. Then:
    Re-boot the PC with the K24.04 USB installer plugged in, press the key to enter UEFI-BIOS, boot to the Kubuntu installer screen, select Install Kubuntu.
    The Kubuntu Installer, a few notes ...
    Partitions -> Manual partitioning. Highlight /dev/nvme0n1p1. Click Edit: Content is Keep; it sees the ext4; Mount point is /; it sees the FS Label (filesystem label) I had set (using GParted): M2-K2404. You also need to specify the ESP you want to use for the UEFI boot files of the new K24.04: Top of screen > Storage device > SSD, highlight sda1 (the ESP on the SATA SSD that we've been using), click Edit, then Content: Keep, Mount point: /boot/efi (from the drop-down list), I set a FS Label, too: ESPonSSD, and Flags: boot. THEN press Next.)​

    The new K24.04 (on the M.2) will boot up, and we want to check everything.

    The GRUB2 boot menu (black screen with white letters) from the new K24.04 shows all options: K22.04 (sda2, SSD), K24.04 (from sda5, SSD -- it will be listed at the top, as Kubuntu), and rEFInd. Boot into the new K24.04 (on M.2), take all updates. And keep checking stuff:

    Konsole command df /boot/efi shows the ESP for K24.04 on nvme0n1p1 to be sda1 (on the SSD). The tree command correctly shows ALL the boot folders we did in the previous experiment for rEFInd, K22.04 and K24.04 (both on the SSD), PLUS it shows /boot/efi/EFI/ubuntu which we know NOW contains the several GRUB2 boot files for the new K24.04 on nvme0n1p1, including grubx64.efi and shimx64.efi. The new K24.04 overwrote whatever was in there from the last *ubuntu that resided there (it was actually K24.04 on sda5 on the SSD). Then we run (in Konsole) efibootmgr -v to see that the new boot order is:
    New K24.04 (on M.2) -- K24.04 on sda5 -- K22.04 on sda1 -- rEFInd
    --> they ALL have their UEFI boot files on the same ESP at sda1 (= HD, partition 1, GUID = cfc63277-3e31-4939-bde9-db4429f4fa77, in various folders /boot/efi/EFI/...

    If interested, here it is (comments are preceded by a #):
    sudo efibootmgr -v #I've simplified the output
    BootCurrent: 0007
    Timeout: 1 seconds
    BootOrder: 0007,0000,0002,0005,0001,0003,0004
    Boot0000* K2404-Test HD(1,GPT,cfc63277-3e31-4939-bde9-
    db4429f4fa77,0x800,0x64000)/File(\EFI\K2404TEST\GRUBX64.EFI) #K24.04 on sda5
    Boot0002* K2204ESPsda1 HD(1,GPT,cfc63277-3e31-4939-bde9-
    db4429f4fa77,0x800,0x64000)/File(\EFI\K2204ESPSDA1\GRUBX64.EFI) #K22.04 on sda2
    Boot0005* rEFInd Boot Manager #on ESP sda1
    Boot0007* Ubuntu HD(1,GPT,cfc63277-3e31-4939-bde9-
    db4429f4fa77,0x800,0x64000)/File(\EFI\UBUNTU\SHIMX64.EFI) #New K24.04 on the M.2​

    I also checked to see what sudo blkid shows as the partitions (simplified):

    sudo blkid
    /dev/nvme0n1p1: LABEL="M2-K2204" UUID="a66bd095-b50a-42a4-8db8-
    227f8b7c5f98" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="406b2a89-320f-43b3-b6ac-96573c604b7a"
    /dev/sda4: TYPE="swap"
    /dev/sda2: LABEL="K2202onSSD-sda2"
    /dev/sda5: LABEL="K2404sda5"
    /dev/sda3: etc etc ... #this is my /home partition for the K22.04
    /dev/sda1: # this is the ESP on sda1
    ... then lots of Loop devices ...

    Finally, for now, we re-boot the PC to see what the UEFI-BIOS firmware shows for boot options and priorities. It's all there! The boot priorities match what we just said. The boot override menu gives several options: rEFInd, K22.04 ESPsda1, and K24.04 sda5 on the SSD.
    From the boot override menu, I clicked to boot into my "regular" OS, K22.04 on sda2 of the SSD.

    SECTION 6 Summary and comment about options
    There were no surprises (other than maybe the strange naming system for M.2's!) We have three operating systems on two drives (a PCIe M.2 and a SATA SSD), all using the same ESP located at sda1 (on the SSD). All the techniques/options we described in previous sections apply here. We'll do one more configuration, Section 7.​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 7 Three OSs on two drives using an ESP on each drive
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    Just as the section title says. Let's do the M.2 again, building an ESP on it, making a partition for an OS, and and installing a new K24.04 to it.
    Specifically, use GParted to do the necessary partitions:

    nvme0n1p1 = ESP
    (Details, again: size 550 MiB (see Appendix 2), FAT32, Label M2ESP, and after GParted creates it, set the boot flag (and esp flag) on it (from Partition > Manage flags).)
    Finally, the K24.04 OS partitions on M.2:
    nvme0n1p1 ESP (Label: ESPonM2)
    nvme0n1p2 K22.04 ("/") (Label: M2K2404root)
    nvme0n1p3 K22.04 (/home) (Label: M2K2404home)
    nvme0n1p4 K22.04 swap

    When installing K24.04, you must specify the ESP partition that the Calamares installer is to use for that OS. We discussed that in Section 6. Also, See Appendix 11.

    From the new K24.04 on the M.2, df /boot/efi shows that the ESP used by the OS is, in fact, the first partition of the M.2, nvme0n1p1:
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/nvme0n1p1 562080 7932 554148 2% /boot/efi​

    From sudo efibootmgr -v, we see that K24.04 (Boot0007) on the M.2 is first in boot order; K24.04 on the SSD (Boot0000) is second (we labeled it "K2404-Test"); K22.04 (Boot0002) on sda2 is third (labeled K2204ESPsda1); and rEFInd is forth. (I omitted several NVRAM boot variables that weren't relevant.)

    BootCurrent: 0007
    Timeout: 1 seconds
    BootOrder: 0007,0000,0002,0005
    Boot0000* K2404-Test HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\K2404TEST\GRUBX64.EFI)
    Boot0002* K2204ESPsda1 HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\K2204ESPSDA1\GRUBX64.EFI)
    Boot0005* rEFInd Boot Manager HD(1,GPT,cfc63277-3e31-4939-bde9-db4429f4fa77,0x800,0x64000)/File(\EFI\REFIND\REFIND_X64.EFI)
    Boot0007* Ubuntu HD(1,GPT,d33d3163-6bb0-4611-bc65-ba9eeb8f9436,0x800,0x113000)/File(\EFI\UBUNTU\SHIMX64.EFI)

    Check sudo blkid, if you wish -- it "checks out," too:​

    $ blkid
    /dev/nvme0n1p3: LABEL="M2K2404home" UUID="5843be61-201b-4e6e-883d-b6cfea6ffee6" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="f460a278-a8b2-4ff3-892e-f2fe5bccfb62"
    /dev/nvme0n1p1: LABEL_FATBOOT="M2ESP" LABEL="M2ESP" UUID="9454-0DA0" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="d33d3163-6bb0-4611-bc65-ba9eeb8f9436"
    /dev/nvme0n1p4: UUID="2e99ece9-0ed3-40c1-bcfc-7bee00e9622b" TYPE="swap" PARTUUID="08fe4833-f8a9-4da8-8eb3-000963062c05"
    /dev/nvme0n1p2: LABEL="M2K2404root" UUID="f898b89a-bf4d-4df3-a00b-429c7077b451" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6a346d3e-4fae-4d24-94e6-61e62ac6fc24"

    /dev/sda4: UUID="f89d9771-3986-4851-9e93-a162c181f3e1" TYPE="swap" PARTUUID="b0cb2dbb-9956-439c-b0be-f79553903c2a"
    /dev/sda2: LABEL="K2202onSSD-sda2" UUID="7b6a2e52-93ec-4544-ad02-0e0aae1210e5" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="8be5b232-4878-4a1d-b4f1-3405f54d6a76"
    /dev/sda5: LABEL="K2404sda5" UUID="3c36b610-78db-4342-8ec9-323533a25dc9" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="f5ea1118-8a2f-4353-87bd-30e9ddd3d8c1"
    /dev/sda3: UUID="8c11c33a-1e01-4f8b-814e-de4441c019db" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="81566d30-f0e8-40b0-a0a4-4c37c025af3f"
    /dev/sda1: UUID="8CC0-BC7E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="cfc63277-3e31-4939-bde9-db4429f4fa77"​

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    SECTION 8 Concluding comment, and surviving updates
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    You can use exactly what we did here to build your own configurations. The basic tools you need are in the above sections.

    There is the issue of surviving GRUB2 updates. Every time you get an update, the command grub-install is run (by the update process). When that happens, the OS getting the GRUB2 update will become first in boot order. In my opinion, you just have to accept this and deal with it. It's not that difficult. And "dealing" with it helps to keep your skills up to date, too.

    As a practical matter, what would you do? If your favorite OS was first in boot order, but it became second in boot order following some GRUB2 update, well, ...

    -- Simply boot into your favorite OS and issue the command, sudo grub-install (which will also automatically run update-grub to update the boot menu from that OS).
    -- Make sure you can boot your main OS from the other OSs on your PC. Specifically, in each OS, run sudo update-grub to update the GRUB2 boot menu from that OS. To do this, you may have to re-enable os-prober -- see Appendix 9.
    -- Use UEFI firmware boot menus to select your OS if it has a separate NVRAM variable and appears in the list.
    -- Use rEFInd, again by re-starting the PC and booting into UEFI firmware, and selecting rEFInd from a boot menu. Boot your OS from the boot menu of rEFInd.
    -- Boot your PC with your rEFInd USB flash drive and select an OS to boot from the rEFInd menu.
    -- What if you had set rEFInd to be first in boot order, to control all the booting on your PC? So it was your default boot manager. Then somehow it was no longer first in boot order. Then one thing you can do is simply re-install it (to your ESP): sudo refind-install. You can issue that from any OS where you downloaded the rEFInd files. See Appendix 7.
    -- You can re-install rEFInd from your rEFInd USB flash drive.
    -- You can use efibootmgr -o to adjust the boot order of your OSs and rEFInd. This is a good example of why you might want to make separate boot variables for your favorite/main OS, perhaps using good labels that you will recognize.

    --> For more ideas, and other special options, Rod Smith's page on it: The rEFInd Boot Manager: Keeping rEFInd Booting (see References at the end). Some of the tools there may apply generally to various OSs.​

    --> Rod Smith examines the option to remove GRUB2 (totally). Pro's and con's.
    I have tried that, it works, but not without some quirks -- the details are in one of the my how-to's listed in the References ("UEFI, GPT, ESP, GRUB2-EFI, dual-booting, fixing things").

    ======================================
    APPENDIX

    Table of Contents

    1 -- Summary of key commands and some facts
    2 -- ESP -- how big?
    3 -- Partitioning with GParted
    4 -- Getting the new Kubuntu 24.04
    5 -- Making the live USB Kubuntu installer
    6 -- Experimenting -- accessing the ESP
    7 -- rEFInd
    8 -- Make a rEFInd flash drive
    9 -- How to re-enable os-prober so you can use the GRUB command update-grub
    10 -- The /boot/efi/EFI/ubuntu directory: An IMPORTANT fact about it
    11 -- Installing OSs to a system with two or more ESPs -- Calamares installer and another trick.
    12 -- How to boot into an operating system if it is no longer set as 'first in boot order'​

    1 -- Summary of key commands and some facts

    blkid sudo blkid -- shows you the UUIDs and GUIDs on your system, helping you to identify disks and partitions.
    /boot/efi/EFI/ -- your ESP is mounted (in your OS) at /boot/efi; /EFI/ is the top-level directory(folder) of the ESP which contains the UEFI boot loaders of all OSs using that ESP.
    df /boot/efi -- shows you the ESP partition the OS is using (the OS that you are currently booted into).
    efibootmgr -- show the UEFI NVRAM boot variables in your firmware; use with sudo; use with -v for details.
    efibootmgr -b 0006 -B -- this deletes the NVRAM boot variable 0006 from the UEFI list shown by efibootmgr. It does NOT actually delete any boot files in your ESP. Always use sudo when you run efibootmgr.
    efibootmgr -o -- to change the boot order of the boot variables. After the -o, list the preferred order of the boot
    variables, like this: sudo efibootmgr -o XXXX,XXXX,XXXX,etc -- separated by commas, no spaces.
    efibootmgr -c -d /dev/sdx -p n -L NewLabel -l \\EFI\\<directory_current>\\<boot_loader> -- to create a new NVRAM boot variable in UEFI firmware. Also used to change a label of a NVRAM boot variable listed in the output of efibootmgr -v. /dev/sdx is the ESP drive; n is the partition number of the ESP partition; NewLabel is the name for the NVRAM variable that you'll see in list); \\EFI\\<directory_current>\\<boot_loader> is the path to the bootloader this NVRAM boot variable represents.
    grub-install -- installs GRUB2 to the UEFI firmware, creates a NVRAM variable for the GRUB2 (of the OS you are booted in when you run grub-install); run with sudo.
    sudo grub-install --bootloader-id=<some_name_for_the_OS> --no-uefi-secure-boot -- issue this inside the OS you wish to create a new NVRAM boot variable for. The command will create a NVRAM boot variable for the OS, named <some_name_for_the_OS> (without the < >), in a system where you don't mind turning off secure boot. After issuing the command, the OS will be listed first in UEFI boot order.
    tree -- run it like this: tree /efi/boot -- to see what's in your ESP
    update-grub -- updates the GRUB menu (of the OS you are in when you issue the command); use with sudo​

    2 -- ESP -- how big? From Rod Smith: 550MiB (~ 577 MB)
    ESP = EFI System Partition. It holds all the boot files for your PC.
    "... some EFIs have bugs that cause problems with FAT32 ESPs that are under 512MiB (537MB) in size.
    adding a margin of safety to protect against MiB/MB confusion and rounding errors, I recommend creating an ESP that's at least 550MiB in size ..."
    EFI Disk Structures: https://www.rodsbooks.com/efi-bootloaders/principles.html​

    As of October 2024, the Kubuntu installer (called Calamares) recommends 300 MiB.
    Of course, we have all memorized this conversion:
    1 Mebibyte is equal to (220 / 106) megabytes. There are 1.048576 megabytes in a Mebibyte.

    3 -- Partitioning with GParted. gparted = GParted Partition Editor. Get it:
    1. From Discover; or:
    2. Using the command line. Open Konsole, type this and press Enter: sudo apt-get install gparted
    In Kubuntu, find it here: K > System > GParted
    Options: You can use KDE Partition Manager (from K > System > KDE Partition Manager). You could also do the partitioning live from your Kubuntu USB installer ("Try Kubuntu") using either GParted or KDE PM; or you could do it while installing Kubuntu during the Manual installation steps -- I don't recommend that unless you are good at it.​

    4 -- Getting the new Kubuntu 24.04.1
    Download: https://kubuntu.org/getkubuntu/ Contains a link to checksums and alternative downloads.
    Includes upgrading from 22.04 or 23.10 -- Detailed upgrade instructions.
    Or, for download and checksums, look here: http://cdimage.ubuntu.com/kubuntu/re...24.04/release/
    Release Notes: https://wiki.ubuntu.com/NobleNumbat/...eNotes/Kubuntu
    Checksums: https://kubuntu.org/alternative-downloads/
    -> how-to check it: https://help.ubuntu.com/community/HowToSHA256SUM
    The checksum for the file I need (kubuntu-24.04.1-desktop-amd64.iso) is: a828578f407471a69d13c0caa7cc0d4013f5b9f672de069e80 17163d13695c3c
    The file I downloaded to my Desktop directory: kubuntu-24.04.1-desktop-amd64.iso.
    So, open Konsole and change directory by typing:
    cd Downloads [then press Enter]
    Type:
    sha256sum kubuntu-24.04.1-desktop-amd64.iso # then press Enter
    Output:
    a828578f407471a69d13c0caa7cc0d4013f5b9f672de069e80 17163d13695c3c kubuntu-24.04.1-desktop-amd64.iso
    and I see it matches perfectly with the SHA256SUM I found at Checksums: https://kubuntu.org/alternative-downloads/. It means the iso file is good.​

    5 -- Making the live USB Kubuntu installer
    I will use the command named "dd." If you prefer to use a packaged program, post the question at Kubuntu for latest suggestions. My how-to on using command dd to make your USB flash drive installer: see References.
    Here goes ...
    Take a USB flash drive. Make sure it is empty and formatted FAT32. Plug it in to your computer. Now open either KDE Partition Manager (Start > System > KDE Partition Manager) or K > System > GParted (if you have it installed). IMPORTANT: Look at your partition manager to see what your flash drive is named. In KDE PM, see left side panel. In GParted, see the drop-down list at the right. Mine shows my existing (installed) Kubuntu is using /dev/sda, and the flash drive is /dev/sdb. Do NOT make a mistake here! Click on the correct entry (sdb, for me).

    About dd
    General form of the command you need: sudo dd if=/path/to/iso of=/dev/sdX bs=16M
    if = input file; of = output file; /dev/sdX is the device notation for your USB flash drive as seen from your operating system, mine is sdb. /path/to/iso is the path to where you have downloaded your Kubuntu iso file.
    bs is block size; (you may also try using bs=4M or bs=8M)

    For my example, /path/to/iso is /home/mike/Downloads/kubuntu-24.04.1-desktop-amd64.iso,
    and /dev/sdX is /dev/sdb
    Open Konsole again (or maybe it is still open), and type your command, like this:
    sudo dd if=/home/mike/Downloads/kubuntu-24.04.1-desktop-amd64.iso of=/dev/sdb bs=16M
    Let it run, it may take awhile, do not mess with it until it finishes.
    CAUTION: On some computers, the writing may go super fast, like seconds, and you get some output in Konsole showing details. But then when you click the Safely Remove option to remove the flash drive, it takes a long time to let you do so (because that's when the actual writing is taking place). Let it finish. Then * safely * eject your flash drive.
    NOTE: At Konsole, if you wish, you can change directories until you get into your Downloads at your /home directory. Many ways to do it. My example: At Konsole, type: cd /home/mike/Downloads . Or, cd ~/Downloads, where ~ is the same as /home/mike. After you are in the Downloads directory, the dd command will look like this (for our example here): sudo dd if= kubuntu-24.04.1-desktop-amd64.iso of=/dev/sdb bs=16M
    --> See the reference (below): The dd Command.​

    6 -- Experimenting -- accessing the ESP
    I really like to be able to get into my ESP without hassle or too much thinking. It requires root privileges to do so. One way to get total privileges is to change the /etc/fstab file to read this way (note the umask):
    # /boot/efi was on /dev/sda1 during installation
    UUID=8CC0-BC7E /boot/efi vfat umask=0000 0 1
    How to access your ESP (as root) is a separate subject we won't get into here. (Try Krusader, Tools > root; etc.)
    Another way to see the contents of the ESP: the tree command, like this: tree /boot/efi.​

    7 -- rEFInd, as of October 2024, from Rod Smith's website, this also installs it to your computer:
    Rod Smith created a rEFInd PPA for Ubuntu. To use it, open a Terminal and type the following commands:
    sudo apt-add-repository ppa:rodsmith/refind
    sudo apt update
    sudo apt install refind

    (Rod Smith: You'll be asked whether to install rEFInd to the ESP when you first install it. Say, Yes. Thereafter, the rEFInd version will update along with your other software. This package is built with GNU-EFI and is not signed with a Secure Boot key; however, the install script should sign the binary with a locally-generated key if it detects that your system uses Secure Boot. Thus, if you've previously installed one of my binaries on a Secure Boot system and added its key as a MOK, you'll have to add your local key when you reboot.
    My package files install the rEFInd binaries to /usr/share/refind, the documentation to /usr/share/doc/refind, and a few miscellaneous files elsewhere. Upon installation, the package runs the refind-install script to copy the files to the ESP. This enables you to re-install rEFInd after the fact by running refind-install, should some other tool or OS wipe the ESP or should the installation go awry. In such cases you can use refind-install or install manually.)
    rEFInd files: binaries at: usr/share/refind; documentation at: /usr/share/doc/refind
    Configuration: /boot/efi/EFI/refind/refind.conf

    --> rEFInd is now installed and is listed (in the UEFI firmware) to boot first.
    --> To change the boot order back again (to ubuntu), do something like this:
    sudo efibootmgr -o 0000,0005,0001,0002,0003,0004
    BootCurrent: 0000
    Timeout: 1 seconds
    BootOrder: 0000,0005,0001,0002,0003,0004
    Boot0000* ubuntu
    Boot0001* UEFI: USB, Partition 2
    Boot0002* UEFI:CD/DVD Drive
    Boot0003* UEFI:Removable Device
    Boot0004* UEFI:Network Device
    Boot0005* rEFInd Boot Manager​

    8 -- Make a rEFInd flash drive: from the rEFInd download, find the .img file (it is like an .iso file), then:
    sudo dd if=/home/mike/Downloads/rEFInd_USB/refind-flashdrive-0.14.2/refind-flashdrive-0.14.2.img of=/dev/sdb
    14976+0 records in
    14976+0 records out
    7667712 bytes (7.7 MB, 7.3 MiB) copied, 3.17208 s, 2.4 MB/s
    (If necessary, see my how-to in the References)

    9 -- How to re-enable os-prober so you can use the GRUB command update-grub
    Open this file (using Kate): /etc/default/grub.
    Add this line to the file: GRUB_DISABLE_OS_PROBER=false
    Save and close Kate.
    Open Konsole, and type this command, then press Enter:
    sudo update-grub
    The update-grub command is also used to ensure that your OS GRUB2 menu contains an entry to boot into your other OSs at boot time.​

    10-- The /boot/efi/EFI/ubuntu directory: An IMPORTANT fact about it
    In Section 4, we used this command:
    sudo grub-install --bootloader-id=<some_name_for_the_OS> --no-uefi-secure-boot
    to create two separate OS folders in /EFI and separate NVRAM variables for two Kubuntu (*ubuntu) OSs.

    The directory /boot/efi/EFI/ubuntu ALWAYS contains the boot files for the last *ubuntu OS you installed. The .efi executable GRUB2 bootloader is grubx64.efi. It will access a GRUB configuration file (grub.cfg) that points at a *ubuntu root file system that GRUB2 will boot from.
    --> The location of that full GRUB installation is hard-coded into the GRUB bootloader, i.e., into: grubx64.efi.
    It shouldn't be, but it is. The reason comes from having to satisfy secure boot capability. So, let's say you run this command:
    sudo grub-install --bootloader-id=<some_name_for_the_OS>
    You will create a boot folder in the ESP: /EFI/<some_name_for_the_OS>, and it will contain the GRUB bootloader grubx64.efi, BUT the installation (the OS partition) GRUB will use to boot from is hard-coded into grubx64.efi , and that location is the root file system of the last *ubuntu OS you installed. It will boot that last OS, not the OS you intended to boot (that you named 'some_name_for_the_OS'). That is why, in your grub-install command, you must use the option '--no-uefi-secure-boot.' I think I explained it as well as my reference, but if you are technically interested, see:
    https://blog.lxgr.net/posts/2015/04/...efi-multiboot/

    Related fact about the GRUB2 bootloader grubx64.efi:
    In the text example, we created two folders in the ESP: /boot/efi/EFI/K2204ESPsda1 and /boot/efi/EFI/K2404ESPsda1. They each contain just one file! The GRUB2 bootloader grubx64.efi.
    In the first folder, for K22.04, the location of the 22.04 root filesystem is hard-coded in the grubx64.efi.
    In the second folder, for K24.04, the location of the 24.04 root filesystem is hard-coded in the grubx64.efi.
    In the standard, default *ubuntu folder, /boot/efi/EFI/ubuntu, there several files including grubx64.efi and a shim .efi file that handles the authentication for secure boot; and, as we've said, the location of the root OS of the last installed *ubuntu is hard-coded in the grubx64.efi of this folder.​

    11 -- Installing OSs to a system with two or more ESPs -- Calamares installer and another trick.
    (This is for SECTION 2 Using two ESPs on one disk drive)

    The Calamares installer makes it easy to use two or more ESPs on your system. It allows you to specify the ESP you wish to use for installing Kubuntu's UEFI GRUB2 boot files. If your installer does not have this feature, you can do it this way:
    Turn off all ESPs (by turning off (removing) their boot flags -- you can use GParted to do this) except for the ESP you wish to make a dedicated ESP for the OS you are about to install now. Then do the OS installation using the Manual installation method. (Repeat for each OS you are installing at this time.) After you have finished installing all the OSs, then using GParted, turn on all ESPs (by re-setting their boot flags), and re-boot to test everything. When booted into one of your OSs, to see the ESP it is using, run the command: df /boot/efi (which shows the ESP partition mounted at /boot/efi for THAT OS).​

    12 -- How to boot into an operating system if it is no longer set as 'first in boot order'

    If you aren't sure HOW to boot into it, here's some ideas:

    -- Boot into the PC's UEFI firmware's boot menus to select your OS if it has a separate NVRAM variable and appears in the list. If you can't identify your main OS in the listing(s), (1) you can guess at it!, or (2) if you can identify another OS to boot into, and you know that it's GRUB2 boot menu has an entry for your main system, then boot into that OS, and use it to boot your main OS.
    -- Use rEFInd, by re-starting the PC and booting into UEFI firmware, and selecting rEFInd from a boot menu. Boot your OS from the boot menu of rEFInd. If you don't have rEFInd, you can easily get it by booting into ANY OS and install it. See Appendix 7. You could also install it from a live Kubuntu session (using your Kubuntu USB installer and selecting "Try Kubuntu").
    -- Boot your PC with your rEFInd USB flash drive and from it's boot menu select your OS to boot.
    -- You can use efibootmgr -o to adjust the boot order of your OSs and rEFInd. This is a good example of why you might want to make separate boot variables for your favorite/main OS, perhaps using good labels that you will recognize.

    After booting into your main OS, if your main OS is not set to be first in boot order, simply issue the command, sudo grub-install (which will also automatically run update-grub to update the boot menu from that OS).

    Be prepared! -->

    -- Always make sure you can boot your main OS from the other OSs on your PC. In each OS, run sudo update-grub to update the GRUB2 boot menu from that OS. To do this, you may have to re-enable os-prober -- see Appendix 9.
    -- What if you had set rEFInd to be first in boot order, to control all the booting on your PC. So it was your default boot manager. Then somehow it was no longer first in boot order. Then one thing you can do is simply re-install it (to your ESP): sudo refind-install. You can issue that from any OS where you downloaded the rEFInd files. See Appendix 7. (You can also re-install rEFInd from your rEFInd USB flash drive.)
    -- Labels: to easily identify your OSs and your ESPs, remember to set labels whenever you can (in GParted, or using special commands (see SECTION 3).​

    =====================================

    References

    My UEFI how-to's listed here:
    https://www.kubuntuforums.net/forum/...-fixing-things

    Booting multiple Ubuntu versions with EFI. (rather technical); one of these links should work:
    https://blog.lxgr.net/
    https://blog.lxgr.net/posts/2015/04/...efi-multiboot/

    Rod Smith, Managing EFI Boot Loaders for Linux (a definitive reference)
    https://www.rodsbooks.com/efi-bootloaders/

    My how-to: The dd Command
    https://www.kubuntuforums.net/forum/...the-dd-command

    My how-to: Building a Kubuntu live USB flash drive installer using dd
    https://www.kubuntuforums.net/forum/...e10#post544663

    rEFInd PPA, Rod Smith
    https://launchpad.net/~rodsmith/+archive/ubuntu/refind

    The rEFInd Boot Manager, Rod Smith -- complete how-to
    https://www.rodsbooks.com/refind/

    My how-to, rEFInd: Make a live USB flash drive to boot into your system
    https://www.kubuntuforums.net/forum/...l=1#post545284

    The rEFInd Boot Manager: Keeping rEFInd Booting, Rod Smith, which has some ideas you might be able to use on other OSs
    https://www.rodsbooks.com/refind/bootcoup.html

    How to install an SSD in a PC, We show you how to do it with an (PCIe) M.2 or SATA SSD, Feb 25, 2021,
    https://www.pcworld.com/article/394138/how-to-install-an-ssd-in-a-desktop-pc.html​
    Last edited by Qqmike; Yesterday, 07:29 AM.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski
Working...
X