Shipping updates to a Linux Mint remix without reinstalling: timestamped migrations, a ledger and a PPA

How CaramOS, a community Linux Mint 22.3 remix for Vietnamese users, ships changes to installed computers without reinstalling: timestamped migr…

CaramOS is a Linux distribution based on Linux Mint 22.3, made by the Vietnam Linux Family (VNLF) community for Vietnamese users. We build it as an ISO remaster: unpack Mint's ISO, chroot in to add packages, overlay configuration and run hooks, then pack it again with mksquashfs and xorriso.

That builds an ISO quickly, but it leaves a hard question: how does an installed computer get our next change? Ubuntu and Mint fixes already arrive through APT. CaramOS's own configuration (the input method, the taskbar, our own apps, how the screen locks) lives in the installed system, owned by no package. Without a plan, a new version means reinstalling, and ordinary users never reinstall.

This is how we do it, and how it broke.

One package, caramos-ota: APT carries it, migrations change the system

Updating lives in one Debian package, caramos-ota, published in the PPA ppa:vietnamlinuxfamily/caram-os. APT is only the transport. Every change to the system is a migration: a directory named by a timestamp.

caramos_ota_update/migrations/
  20261012120000_add_driver_check/
    manifest.json     # text shown to users, no logic
    migration.py      # reviewed code, runs as root

Three rules:

  1. A ledger picks migrations, not a version number. The runner reads a ledger of applied migrations, takes the IDs missing from it, sorts them lexically (timestamps, so also by date) and runs them in order. A computer on 1.3.3 and one on 1.5.1 differ only in which migrations are still missing.
  2. The manifest is text only. manifest.json holds a title, a summary, release notes in Vietnamese and English, and a few attributes such as "unattended": "anytime". It has no commands, no download URLs, no package lists. The logic lives in reviewed migration.py files. No JSON fetched from the network ever drives the machine.
  3. Fail closed. If a migration fails, the runner stops and does not record it, and the next run starts again from that migration.

A real migration, installing hw-probe for our Driver Check app:

PACKAGE = "hw-probe"
COMMAND = Path("/usr/bin/hw-probe")

def run(context: MigrationContext) -> None:
    if COMMAND.exists():
        context.log(f"{PACKAGE} is already installed")
        return
    try:
        context.apt_install([PACKAGE], recommends=False)
    except MigrationContextError as exc:
        context.log(f"could not install {PACKAGE} ({exc}); Driver Check tells how to install it")

A migration must be safe to run twice, so it checks the state before acting. Packages still go through APT; nothing downloads a .deb by hand. From 15 July to 26 November 2026 the repository gained 65 of these migrations.

Updating by itself, but knowing when to wait

A daily systemd timer runs caramos-ota --check, which only records what is pending in /var/lib/caramos-ota/state.json and changes nothing. After a successful check, if Automatic updates is on (the default since 1.5.0), another service installs the missing migrations. It waits on a metered connection, on battery below 50% without the charger, when the disk is almost full, or while another program is installing software.

A migration can declare "unattended": "nobody-logged-in" to wait until nobody is logged in. Changes that would move things on the screen of someone who is working, such as the taskbar or the desktop, wait for that person's next login. People who prefer to click can turn Automatic updates off in the Update Center, a GTK app that reads state.json and runs pkexec caramos-ota --upgrade --yes when they agree.

The ISO build runs the same chain of migrations on the root filesystem, so a fresh install and an updated computer end up the same.

How it broke

A shutdown in the middle of dpkg. Users reported that the App Center could not install anything: "dpkg was interrupted". Linux Mint sets DefaultTimeoutStopSec=10s. The daily check updates the caramos-ota package itself with APT, and a shutdown at that moment sent SIGTERM, then SIGKILL, to dpkg. A numbered file left in /var/lib/dpkg/updates made APT refuse every later install. The fix: before self-updating, look for that file and run dpkg --configure -a --force-confdef --force-confold; defer SIGTERM until the install finishes; and give the check unit KillMode=mixed and TimeoutStopSec=15min.

"Up to date" without asking. The old Update Center showed the result of the last check, so a failed check (no network, a company network blocking it) looked exactly like "nothing new". Since 1.5.1, opening the Update Center asks the server at once, says why when it cannot, and a failed daily check tries again an hour later.

Old computers almost never updated. On 1.3.3 and earlier, that version's migrations only ran when nobody was logged in, and office computers are logged in whenever they are on. Version 1.5.2.1 changed this: older computers install the update at the next start, before the login screen, once per computer.

An update while working left the UI wrong. On the Xfce edition, an automatic update during a session left the sound slider in an oddly tall box until the next login, because our Control Center kept its old style sheet. Since 1.5.2.2 the Control Center restarts right after any update that changes it.

Small fixes without a new ISO

Because every change goes through a migration, a small fix only needs a new version number of the form x.y.z.n and a new package in the PPA. After 1.5.2 (25 November 2026), versions 1.5.2.1 to 1.5.2.5 came out within about five days, without rebuilding an ISO, each with its own notes in the Update Center.

Source code and full documentation: https://github.com/VN-Linux-Family/CaramOS, in packages/caramos-ota.


This article was drafted with AI assistance (Claude) and reviewed by the author. How VNLF uses AI in the project: https://github.com/VN-Linux-Family/CaramOS/blob/main/README_EN.md#how-caramos-is-made-and-where-ai-helps

内容来自 LXer Linux News,版权归原作者所有。

阅读原文 ↗

来自「LXer Linux News」的更多文章

查看全部文章

用 HomepageTab 新标签页关注 RSS,打开浏览器就能看到更新。

安装 HomepageTab

相关阅读