Dual-boot Clear Linux* OS with Another GRUB-based Linux* Distro

In this tutorial, we show how to install another GRUB-based Linux* distro alongside Clear Linux OS. To do so, we resize the existing Linux root partition to make enough room to install Clear Linux OS. Then we configure the Clear Linux OS bootloader, systemd-boot, which enables you to dual-boot Clear Linux OS and an existing Linux distro. Although we use Ubuntu* 19.04 Desktop as the example here, these instructions also work for other distros such as Mint Linux, Kubuntu*, Fedora*, CentOS*, among others.

Prerequisites

  • Ubuntu 19.04 Desktop is already installed.
  • There is no unallocated space available, but there is free space on the Ubuntu root partition.
  • Follow the Preliminary steps that follow below.

Preliminary steps

  1. Visit our Downloads page.

  2. Download the file clear-<release number>-live-desktop.iso, also called the Clear Linux OS Desktop.

    Note

    <release-number> is the latest Clear Linux OS auto-numbered release.

  3. Follow your OS instructions to create a bootable usb drive.

Install Clear Linux OS with Advanced Installation

  1. Shut down the Ubuntu OS before proceeding.

  2. Boot up the Clear Linux OS live desktop image, and click the penguin icon, at left, to launch the installer.

  3. Complete the Required Options until you reach Select Installation Media. See Figure 1.

    Required options

    Figure 1: Required options

  4. Click Select Installation Media.

  5. Select the “Advanced Installation” option. See Figure 2.

    Advanced Installation

    Figure 2: Advanced Installation

  6. Click Partition Media to start the GParted tool.

  7. Shrink the Ubuntu root partition to free up some space for Clear Linux OS.

    1. Select the Ubuntu root partition (in this example: /dev/sda2). Right-click it and select “Resize/Move”. See Figure 3.

      Ubuntu root partition

      Figure 3: Ubuntu root partition

    2. In the New size (MiB) field, reduce the size of the root partition, leaving at least 22GB free. This allows enough space to create a swap partition (250MB) and root partition (approx. 21GB) for Clear Linux OS.

      Note

      The resulting free space appears in the “Free space following (MiB)”. Click the “Resize/Move” button. See Figure 4.

      Resize Ubuntu root

      Figure 4: Resize Ubuntu root

    3. Click the green checkmark button to proceed. See Figure 5.

      New unallocated space

      Figure 5: New unallocated space

  8. Share the existing EFI system partition by designating as such.

    1. Right-click the EFI System Partition (e.g., /dev/sda1) and select Name Partition.

    2. Set the name to “CLR_BOOT”. See Figure 6 and Figure 7.

      Name CLR_BOOT partition

      Figure 6: Name CLR_BOOT partition

      Resulting CLR_BOOT main screen

      Figure 7: Resulting CLR_BOOT main screen

  9. Create a swap partition for Clear Linux OS.

    1. Right-click the “unallocated” partition and select New to add a new partition.

    2. Enter “250” in the New Size (MiB) field to create a 250MB swap space.

    3. Enter “CLR_SWAP” in the Partition name field and select “linux-swap” as the “File system” type.

    4. Click the “Add” button. See Figure 8.

      Create CLR_SWAP partition

      Figure 8: Create CLR_SWAP partition

  10. Create Clear Linux OS root partition.

    1. Right-click “unallocated” partition again and select New to add a new partition.

    2. Create a partition that is at least 21GB, enter “CLR_ROOT” in the Partition name field, and select a File system type of your choice.

    3. Click the “Add” button. See Figure 9.

      Create CLR_ROOT partition

      Figure 9: Create CLR_ROOT partition

  11. Click the green checkmark button to create the newly-defined partitions. See Figure 10.

    Partitions to be created

    Figure 10: Partitions to be created

  12. Close the GParted window, and the Clear Linux OS installer will reappear with the newly-defined partitions to use. See Figure 11.

    |CL| installer partitions defined

    Figure 11: Clear Linux OS installer partitions defined

  13. Complete the remaining steps of Required Options to to install Clear Linux OS. Complete any Advanced Options as desired.

Ways to boot Clear Linux OS

Although we installed Clear Linux OS last, Ubuntu is still the default boot OS. There are several ways to boot Clear Linux OS:

  1. Use your BIOS “Boot Menu” to select and boot Clear Linux OS. This is temporary and will not make Clear Linux OS the default boot OS.
  2. Make systemd-boot, the boot loader that Clear Linux OS uses, the default boot loader to boot Clear Linux OS and chain-boot GRUB; therefore, boot Ubuntu. Follow the next section to implement this.

Make systemd-boot Default Bootloader and chain-boot GRUB

  1. Boot up the Clear Linux OS installer image.

  2. Open a terminal window.

  3. Identify the EFI system partition, Ubuntu root partition, and Clear Linux OS root partition.

    sudo fdisk -l
    

    Example output:

    clrlinux@clr-live~ $ sudo fdisk -l
    ...
    
    Disk /dev/sda: 335.4 GiB, 360080695296 bytes, 703282608 sectors
    Disk model: INTEL SSDSCKKF36
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 1048576 bytes
    Disklabel type: gpt
    Disk identifier: D5CB69E9-2C27-4A16-9552-3CD6BFA5DA77
    
    Device         Start       End   Sectors   Size Type
    /dev/sda1       2048   1050623   1048576   512M EFI System
    /dev/sda2    1050624 498481151 497430528 237.2G Linux filesystem
    /dev/sda3  498481152 498993151    512000   250M Linux swap
    /dev/sda4  498993152 703281151 204288000  97.4G Linux root (x86-64)
    ...
    

    The above example output contains these partitions:

    • /dev/sda1 is the EFI system partition originally created by Ubuntu and shared with Clear Linux OS
    • /dev/sda2 is the Ubuntu root partition
    • /dev/sda3 is the swap partition for Clear Linux OS
    • /dev/sda4 is the Clear Linux OS root partition

    The remaining steps will work with these partitions.

  4. Mount these partitions

    sudo mkdir /mnt/clearlinux
    sudo mount /dev/sda4 /mnt/clearlinux/
    sudo mount /dev/sda1 /mnt/clearlinux/boot
    
  5. Make systemd-boot the default bootloader

    sudo bootctl install --esp-path=/mnt/clearlinux/boot
    
  6. Add a timeout to systemd-boot so that it will present the menu of bootable OSes and give you time to select the one you want to boot.

    sudo clr-boot-manager set-timeout 20 --path=/mnt/clearlinux
    sudo clr-boot-manager update --path=/mnt/clearlinux
    
  7. Add a system-boot boot entry for GRUB.

    sudo tee -a /mnt/clearlinux/boot/loader/entries/grub.conf << EOF
    title GRUB menu
    efi /EFI/ubuntu/grubx64.efi
    EOF
    
  8. Umount all partitions.

    sudo umount /mnt/clearlinux/boot /mnt/clearlinux
    
  9. Reboot.

    sudo reboot
    
  10. Remove the Clear Linux OS installer USB thumb drive.

  11. You should be presented with the systemd-boot menu. See Figure 12.

    systemd-boot menu showing GRUB

    Figure 12: systemd-boot menu showing GRUB