How to create/delete path in install/remove hook?

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:

And I’ve added plugs to install/remove hook

plugs:
etc-lvm-backup:
interface: system-files
write:
[/etc/lvm/backup,/etc,/etc/visual_lvm]
read:
[/etc/lvm/backup,/etc,/etc/visual_lvm]

hooks:
install:
plugs:
[etc-lvm-backup,system-observe]
remove:
plugs:
[etc-lvm-backup,system-observe]

Should I connect interface when installing, or is there some wrong in the snapcraft.yaml?

the system-files interface is really not suited for actually creating a dir inside /etc, it is for accessing existing directories …

why can you not use the snap-provided writable directories to store install logs ?

PS: please put three backticks ``` above and below pasted yaml code, else the formatting gets lost and it becomes unreadable …

Because we stored data with other installing method.
Could the layout interface works at install/remove operation?

well, then the directory would exist and you would not need the mkdir call … layouts just re-map existing directories into the snap environment …

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.