Classic confinement: when the sandbox is switched off

purpose for app developers for users for administrators

Some programs need to run arbitrary tools from the host which strict confinement cannot allow. Classic confinement lets a snap run with the same access as a traditionally packaged program and gives up the protection of the sandbox. The store reviews every classic snap and the person installing it must pass --classic. It is not available on Ubuntu Core and it costs the developer more upkeep so interfaces are the first thing to try.

On the map: interfaces district

▶ Watch this deck — 7 scenes, ~5 min

01 A program that has to run your tools

CLASSIC CONFINEMENT strictphoto-editoryour picturesthe networka short, known list code-editorinvented example$ make test your laptopgccpython3gitmakeinstalled your way,changing every week strict: its terminal cannot run theman interface names something a snap needs; "anything on this machine" has no name classicclassic: no sandbox, it runs them all
On the right, photo-editor is strict and reaches only your pictures and the network; code-editor, an invented snap with a terminal running make test, cannot reach the laptop's own programs gcc, python3, git and make while it is strict, and reaches all four once it is classic

Classic confinement is "provided for apps that need access to arbitrary binaries on the host, which isn't possible when using strict confinement". code-editor is an invented example; IDEs, compilers and terminal emulators are on the store's list of supported reasons.

The photo editor needs your pictures and the network. That's a list, and interfaces grant it piece by piece. Now think of an editor with a terminal in it, where you type make. Let's call it the code-editor snap; it's made up for this deck. What's on its list? Your compiler, your interpreter, your version of git, whatever you installed last week. Nobody can write that down in advance. The documentation gives exactly this as the main reason classic confinement exists: apps that need arbitrary programs from the host. So there's a second mode, where the snap isn't put in the sandbox at all.

02 What is given up

THE TRADE photo-editorstrictcode-editorclassic filesits own, plus what you connectedwhatever your account can reach programs it can runits own and its base'sits own, its base's and the host's system calls and devicesfilterednot filtered if it is maliciouslimited by the sandboxlike an unsandboxed package everything else is the same: one file, revisions, refresh, revert
Strict photo-editor and classic code-editor compared in four rows: files, programs it can run, system calls and devices, and what happens if it turns out to be malicious; everything else about a snap stays the same

Classic confinement is "equivalent to the full system access that traditional, unsandboxed packages have". The snap is still a snap in every other way: revisions, refresh and revert work the same.

Before you type the flag, be clear what you're agreeing to. For this one snap, the walls aren't there. The docs call classic the most permissive level, equal to the full system access of traditional, unsandboxed packages. The photo editor is held to its own files and what you connected. The code-editor snap can read whatever your account can reach, and run the host's programs too. Its system calls and devices aren't filtered. So you're trusting its developer the way you'd trust any package. The docs say it plainly: a malicious author could easily compromise a system. What you keep is the rest: one file, revisions, refresh and revert.

03 Two agreements before it runs

WHO AGREES publishercode-editorstorereviewed by people:is classic really needed? $ snap install code-editor error: This revision of snap "code-editor" was published using classic confinement and thus mayperform arbitrary system changes outside of the security sandbox that snaps are usuallyconfined to, which may put your system at risk.If you understand and want to proceed repeat the command including --classic. $ snap install code-editor --classicinstalled $ snap list code-editorName Version Rev Tracking Publisher Notescode-editor 1.0 12 latest/stable acme classiclater refreshes of code-editor do not ask again
A publisher sends code-editor to the store, where people review whether classic is really needed; in your terminal snap install code-editor fails with the message that the snap was published using classic confinement and asks you to repeat the command with --classic; with --classic it installs, and snap list shows classic under Notes

The store reviews every request for classic confinement, and snap install refuses a classic snap until you repeat it with --classic. snap list shows classic in Notes.

Nobody slips a classic snap onto your laptop quietly. Two parties have to say yes, and one of them is you. The first is the store. The docs say Canonical must vet every classic snap, and without approval from the store team it can't be distributed. Reviewers look at the publisher and at the technical reason. The second is you. A plain snap install stops and tells you, in full, what classic means. So you repeat it with the --classic flag. That's consent, not a formality. Snapd remembers it for that snap, so refreshes don't ask again, and snap list shows classic under Notes.

