Create new top-level folder inside a snap

Hi, I am packing a pre-compiled application into a snap, this app needs to write to /persistent/log and cannot be changed, I tried by:

...
layout:
  /persistent/log:
    symlink: $SNAP_DATA/log

But as soon as I compile I get:

Cannot pack snap file: Command [snap, pack, --check-skeleton, PosixPath(/xxxx/xxxxx/xxxx/xxxx/xxxx)]' returned non-zero exit status 1. (error: cannot validate snap "xxxx-xxxx": layout "/persistent/log" defines a new top-level directory "/persistent")

How can I workaround this?

Hi

It looks like you are running into this limitation documented here:

New entries in / (root)
Layouts cannot currently create new top-level files or directories. For example, the following layout declaration will not work:

layout:
  /foo: # Unsupported, cannot create new top-level directories.
     bind: $SNAP/foo

Is it a well known application?

Unfortunately is a custom third party application that I cannot edit (no public source code), I tried some workaround such as placing some random files in that folder (using dump plugin), the folder is created but the simlynk still gives same erros