Skip to content

multimedia: add home and var-tmp plugs for artifact writes - #21

Open
seankingyang wants to merge 3 commits into
canonical:mainfrom
seankingyang:add-multimedia-write-plugs
Open

multimedia: add home and var-tmp plugs for artifact writes#21
seankingyang wants to merge 3 commits into
canonical:mainfrom
seankingyang:add-multimedia-write-plugs

Conversation

@seankingyang

@seankingyang seankingyang commented Jul 18, 2026

Copy link
Copy Markdown

Why

The multimedia snap is strictly confined, and none of its apps can
write capture artifacts anywhere a user or test harness can consume
them. Observed on Ubuntu Core 22 Jetson devices (AGX Orin, Orin Nano,
IGX) while running camera validation through the snap's
gst-launch/nvargus-nvraw apps:

  • AppArmor denies file creation under /var/tmp/... — even as root:
    apparmor="DENIED" operation="mknod" profile="snap.multimedia.gst-launch" name="/var/tmp/checkbox-ng/probe-test/probe.yuv" ... fsuid=0.
    (/var/tmp/checkbox-ng/... is where the Checkbox certification
    harness stores per-session artifacts.)
  • Writes to $HOME are denied too: nvargus_nvraw reports
    Error FileOperationFailed after a successful capture (then
    segfaults in its error path); gst-launch ... filesink fails at
    preroll with Permission denied.
  • The only writable host-visible location is $SNAP_COMMON
    (/var/snap/multimedia/common/), which neither interactive users
    nor test harnesses use.

The snap declares no home plug and no system-files write access —
this PR adds both, at the top level so every app inherits them:

  • home: — interactive users can save captures into their own home
    (owner-scoped by the interface: root writing into another user's
    home stays denied, by design).
  • var-tmp (system-files, write /var/tmp) — deliberately the
    whole of /var/tmp rather than a harness-specific subpath, so the
    same snap serves any tooling that stages files there.

Validation

Validated 2026-07-18 on an Jetson AGX Orin Ubuntu Core 22 device by repacking the
installed snap with exactly these two plug entries (snap.yaml metadata
is what these snapcraft.yaml lines compile to) and connecting both
interfaces:

  • gst-launch nvarguscamerasrc (5 × 1080p NV12 frames) →
    /var/tmp/checkbox-ng/test/probe.yuv = 15,552,000 bytes.
  • nvargus-nvrawprobe.nvraw = 4,155,392 bytes.
  • Zero write-path AppArmor denials in the validation window; the
    previously-denied $HOME mknod now succeeds (clean before/after).

Notes for users

Neither interface auto-connects on Ubuntu Core — post-install setup
needs:

sudo snap connect multimedia:home
sudo snap connect multimedia:var-tmp

Internal tracking: OEMQA-6808 (bug), OEMQA-6807 (proposal +
validation), canonical/checkbox#2699 (the Checkbox camera jobs that
consume these paths).

The strictly-confined multimedia snap could not write capture artifacts
anywhere a user or test harness can consume them: AppArmor denied writes
under /var/tmp (used by the Checkbox certification harness) and $HOME
(even as root), leaving only $SNAP_COMMON, which nobody uses.

Add, at the top level so every app inherits them:
- home: interactive users can save captures into their own home.
- var-tmp (system-files, write /var/tmp): serves any tooling that
  stages files there, including the Checkbox camera jobs.

Validated on an IGX Ubuntu Core 22 device: gst-launch and nvargus-nvraw
captures land under /var/tmp with zero write-path AppArmor denials.
@seankingyang
seankingyang requested a review from a team as a code owner July 18, 2026 04:47

@rmartin013 rmartin013 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but I am curious about @DocSepp feedback. In particular, I am wondering why is this change necessary in the context of your tests and not in ours. AFAIU, the gstreamer artifacts are as well recorded in $HOME.

@DocSepp

DocSepp commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Hey, thanks for this PR.

These snaps aren't intended for end-users to use directly bu more as a guide to how to get started with developing snaps for tegra platforms. Since we don't have official snaps, we can't have the privileged interfaces auto-connect and I wanted to keep the needed interfaces to a minimum.

In this case - as described in the README - the intention was to write the resulting files in the $SNAP_DATA directory. Do you need access to the home directory or /var/tmp in your testing setup somehow or are you able to change it to the $SNAP_DATA directory?

@seankingyang seankingyang left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For end users, storing images in the $HOME directory is more convenient because the gst command allows users to store files in any path accessible to normal users.

Comment thread multimedia/snap/snapcraft.yaml Outdated
Comment thread multimedia/README.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants