Skip to content

io.systemd.SysInstall

API for installing the OS to another block device.

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/sysinstall
Socket /run/systemd/io.systemd.SysInstall
Available since systemd v262
Methods · types · errors 2 · 4 · 4

Methods

Run

streaming optional

Invoke the actual installation of the OS. If invoked with 'more' enabled will report progress, otherwise will just report completion.

func (c *Client) Run(ctx context.Context, in RunIn) (*RunOut, error)
func (c *Client) RunMore(ctx context.Context, in RunIn) iter.Seq2[*RunOut, error]

Parameters

Field Type Description
node string Full path to the block device node to operate on.
definitions ?[]string Path to directory containing definition files.
erase bool If true, fully erase the target block device.
variables ?bool If true, EFI variables are modified to register the installed boot loader in the firmware's boot options database.
kernelImagePath ?string The path to a kernel image, if missing the current kernel is detected and used.
copyLocale ?bool If true, the current locale is copied to target system
copyKeymap ?bool If true, the current keymap is copied to target system
copyTimezone ?bool If true, the current timezone is copied to target system
credentials ?[]Credential A list of credentials to be installed to target system.

Reply

Field Type Description
phase ?ProgressPhase If used with the 'more' flag, a phase identifier is sent in progress updates.
object ?string If used with the 'more' flag, an object identifier string is sent in progress updates.
progress ?int If used with the 'more' flag, a progress percentage (specific to the work done for the specified phase+object is sent in progress updates).

ListCandidateDevices

streaming (requires more)

Return a list of candidate block devices, i.e. that support partition scanning and other requirements for successful operation.

func (c *Client) ListCandidateDevices(ctx context.Context, in ListCandidateDevicesIn) iter.Seq2[*ListCandidateDevicesOut, error]

Parameters

Field Type Description
definitions ?[]string Path to directory containing definition files, used to evaluate the fit of the target OS for each block device.
subscribe ?bool If true, keep the call open after the initial enumeration and stream live add/remove notifications as block-subsystem uevents arrive. The end of the initial enumeration is marked by exactly one notification with action='ready' and no other fields. Defaults to false.

Reply

Field Type Description
action ?BlockDeviceAction Discriminator field. Only set in subscribe mode. 'add' carries the full device record, 'remove' carries only node, 'ready' carries no other fields and is sent once after the initial enumeration.
node ?string The device node path of the block device.
symlinks ?[]string List of symlinks pointing to the device node, if any.
diskseq ?int The Linux kernel disk sequence number identifying the medium.
sizeBytes ?int The size of the block device in bytes.
vendor ?string The device vendor string if known.
model ?string The device model string if known.
subsystem ?string The subsystem the block device belongs to if known.
fit ?DeviceFit The fit indicating whether the OS would have enough available space on the device.
minimalSizeBytes ?int Minimal size of the disk required for the installation.
needFreeBytes ?int Additional free space needed for the installation.
currentSizeBytes ?int Current allocated size of this block device.

Types

ProgressPhase

Progress phase identifiers. Note that we might add more phases here, and thus identifiers. Frontends can choose to display the phase to the user in some human readable form, or not do that, but if they do it and they receive a notification for a so far unknown phase, they should just ignore it.

Value Description
encrypt_credentials
install_partitions
mount_partitions
install_kernel
install_bootloader
unmount_partitions

DeviceFit

Description about the fit of an OS on a block device.

Value Description
enough_free_space
insufficent_free_space
disk_too_small
conflicting_disk_label_present

BlockDeviceAction

Discriminator on streamed ListCandidateDevices replies in subscribe mode.

Value Description
add The device is currently present and a candidate. Emitted both during the initial enumeration and for live uevents (any action other than 'remove' is propagated as 'add', including the synthesized transitions when a device becomes empty or read-only and a relevant ignore* input is in effect).
remove The device is no longer a candidate, either because the kernel reported a remove event, or because a dynamic filter (ignoreEmpty/ignoreReadOnly) flipped it out of the candidate set. Clients should drop the device identified by 'node'. It is permitted (and harmless) to receive a 'remove' for a device the client never saw an 'add' for; clients should ignore these silently.
ready Sentinel sent exactly once in subscribe mode, after the initial enumeration is complete. Everything that follows reflects live uevents. Carries no other fields.

Credential

A credential to install to target OS.

Field Type Description
id string The id of the credential.
value string The value of the credential in base64 encoding.

Errors

Error Go type Description
ConflictingDiskLabelPresent ConflictingDiskLabelPresentError An incompatible disk label present, and not told to erase it.
InsufficientFreeSpace InsufficientFreeSpaceError The target disk has insufficient free space to fit all requested partitions. (But the disk would fit, if emptied.)
DiskTooSmall DiskTooSmallError The target disk is too small to fit the installation. (Regardless if emptied or not.)
NoCandidateDevices NoCandidateDevicesError Not a single candidate block device could be found.