04 Where it is not available

NOT EVERYWHERE Ubuntu desktopor server$ snap install code-editor --classicinstalled the gatewayUbuntu Core$ snap install code-editor --classicerror: snap "code-editor" requires classic confinementwhich is only available on classic systems the flag does not help; snap find on Ubuntu Core lists strictly confined snaps only Fedora$ snap install code-editor --classicerror: cannot install "code-editor": classic confinement requiressnaps under /snap or symlink from /snap to /var/lib/snapd/snap choosing snaps for a device image: a classic snap is not a candidate
The same command, snap install code-editor --classic, on three machines: on Ubuntu desktop or server it installs; on the gateway with Ubuntu Core it is refused because classic confinement is only available on classic systems, and snap find there lists strictly confined snaps only; on Fedora it asks for /snap or a symlink from /snap to /var/lib/snapd/snap

On Ubuntu Core a classic snap is refused: "requires classic confinement which is only available on classic systems". On some distributions snapd asks for a change to the system before classic snaps install.

You try the same command on the gateway, and it fails, flag or no flag. Classic confinement depends on what kind of system you're on. On an ordinary distribution, like Ubuntu on the laptop, it installs. On Ubuntu Core, snapd refuses a classic snap outright. The store's review page says the same: classic snaps are only supported on classic distributions. That's also why snap find on the gateway doesn't show them. And on a distribution that keeps snaps somewhere else, such as Fedora, snapd wants a link under /snap first, and its message tells you so. Building a device image? Leave classic snaps out.

05 The cost to the developer for app developers

THE COST a strict snapbase: core24libsslits root filesystem, the same everywhere code-editor (classic)bin/editorlibsslthe hostlibsslpython3libcnow there are two must load its ownnot the host's copy Ubuntu 22.04Ubuntu 24.04Fedoraa different host under every user "Classic confinement has a very high maintenance cost."
Left: a strict snap on its base, core24,, which holds the only libssl it can see. Right: code-editor, classic, ships its own libssl next to a host with another libssl; it must load its own and not the host's, on Ubuntu 22.04, Ubuntu 24.04 or Fedora; the docs call this a very high maintenance cost

"Classic confinement has a very high maintenance cost": every binary and library in the snap must use what the snap ships, not what the host happens to have. How to build such a snap is Snapcraft's subject.

To a developer, classic looks like the shortcut: no interfaces, no denials. Here's the bill. A strict snap sees its base as its root filesystem, so it only finds your libraries or the base's, the same on every machine. A classic snap sees the host. Now there are two copies of the same library. If one of your binaries picks up the host's copy, it works on your machine and breaks on the next distribution. And every user brings a different host. The docs spell out the duty: everything in the snap must use the libraries, interpreters and dependencies the snap ships. They call it a very high maintenance cost.

06 When not to ask for it for app developers

TRY THIS FIRST the reason giventhe answer it needs files in my homehomeremovable-mediapersonal-files it reads files under /etclayoutssystem-files it has hard-coded pathslayouts a library is only on the hostship it in the snap strict was hard to get workingnot a supported reason devmode: logs what strict would deny, so you find the interfaces you needit cannot go to stable, does not show in search and does not refresh automatically
Reasons given for classic confinement and the answer to each: files in my home, the home, removable-media and personal-files interfaces; files under /etc, layouts or system-files; hard-coded paths, layouts; a library only on the host, ship it in the snap; strict was hard to get working, not a supported reason. Devmode finds the interfaces you need but cannot go to stable, does not show in search and does not refresh automatically

Requests for classic confinement are reviewed against lists of supported and unsupported reasons. File access, fixed paths and missing libraries have answers within strict confinement; layouts have their own deck. Devmode is for development only.

Before you post a request for classic, read the list of reasons that get turned down. Yours might be on it, with the fix next to it. Files in your home? The home, removable-media or personal-files interfaces. Files under /etc? A layout, or the system-files interface. Hard-coded paths? Layouts again. A library that's only on the host? Ship it in the snap. And "strict was hard to get working" is on the unsupported list by name. Not sure what your snap needs? Install it in devmode: it logs what strict would deny. But a devmode snap can't go to stable, and doesn't refresh by itself.

