Skip to content

io.systemd.BootControl

Boot Loader control APIs

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/bootcontrol
Socket /run/systemd/io.systemd.BootControl
Available since systemd v257
Methods · types · errors 4 · 6 · 4

Methods

ListBootEntries

streaming (requires more)

Enumerates boot entries. Method call must be called with 'more' flag set. Each response returns one entry. If no entries are defined returns the NoSuchBootEntry error.

func (c *Client) ListBootEntries(ctx context.Context) iter.Seq2[*ListBootEntriesOut, error]

Reply

Field Type Description
entry BootEntry A boot menu entry structure

SetRebootToFirmware

Sets the reboot-to-firmware-UI flag of the firmware, if this concept exists. Returns the RebootToFirmwareNotSupported error if not.

func (c *Client) SetRebootToFirmware(ctx context.Context, in SetRebootToFirmwareIn) error

Parameters

Field Type Description
state bool The new value of the reboot-to-firmware-UI flag

GetRebootToFirmware

Gets the current state of the reboot-to-firmware-UI flag of the firmware, if this concept exists. Returns the RebootToFirmwareNotSupported error if not.

func (c *Client) GetRebootToFirmware(ctx context.Context) (*GetRebootToFirmwareOut, error)

Reply

Field Type Description
state bool The current state of the reboot-to-firmware-UI flag

Install

since v260 · passes file descriptors

Install the boot loader on the ESP.

func (c *Client) Install(ctx context.Context, in InstallIn) error

Parameters

Field Type Description
operation Operation Operation, either 'new' or 'update'
graceful ?bool If true, continue on various failures
rootFileDescriptor ?int Index into array of file descriptors passed along with this message, pointing to file descriptor to root file system to operate on
rootDirectory ?string Root directory to operate relative to. If both this and rootFileDescriptor is specified, this is purely informational. If only this is specified, it is what will be used.
bootEntryTokenType ?BootEntryTokenType Selects how to identify boot entries
touchVariables ?bool If true the boot loader will be registered in an EFI boot entry via EFI variables, otherwise this is omitted

Types

BootEntryType

The type of a boot entry

Value Description
type1 Boot Loader Specification Type #1 entries (.conf files)
type2 Boot Loader Specification Type #2 entries (UKIs)
loader Additional entries reported by boot loader
auto Automatically generated entries

BootEntrySource

The source of a boot entry

Value Description
esp Boot entry found in EFI system partition (ESP)
xbootldr Boot entry found in XBOOTLDR partition

Operation

The operation to execute

Value Description
new Install the boot loader afresh, creating everything it needs
update Just update existing boot loader binaries

BootEntryTokenType

The boot entry token type to use.

Value Description
machine_id Pick identifiers for type #1 boot entries based on /etc/machine-id
os_image_id Pick identifiers for type #1 boot entries based on the IMAGE_ID= field from /etc/os-release
os_id Pick identifiers for type #1 boot entries based on the ID= field from /etc/os-release
literal Pick identifiers for type #1 boot entries based on a manually chosen string
auto Choose automatically how to pick identifiers for type #1 boot entries

BootEntryAddon

A structure encapsulating an addon of a boot entry

Field Type Description
globalAddon ?string The location of the global addon.
localAddon ?string The location of the local addon.
options string The command line options by the addon.

BootEntry

A structure encapsulating a boot entry

Field Type Description
type BootEntryType
source BootEntrySource The source of the entry
id ?string The string identifier of the entry
path ?string Path to the primary definition file for the entry
root ?string Directory path of the file system root the entry was found on
title ?string The entry's title string
showTitle ?string The possibly mangled/augmented title to show for the entry
sortKey ?string An explicitly configured sorting key for the enry
version ?string The version of the entry
machineId ?string Machine ID of the OS installation belonging to the entry, if known
architecture ?string EFI architecture name for this entry
options ?string Command line options to pass to the invoked kernel or EFI binary
linux ?string Path to the Linux kernel to invoke, relative to the root directory of the file system containing the entry file
efi ?string Path to the EFI binary to invoke, relative to the root directory of the file system containing the entry file
uki ?string Path to an UKI EFI binary to invoke, relative to the root directory of the file system containing the entry file
profile ?int An UKI profile index to invoke. If not specified defaults to the first profile.
initrd ?[]string Path to the initrd image to pass to the invoked kernel, relative to the root directory of the file system containing the entry file
devicetree ?string Devicetree file to pass to the invoked kernel, relative to the root directory of the file system containing the entry file
devicetreeOverlay ?[]string Devicetree overlay file to pass to the invoked kernel, relative to the root directory of the file system containing the entry file
isReported bool Indicates whether the boot loader reported this entry on the current boot
triesLeft ?int Indicates the number of tries left for this boot entry before it is assumed to be not working.
triesDone ?int Indicates the number of unsuccessful tries already made for this boot entry.
isDefault ?bool Indicates whether this entry is the default entry.
isSelected ?bool Indicates whether this entry has been booted.
addons ?[]BootEntryAddon Addon images of the entry.
cmdline ?string Command line options of the entry.

Errors

Error Go type Description
RebootToFirmwareNotSupported RebootToFirmwareNotSupportedError SetRebootToFirmware() and GetRebootToFirmware() return this if the firmware does not actually support the reboot-to-firmware-UI concept.
NoSuchBootEntry NoSuchBootEntryError No boot entry defined.
NoESPFound NoESPFoundError No EFI System Partition (ESP) found.
BootEntryTokenUnavailable BootEntryTokenUnavailableError The select boot entry token could not be determined.