Using overlay with /var/run

I am porting an application that wants to run data to “/var/run/foo”. It is possible to use layouts to do this, or am I blocked because /var/run is linked to /run, and /run is not a supported target path (per

I created a simple snap “test-overlay” with layout

       symlink: $SNAP_DATA/var/run/test_overlay

My install hook

#!/bin/sh -e
mkdir -p $SNAP_DATA/var/run/test-overlay

snap install fails with

sudo snap install test-overlay_0.1_arm64.snap --devmode
error: cannot perform the following tasks:
- Run install hook of "test-overlay" snap if present (run hook "install":
cannot update snap namespace: cannot open directory "/var/run": not a directory
snap-update-ns failed with code 1

No, unfortunately you cannot use /var/run with layouts since /var/run is (typically) a symlink to /run.

Thanks for confirming this behavior.