07 Where to go from here

ROADS Classic confinementthe decisionConfinementthe sandbox it does without Why snapswhy confinement is the default Interfaces · Policyand who decides what connects Trying and packing a snapdevmode, jailmode, classic The per-snap mount namespacewhat a strict snap sees The storewhat search offers, per system
Roads from classic confinement: Confinement, Why snaps, Interfaces and interface policy, Trying and packing a snap, the per-snap mount namespace, and the store

Roads: the sandbox itself, why confinement is the default, interfaces and their policy, the install flags, the mount namespace and the store.

Classic confinement is the exception: reviewed by the store, agreed to by you, missing on Ubuntu Core, and costly for whoever packages it. For the rule, start at the walls, the sandbox this snap does without. Why snaps explains why confinement is the default. The gatehouse covers interfaces, and the policy deck who decides what a strict snap may connect. Trying and packing a snap has the devmode, jailmode and classic flags. The mount namespace deck shows the filesystem a strict snap sees. And the store deck shows what search offers on each kind of system.

Read more

Strict and classic compared

From the published comparison; rows that the snapd code qualifies are noted.

StrictClassic
AppArmorenforce modecomplain mode
Seccompstrict filteringno filtering (@unrestricted)
Device cgroupalways for snaps on core24 and later bases; on older bases only when a device is assignednot set up
Programs it can runstaged packages and the basestaged packages, the base and the host
Available on Ubuntu Coreyesno
Needs a flag at installno--classic
Store reviewautomatic checksreviewed by people before it can be distributed

The published table also says a classic snap has no private mount namespace. snap-confine sets up mount namespace support for classic snaps too when parallel instances are enabled.

Messages

MessageWhen
This revision of snap "<snap>" was published using classic confinement ... repeat the command including --classic.snap install of a classic snap without the flag
snap "<snap>" requires classic confinement which is only available on classic systemson Ubuntu Core, with or without the flag
classic confinement requires snaps under /snap or symlink from /snap to /var/lib/snapd/snapon a distribution that mounts snaps elsewhere, such as Fedora
snap "<snap>" is not compatible with --classic--classic given for a snap that is not classic

Once a snap is installed with --classic, later refreshes of it do not need the flag again. snap list shows classic under Notes, unless the snap was installed with --jailmode.

What the store's reviewers accept and decline

Supported categories, from the published review process: compilers; debug tools; IDEs; programming languages; terminal emulators, multiplexers and shells; public cloud agents; Juju helpers; Kubernetes tools requiring arbitrary authentication agents; tools for switching development workspaces; some HPC and orchestration agents; installers for Ubuntu flavours; AI agents that run arbitrary user-directed code.

Reason givenAnswer in the published list
access to dot files in the home directorypersonal-files
access to /etclayouts or system-files
hard-coded pathslayouts
software only available on the hostship it in the snap
arbitrary files because of habithome and removable-media are almost always sufficient
difficulty making strict confinement worknot supported
running other snaps directlynot supported
management snaps; third-party installer snapsnot supported

On Ubuntu Core, snap find asks the store for strictly confined snaps only; on classic systems it asks for strict and classic ones.

The three modes in one line each

  • strict: confined; the default.
  • classic: not confined; reviewed; needs --classic; classic systems only.
  • devmode: confined but violations are only logged; for development; not for the stable channel and no automatic refresh.

The flags themselves are in Trying and packing a snap.

for app developers for administrators

Installing a classic snap that did not come from the store

The documentation notes that Canonical manages risk only for its own infrastructure and channels: a classic snap obtained elsewhere can be installed by hand by someone who understands the risk. A local file still needs --classic, together with --dangerous if it has no signatures.

Further reading

Roads from here

START HERE

GETTING SNAPS

  • The store — what snap find shows on a system without classic support

INTERFACES AND CONFINEMENT

  • Confinement — the sandbox that classic confinement does without
  • Interfaces — interfaces as the first thing to try

POLICY · who may install and connect what

DEVELOPING SNAPS · try, pack, run, debug

SANDBOX INTERNALS · the mount namespace