Concept

Generations, trial boots and rollback

The short version

Each time you apply a new system, Vessel gives it a number: generation 1, 2, 3, and so on. The old generations stay on the disk, each with its own entry in the boot menu. A new generation starts as a trial. If its boot is cut off three times, or its health check fails once, the computer goes back to the newest generation that worked. Rolling back never deletes anything. It makes a new generation that runs an older system.

What a generation is

Building a system gives one item in the store, /sigil/store/<hash>-vessel-system. It holds everything that makes one system different from another: the kernel and its command line, the programs, every file the system puts in /etc, and the list of every other store item it needs. The name comes from a hash of its contents, so building the same configuration twice gives the same item.

A generation is a numbered link to one of those items, an entry for the boot menu, and a boot-state record:

/system/generations/1 -> /sigil/store/7d1c...-vessel-system
/system/generations/2 -> /sigil/store/2b9e...-vessel-system
/boot/loader/entries/vessel-1.conf
/boot/loader/entries/vessel-2.conf
/boot/loader/vessel-state/vessel-1.rec
/boot/loader/vessel-state/vessel-2.rec

That's all a generation is, which is why keeping old ones costs so little. Two generations that share most of their programs share those store items, and only the parts that differ take more space.

Generation numbers are never reused. If you remove generation 4, the next one is still 5, so a number always means the same system.

Trial boots

A new generation starts with three tries in its checksummed boot-state record under /boot/loader/vessel-state. Its boot entry keeps the name vessel-2.conf throughout the trial. Each time the boot selector starts that entry, it records the spent try before starting the kernel, so a hang or a power cut during boot still uses up a try. The entry itself isn't renamed to count attempts.

Once every other service has started or failed, the health check runs. It checks that every required service started, and runs each of the system's health check commands, with two minutes for all of them. Features add their own checks: ssh-server, for example, adds one that checks something is listening on its port.

  • If everything passes, the boot-state record is marked good. The entry's name stays vessel-2.conf, and later boots don't spend tries.

  • If something fails on a trial, the entry is marked as out of tries, even if it had some left, and the computer restarts. So the three tries are for boots that get cut off, by a hang or a power cut, before the health check finishes.

  • If something fails on an entry that's already good, the health check reports it and leaves the entry alone, because restarting would only start the same entry again.

Which entry boots

The boot selector has one rule: entries with no tries left go last, and of the rest, the newest boots. A new trial is the newest, so it boots first. If it runs out of tries, it moves to the end, and the newest good entry boots instead. The selector says so on the screen before it starts the older one.

You can also pick any older entry from the boot menu. That boots it once, without changing anything.

Why rolling back makes a new generation

Running vessel system rollback doesn't change which entry is the default. It makes a new generation that runs the older generation's system. In the tutorial, rolling back from generation 2 made generation 3, with generation 1's store item.

There are two reasons for this. First, the boot selector keeps its one rule: the newest entry with tries left boots. There's no separate setting that says "boot this older one by default" to get out of step. Second, the system you roll back to goes through a trial and a health check like any other. If it no longer works on this computer (for example, because a disk it mounts is gone), you find out the same way, and the selector falls back again.

Without a number, vessel system rollback picks the newest good generation older than the one that's running. Give it a number to pick another one. vessel status lists the generations and their numbers.

Cleaning up

Old generations keep their store items. To free the space, vessel system remove deletes the generations you name, such as vessel system remove 2 3, and vessel system gc then deletes every store item that no remaining generation needs. You can't remove the generation that's running, and Vessel always keeps a usable entry and the last good one.

In practice

Created with Sigil