package
0.0.0-20250312152250-ea85ec9d2454
Repository: https://github.com/snapcore/snapd.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
# Functions
BootFlags returns the current set of boot flags active for this boot.
ClearTryRecoverySystem removes a given candidate recovery system and clears the try model in the modeenv state file, then reseals and clears related bootloader variables.
ComposeCandidateCommandLine composes the kernel command line used when booting the system in run mode with the current built-in edition of managed boot assets.
ComposeCandidateRecoveryCommandLine composes the kernel command line used when booting the given system in recover mode with the current built-in edition of managed boot assets.
ComposeCommandLine composes the kernel command line used when booting the system in run mode.
ComposeRecoveryCommandLine composes the kernel command line used when booting a given system in recover mode.
CopyBootAssetsCacheToRoot copies the boot assets cache to a corresponding location under a new root directory.
DebugDumpBootVars writes a dump of the snapd bootvars to the given writer.
DebugSetBootVars is a debug helper that takes a list of <var>=<value> entries and sets them for the configured bootloader.
DeviceChange handles a change of the underlying device.
DropRecoverySystem drops a provided system from the list of good and current recovery systems, updates the modeenv and reseals the keys a needed.
EnsureNextBootToRunMode will mark the bootenv of the recovery bootloader such that recover mode is now ready to switch back to run mode upon any reboot.
EnsureNextBootToRunModeWithTryRecoverySystemOutcome, typically called while in initramfs, updates the boot environment to indicate an outcome of trying out a recovery system and sets the system up to boot into run mode.
FindPartitionUUIDForBootedKernelDisk returns the partition uuid for the partition that the booted kernel is located on.
GetCurrentBoot returns the currently set name and revision for boot for the given type of snap, which can be snap.TypeBase (or snap.TypeOS), or snap.TypeKernel.
HostUbuntuDataForMode returns a list of locations where the run mode root filesystem is mounted for the given mode.
InitramfsActiveBootFlags returns the set of boot flags that are currently set for the current boot, by querying them directly from the source.
InitramfsExposeBootFlagsForSystem sets the boot flags for the current boot in the /run file that will be consulted in userspace by BootFlags() below.
InitramfsHostWritableDir is the location of the host writable partition during the initramfs, typically used in recover mode.
InitramfsIsTryingRecoverySystem, typically called while in initramfs of recovery mode system, checks whether the boot variables indicate that the given recovery system is only being tried.
InitramfsReboot requests the system to reboot.
InitramfsRunModeSelectSnapsToMount returns a map of the snap paths to mount for the specified snap types.
InitramfsRunModeUpdateBootloaderVars updates bootloader variables from the initramfs.
InitramfsWritableDir is the location of the writable partition during the initramfs.
InspectTryRecoverySystemOutcome obtains a tried recovery system status.
InstallHostFDEDataDir is the location of the FDE data during install mode.
InstallHostWritableDir is the location of the writable partition of the installed host during install mode.
InUse returns a checker for whether a given name/revision is used in the boot environment for snaps of the relevant snap type.
No description provided by the author
IsResealNeeded returns true when the predictable boot chains provided as input do not match the cached boot chains on disk under rootdir.
No description provided by the author
Kernel checks that the given arguments refer to a kernel snap that participates in the boot process, and returns the associated BootKernel, or a trivial implementation otherwise.
MakeBootableImage sets up the given bootable set and target filesystem such that the image can be booted.
MakeBootablePartition configures a partition mounted on rootdir using information from bootWith and bootFlags.
MakeRecoverySystemBootable prepares a recovery system under a path relative to recovery bootloader's rootdir for booting.
MakeRunnableStandaloneSystem operates like MakeRunnableSystem but does not assume that the run system being set up is related to the current system.
MakeRunnableStandaloneSystemFromInitrd is the same as MakeRunnableStandaloneSystem but uses seed dir path expected in initrd.
MakeRunnableSystem is like MakeBootableImage in that it sets up a system to be able to boot, but is unique in that it is intended to be called from UC20 install mode and makes the run system bootable (hence it is called "runnable").
MakeRunnableSystemAfterDataReset sets up the system to be able to boot, but it is intended to be called from UC20 factory reset mode right before switching back to the new run system.
MarkBootSuccessful marks the current boot as successful.
MarkRecoveryCapableSystem records a given system as one that we can recover from.
MaybeReadModeenv uses ReadModeenv() with the default root directory, but ignores ENOENT errors and returns a nil, but no error.
No description provided by the author
MockResealKeyToModeenv is only useful in testing.
MockSealKeyToModeenv is used for testing from other packages.
No description provided by the author
No description provided by the author
ModeAndRecoverySystemFromKernelCommandLine returns the current system mode and the recovery system label as passed in the kernel command line by the bootloader.
Participant figures out what the BootParticipant is for the given arguments, and returns it.
PromoteTriedRecoverySystem promotes the provided recovery system to be recognized as a good one, and ensures that the system is present in the list of good recovery systems and current recovery systems in modeenv.
No description provided by the author
ReadModeenv attempts to read the modeenv file at <rootdir>/var/lib/snapd/modeenv.
No description provided by the author
No description provided by the author
SetRecoveryBootSystemAndMode configures the recovery bootloader to boot into the given recovery system in a particular mode.
SetTryRecoverySystem sets up the boot environment for trying out a recovery system with given label in the context of the provided device.
SnapTypeParticipatesInBoot returns whether a snap type participates in the boot for a given device.
SystemMode returns the current mode of the system and a flag indicating whether the mode is explicitly set through modeenv.
No description provided by the author
TrustedAssetsInstallObserverForModel returns a new trusted assets observer for use during installation of the run mode system to track trusted and control managed assets, provided the device model indicates this might be needed.
TrustedAssetsUpdateObserverForModel returns a new trusted assets observer for tracking changes to the trusted boot assets and preserving managed assets, provided the device model indicates this might be needed.
UnmarkRecoveryCapableSystem removes a given system from the list of systems that we can recover from.
UpdateCommandLineForGadgetComponent handles the update of a gadget that contributes to the kernel command line of the run system (appending any additional kernel command line arguments coming from system options).
UpdateManagedBootConfigs updates managed boot config assets if those are present for the ubuntu-boot bootloader.
UseTokens decides whether KeyData for disk encryption should be stored in the LUKS2 header in tokens.
WithBootChains calls the provided function passing the boot chains which may be observed when booting as an input.
No description provided by the author
# Constants
DefaultStatus is the value of a status boot variable when nothing is being tried.
ModeFactoryReset is a mode in which the device performs a factory reset.
ModeInstall is a mode in which a new system is installed on the device.
ModeRecover is a mode in which the device boots into the recovery system.
ModeRun indicates the regular operating system mode of the device.
ModeRunCVM is Azure CVM specific run mode fde + classic debs.
No description provided by the author
No description provided by the author
No description provided by the author
TryingStatus is the value of a status boot variable after we have attempted a boot with a try snap - this status is only set in the early boot sequence (bootloader, initramfs, etc.).
No description provided by the author
TryRecoverySystemOutcomeInconsistent indicates that the booted try recovery system state was incorrect and corresponding boot variables need to be cleared.
TryRecoverySystemOutcomeNoneTried indicates a state in which no recovery system has been tried.
No description provided by the author
TryStatus is the value of a status boot variable when something is about to be tried.
# Variables
No description provided by the author
ErrBootNameAndRevisionNotReady is returned when the boot revision is not established yet.
No description provided by the author
No description provided by the author
ErrObserverNotApplicable indicates that observer is not applicable for use with the model.
No description provided by the author
HasFDESetupHook purpose is to detect if the target kernel has a fde-setup-hook.
InitramfsBootEncryptionKeyDir is the location of the encrypted partition keys during the initramfs on ubuntu-boot.
InitramfsDataDir is the location of system-data role partition (typically a partition labeled "ubuntu-data") during the initramfs.
InitramfsHostUbuntuDataDir is the location of the host ubuntu-data during the initramfs, typically used in recover mode.
InitramfsRunMntDir is the directory where ubuntu partitions are mounted during the initramfs.
InitramfsSeedEncryptionKeyDir is the location of the encrypted partition keys during the initramfs on ubuntu-seed.
InitramfsUbuntuBootDir is the location of ubuntu-boot during the initramfs.
InitramfsUbuntuSaveDir is the location of ubuntu-save during the initramfs.
InitramfsUbuntuSeedDir is the location of ubuntu-seed during the initramfs.
InstallHostSaveDir is the directory of device data on ubuntu-save during install mode.
InstallHostFDESaveDir is the directory of the FDE data on the ubuntu-save partition during install mode.
InstallUbuntuDataDir is the location of the data partition during install mode.
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
BootableComponent represents kernel-modules components, which are needed as part of a BootableSet.
BootableSet represents the boot snaps of a system to be made bootable.
BootAsset represents all possible expected file for a boot asset in a boot chain.
TODO:UC20 add a doc comment when this is stabilized.
Modeenv is a file on UC20 that provides additional information about the current mode (run,recover,install).
NextBootContext carries additional significative information used when setting the next boot.
RebootInfo contains information about how to perform a reboot if required.
RecoverySystemBootableSet is a set of snaps relevant to booting a recovery system.
No description provided by the author
No description provided by the author
TrustedAssetsUpdateObserver tracks the updates of trusted boot assets and attempts to reseal when needed or preserves managed boot assets.
# Interfaces
A BootKernel handles the bootloader setup of a kernel.
A BootParticipant handles the boot process details for a snap involved in it.
TrustedAssetsInstallObserver tracks the installation of trusted or managed boot assets.
# Type aliases
InUseFunc is a function to check if the snap is in use or not.
MockSealKeyToModeenvFlags is used for testing from other packages.
No description provided by the author
No description provided by the author
No description provided by the author
Unlocker functions are passed from code using boot to indicate that global state should be unlocked during slow operations, e.g sealing/unsealing.