On an Ubuntu Core system, when a new kernel snap or core snap environment is installed, Ubuntu Core enables a special boot mode called try.
If the system fails to boot, try boot mode allows the system to revert automatically to a last known good core and kernel combination
Details
The implementation of try-boot touches both snapd and the bootloader (grub/uboot/aboot
) in the following ways:
- By default,
snap_mode
is""
, in which case the bootloader loads loads two squashfs files denoted by variablessnap_core
andsnap_kernel
. - When a core/kernel snap is refreshed, snapd will set both
snap_mode=try
andsnap_try_{core,kernel}
to the core/kernel that will be tried next. - On reboot, the bootloader will inspect snap_mode and, if it’s set to
try
, will setsnap_mode=trying
and attempt to boot thesnap_try_{core,kernel}
. - On a successful boot, snapd resets snap_mode to
""
and copiessnap_try_{core,kernel}
tosnap_{core,kernel}
. The snap_try_/* values are cleared afterwards. The bootmode is now in state(1) again. - On a failing boot, the bootloader will see
snap_mode=trying
which means snapd did not start successfully. In this, case the bootloader will setsnap_mode=""
and the system will boot with the known good values fromsnap_{core,kernel}
. The bootmode is in state(1) again.