Boot modes in Ubuntu Core

Overview

A Ubuntu Core system will use a special boot mode called “try” boot when a new kernel or core snap is installed. This way the system can revert automatically to the last known good core/kernel if the boot fails.

Details

The try-boot is implemented in both snapd and the bootloader (grub/uboot/aboot) in the following way:

  1. By default snap_mode is “” in which case the bootloader loads
    loads two squashfs’es denoted by variables snap_core and
    snap_kernel.
  2. On a refresh of a core/kernel snap the snapd daemon will set snap_mode=try and will also set snap_try_{core,kernel} to the core/kernel that will be tried next.
  3. On reboot the bootloader will inspect the snap_mode and if the
    mode is set to “try” it will set “snap_mode=trying” and then
    try to boot the snap_try_{core,kernel}".
  4. On a successful boot snapd resets snap_mode to “” and copies
    snap_try_{core,kernel} to snap_{core,kernel}. The snap_try_*
    values are cleared afterwards. The bootmode is in state (1) again.
  5. On a failing boot the bootloader will see snap_mode=trying which
    means snapd did not start successfully. In this case the bootloader
    will set snap_mode="" and the system will boot with the known good
    values from snap_{core,kernel}. The bootmode is in state(1) again.

Last updated a month ago. Help improve this document in the forum.