How to use the command 'bootctl' (with examples)

How to use the command 'bootctl' (with examples)

The ‘bootctl’ command is used to control EFI firmware boot settings and manage the boot loader. It provides various functionalities like showing information about the system firmware and bootloaders, managing bootloader entries, setting flags to boot into system firmware, specifying the path to the EFI system partition, installing and removing versions of ‘systemd-boot’ from the EFI system partition.

Use case 1: Show information about the system firmware and the bootloaders

Code:

bootctl status

Motivation:

  • This use case helps to gather information about the system firmware and the active bootloaders. It can be useful for troubleshooting boot-related issues or verifying the current firmware configuration.

Explanation:

  • ‘bootctl status’ is used to display information about the system firmware and the bootloaders on the system.

Example output:

EFI variables are not supported on this system.
Boot Loader Information
    Status: not found
System Partition:
    UUID:       9D02-4A90
    Path:       /
    Fstab:      /
    EspPath:    /boot/efi
Random Seed:
    Passed 0 bytes of random data in '/dev/random'

Use case 2: Show all available bootloader entries

Code:

bootctl list

Motivation:

  • This use case is used to get a list of all available bootloader entries on the system. It is useful for managing and selecting different boot options.

Explanation:

  • ‘bootctl list’ lists all the available bootloader entries.

Example output:

title   arch    kernel
----------------------
Arch Linux

Use case 3: Set a flag to boot into the system firmware on the next boot

Code:

sudo bootctl reboot-to-firmware true

Motivation:

  • This use case is useful when you want to boot into the system firmware on the next boot. It is similar to using ‘sudo systemctl reboot –firmware-setup’.

Explanation:

  • ‘sudo bootctl reboot-to-firmware true’ sets a flag to boot into the system firmware on the next boot.

Example output: (No output)

Use case 4: Specify the path to the EFI system partition

Code:

bootctl --esp-path=/path/to/efi_system_partition/

Motivation:

  • This use case is helpful when you want to specify a custom path to the EFI system partition. By default, ‘bootctl’ uses ‘/efi/’, ‘/boot/’, or ‘/boot/efi’ as the path.

Explanation:

  • ‘bootctl –esp-path=/path/to/efi_system_partition/’ allows you to specify a custom path to the EFI system partition.

Example output: (No output)

Use case 5: Install ‘systemd-boot’ into the EFI system partition

Code:

sudo bootctl install

Motivation:

  • This use case installs ‘systemd-boot’ into the EFI system partition. ‘systemd-boot’ is a simple UEFI boot manager included with the systemd package.

Explanation:

  • ‘sudo bootctl install’ installs ‘systemd-boot’ into the EFI system partition.

Example output: (No output)

Use case 6: Remove all installed versions of ‘systemd-boot’ from the EFI system partition

Code:

sudo bootctl remove

Motivation:

  • This use case is used to remove all installed versions of ‘systemd-boot’ from the EFI system partition.

Explanation:

  • ‘sudo bootctl remove’ removes all installed versions of ‘systemd-boot’ from the EFI system partition.

Example output: (No output)

Conclusion:

The ‘bootctl’ command provides a set of useful functionalities for managing EFI firmware boot settings and the boot loader. From displaying information to managing bootloader entries and installing/removing ‘systemd-boot’, it offers control over the boot process. Understanding and utilizing these different use cases can help in troubleshooting boot-related issues and configuring the boot environment according to specific requirements.

Related Posts

FTP Command Examples (with examples)

FTP Command Examples (with examples)

Connect to a remote FTP server interactively ftp host Motivation: This use case allows you to connect to a remote FTP server and interact with it using the FTP command line interface.

Read More
How to use the command pnmtopclxl (with examples)

How to use the command pnmtopclxl (with examples)

Description: The pnmtopclxl command is used to convert PNM (Portable Anymap) files to an HP LaserJet PCL XL printer stream.

Read More
How to use the command 'cs java' (with examples)

How to use the command 'cs java' (with examples)

The ‘cs java’ command is used in the coursier command-line interface (CLI) to fetch, install, and run JVMs.

Read More