skip to content

A service on your Ubuntu servers was installed as a snap, and its version changed overnight with no deploy from your team. Why did that happen, and what control do you actually have over when snaps update?

level: seniorimportance: should knowfreq 36%

answer

  1. snapd polls the store, four times daily
  2. not your deploy pipeline
  3. hold is scoped and time-capped
  4. control when, not whether
  5. previous revision is kept for revert

basics

~20 s

The snapd daemon auto-refreshes installed snaps from the Snap Store several times a day by default, so a snap can change version without any deploy. You can shift the schedule, hold refreshes, choose a slower channel or track, and revert a bad revision, but you cannot simply switch updating off forever.

solid answer

~60 s

That is snapd's auto-refresh doing exactly what it is designed to do: it checks the store for new revisions on a schedule — four times a day by default — and applies them without asking. The levers you have, roughly in order of usefulness: choose a **channel or track** whose risk level and major line you actually want rather than following the newest thing; **hold** refreshes with `snap refresh --hold`, which can be indefinite for a named snap while a blanket system-wide hold is capped at 90 days; reshape the schedule with `snap set system refresh.timer=` so updates land in a maintenance window instead of mid-afternoon; and **roll back** with `snap revert`, since snapd keeps the previous revision. `snap refresh --time` shows the last and next refresh. For a fleet, the supported answer is a Snap Store Proxy, which lets you gate and pin which revisions your machines are offered. If none of that fits your change-control model, that is a real argument for not delivering the service as a snap.

code

bash · 11 lines
bash
# Show snapd's refresh schedule and what it last did
snap refresh --time

# Hold refreshes for one named snap indefinitely
sudo snap refresh --hold=forever nextcloud

# Confine all refreshes to a maintenance window instead
sudo snap set system refresh.timer=sun,02:00-04:00

# Roll back a snap that refreshed into a bad revision
sudo snap revert nextcloud

go deeper

for a junior

Know that snaps update themselves automatically in the background, unlike archive packages, and that snap refresh --time shows when the last and next attempts are.

for a middle

Explain the mechanics: the default schedule, channels and tracks, what hold does and how its scope is limited, and how revision retention makes snap revert a real rollback.

for a senior

Show incident judgment — revert first, hold second, then investigate — and design for it: maintenance windows, revisions captured in inventory, and alerting that notices a version changed.

for a principal

Own the policy question: whether a self-updating delivery format is compatible with your change-control model at all, and whether running a store proxy is worth it versus choosing a format whose timing you already control.

## Why the version changed Snapd's design assumption is that keeping software current is more valuable than keeping it frozen — a defensible position for a desktop browser, and a jarring one for a server. `snapd` polls the Snap Store on a timer, by default several times a day, and when the channel you track has a newer revision it downloads and switches to it. No operator action is involved; nothing you did triggered it. This is the single most important operational fact about the format: **a snap's lifecycle is not your deploy pipeline's lifecycle** unless you deliberately make it so. You can see the schedule directly: ``` $ snap refresh --time timer: 00:00~24:00/4 last: today at 04:22 UTC next: today at 11:07 UTC ``` That `00:00~24:00/4` is the default: four refresh attempts spread through the day, randomised so the store is not hit by every machine at once. ## Lever 1: pick the right channel and track A snap's channel is `track/risk` — `latest/stable`, `latest/candidate`, `latest/beta`, `latest/edge`. The single most common self-inflicted wound is running something other than a stable risk level in production because it was installed that way once. Beyond risk, some publishers define extra **tracks** that correspond to major versions, so you can follow a major line and receive only its updates instead of jumping major versions automatically. `snap info <name>` lists the channels a snap publishes, and `snap refresh --channel=<track>/stable <name>` moves to one. Choosing the right track is not a workaround — it is the intended mechanism for controlling how much change you accept. ## Lever 2: hold refreshes `snap refresh --hold` suspends refreshes. The important nuance is scope: holding a **named** snap can be indefinite (`--hold=forever`), whereas a **blanket** hold covering all snaps is capped — the documented limit is 90 days — because snapd deliberately refuses to let a machine drift unpatched forever. `snap refresh --unhold` releases it, and `snap refresh --list` shows what is waiting. The older equivalent, still present, is the system configuration option `snap set system refresh.hold=<time>`, which defers until a given moment. ## Lever 3: control when, not whether Often the real complaint is not that the snap updated but that it updated at 14:00 on a weekday. `snap set system refresh.timer=` accepts a schedule string, so you can confine refreshes to a maintenance window — a Sunday-night slot, for example. Related knobs exist for constrained environments, such as holding refreshes while the connection is metered. This is usually the healthiest compromise for a fleet: the machine stays patched, but the change lands when someone is watching. ## Lever 4: revert quickly when a revision is bad Because snapd retains previous revisions (`refresh.retain` governs how many), rollback is a genuine primitive rather than a reinstall: ``` sudo snap revert nextcloud # back to the previous revision sudo snap revert nextcloud --revision=1234 # or a specific one ``` That retention is one of the format's real strengths, and it changes the incident calculus: an unexpected refresh that breaks a service is a one-command recovery, provided you notice. ## Lever 5: put a proxy between the fleet and the store For an organisation, the supported answer is Canonical's **Snap Store Proxy**: the machines are pointed at your proxy instead of the public store, and the proxy controls which revisions are offered, so you can test a revision and then release it to the fleet. That converts snap refresh from an upstream event into an internal one, which is what change control actually requires. It is infrastructure to run, so it is worth it when snaps are load-bearing for you and not otherwise. ## The judgment answer The strong senior answer does not stop at flags. It says: alerts and change records should include snap revisions, so a version change is visible rather than discovered during an incident; a service whose availability you own should be delivered in a format whose update timing you own, which for many teams means an archive package or a container image rather than a snap; and if snaps are the delivery format — as they are for some Canonical-adjacent tooling — then the right posture is a stable track, a maintenance-window timer, a proxy for anything critical, and a rehearsed `snap revert`. Simply trying to disable snapd's updating outright fights the design and eventually fails.

  • Can you disable snap auto-refresh permanently on a server?
    Not cleanly. A hold on a named snap can be indefinite, but a blanket hold across all snaps is capped at 90 days by design, and blocking the store at the network layer just produces a machine that fails to refresh rather than one that is managed. The supported way to own the timing across a fleet is a Snap Store Proxy that decides which revisions your machines are offered.
  • A refresh landed a broken revision at 03:00 and the service is failing. What do you do first?
    Revert. `sudo snap revert <name>` switches back to the retained previous revision immediately, and `--revision=` picks a specific one if the previous is also suspect. Then hold that snap so the next scheduled refresh does not undo the fix, and only afterwards work out what changed. Rollback before diagnosis is the right order when the previous revision is one command away.
  • How would you make an unexpected snap version change visible rather than discovered during an incident?
    Treat installed revisions as inventory: collect them the way you collect package versions, and alert on change. Confine refreshes to a maintenance window so changes correlate with a known slot, and record the revision alongside deploys so a version bump is attributable. The failure mode is not that snaps update, it is that nothing in your monitoring notices they did.

saying these in an interview costs you the question

  • Believes snaps only update when you run a command
  • Thinks auto-refresh can simply be switched off forever
  • Suggests firewalling the store as the fix
  • Does not know the previous revision is retained for rollback
  • Treats a snap version change as impossible without a deploy

context