To compatible with other installation such as zip/ppa, I need to create /etc/visual_lvm/ path and write install log into it.
So I need to create path/file in install hook and delete path in remove hook.
But it always fail:
= AppArmor =
Time: Aug 2 03:36:19
Log: apparmor=“DENIED” operation=“mkdir” profile=“snap.visual-lvm-remote.hook.install” name="/etc/visual_lvm/" pid=18149 comm=“mkdir” requested_mask=“c” denied_mask=“c” fsuid=0 ouid=0
File: /etc/visual_lvm/ (write)
Suggestions:
adjust program to write to $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
Could snap create/delete file with layout interface in install/remove process?
The system-files interface need to be connected manual, how to connect when install?
layouts are not an interface, they just bind-mount or symlink files and directories into other places inside the snap environment, they do not grant you special permissions (like interfaces do) … what you could do would be to map something non-writable to a writable dir like:
layout:
/etc/foo_bar:
bind: $SNAP_DATA/foo_bar
this would map /etc/foo_bar into /var/snap/<snapname>/current/foo_bar (and thus make it writable for your snap)
to pre-connect interfaces you can file an auto-connection request in the store-requests category, but for system-files these need to be clearly owned by the software in the snap… if you want to use your snap in an UbuntuCore image, you can also have the connection established from the gadget.yaml on first boot of the UbuntuCore image.