App writing to $SNAP regardless of layout

Hello! I am attempting to snap an application that has an unconfigurable log directory that is relative to the location of the binary. For example this would look like, $SNAP/opt/app/Logs if the binary is in $SNAP/opt/app. I’ve tried using a layout with either a bind or a symlink to $SNAP_COMMON and still get the error of the binary attempting to write to the squashfs.

Is there any way around this or would the app itself need to be modified to support configuring the log directory?

layout:
  /opt/app/Logs: 
    bind: $SNAP_COMMON/opt/app/Logs
layout:
  /opt/app/Logs: 
    symlink: $SNAP_COMMON/opt/app/Logs

I figured this out. I always forget that layouts are relative to the root of the filesystem and not the squashfs. This is a valid layout in this case:

layout:
  $SNAP/opt/app/Logs: 
    symlink: $SNAP_COMMON/opt/app/Logs
2 Likes