Ubuntu Core boot modes

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


The implementation of try-boot touches both snapd and the bootloader (grub/uboot/aboot) in the following ways:

  1. By default, snap_mode is "", in which case the bootloader loads loads two squashfs files denoted by variables snap_core and snap_kernel.
  2. When a core/kernel snap is refreshed, snapd will set both snap_mode=try and snap_try_{core,kernel} to the core/kernel that will be tried next.
  3. On reboot, the bootloader will inspect snap_mode and, if it’s set to try, will set snap_mode=trying and attempt 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 now 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.

Would this be more relevant to the Ubuntu Core docs than the Snap docs?

@mpt I think so - AIUI the medium/long term plan is to feed docs.ubuntu.com with content from the forum. Not sure what the best short term approach is though.

FWIW as we add more Ubuntu Core docs, we’ll probably grow an ad-hoc section in the outline.

This document has 2 titles - the topic title, “Boot modes in Ubuntu Core”, and an <h1> inside the topic itself of “Ubuntu Core boot modes”. This is different from how the other topics are written.

Could someone with edit rights please remove the <h1> from within the document?

I think the best short-term approach is to remove the “doc” label so that this stops showing up on docs.snapcraft.io. Perhaps add an “ubuntucoredoc” or similar label instead.

@degville I think this page should also have a special URL, currently it just shows up as https://snapcraft.io/docs/t/boot-modes-in-ubuntu-core/5464. I don’t think it needs to be in the side-bar though.

Thanks for this - I’ve moved it into the special URL category. I also think this page is likely to be moved to the wider Ubuntu Core documentation when it’s published.

1 Like