Skip to content

Instantly share code, notes, and snippets.

@txhammer68
Last active June 2, 2025 03:27
Show Gist options
  • Save txhammer68/4961bd8dc771f09e848e924b27925a2a to your computer and use it in GitHub Desktop.
Save txhammer68/4961bd8dc771f09e848e924b27925a2a to your computer and use it in GitHub Desktop.
Replace GRUB w/ systemd-boot and UKI for Ubuntu Linux

Replace GRUB boot manager w/ systemd-boot and UKI for Ubuntu Linux

  • Not to use with dual boot windows/ubuntu, stick with grub works better
  • systemd-boot for Ubuntu Linux flavors 24.04 and later
  • Replace grub, speeds up boot time, this is the future of Linux startup
  • Boot options for two kernels at all times; current, previous
  • A Unified Kernel Image (UKI) is a combination of a UEFI boot stub program, a Linux kernel image, an initramfs, and further resources in a single UEFI PE file (device tree, cpu µcode, splash screen, secure boot sig/key, ...). This file can either be directly invoked by the UEFI firmware or through a boot loader.
  • Ubuntu does not have a good wiki on systemd-boot w/ UKI, so I referred to the Arch wiki and adapted for Ubuntu, below are some links i used to develop this guide.
  • systemd-boot loader - grub replacement
  • UKI
  • different script using kernel cmdline options

How to install systemd-boot and UKI for Ubuntu Linux

sudo apt install systemd-boot systemd-ukify
sudo bootctl install --path=/boot/efi

Create /boot/efi/loader/loader.conf

timeout 0
default ubuntu*
auto-entries 1
console-mode max
editor false

Create /etc/kernel/install.conf

layout=uki
uki_generator=ukify
BOOT_ROOT=/boot/efi

Create /etc/kernel/uki.conf

Cmdline=@/etc/kernel/cmdline
OSRelease=@/etc/os-release
Splash=/boot/bootSplash.bmp

Edit/Create /etc/kernel/cmdline

root=UUID=xxxyyy ro quiet

Get root UUID lsblk -F
Check grub options in /etc/default/grub

After install and setup of systemd-boot run

sudo update-initramfs -u -k all

Verify
sudo bootctl
Reboot

  • Verify systemd-boot proper operation
  • See systemd-boot menu by pressing space bar during boot up
  • If everthing seems ok proceed to remove Grub from system

Remove Grub

sudo apt purge --allow-remove-essential grub2-common grub-pc-bin grub-pc grub-gfxpayload-lists grub-efi-amd64-bin grub-efi-amd64-signed grub-common os-prober shim-signed 
apt-get autoremove --purge
rm -rf /boot/grub/
rm -rf /boot/efi/EFI/ubuntu
  • Make sure GRUB is not installed back
sudo apt-mark hold "grub*"
  • systemd-boot bootSplash logo
bootSplash

Notes

You can also remove plymouth boot splash as it is no longer needed with systemd-boot
sudo apt purge plymouth && sudo apt autoremove

This setup works great and reboot takes about 10secs.

Here is a sample bootSplash image
https://raw.githubusercontent.com/txhammer68/docs/master/bootSplash.png

Check out more preformance tips here
https://txhammer68.github.io/docs/kubuntu.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment