Two plugs about system-files, but the result difference

Hi,
I configured 2 plugs about system-file, the information and the etc-lvm-bakup, and added them into command ‘start’.
the plug etc-lvm-backup works well, I can read/write files in the path,
but there is something wrong about information, reading/writing operation are all denied.
What’s wrong with it?

Thank you!

grade: stable
confinement: strict
plugs:
  etc-lvm-backup:
    interface: system-files
    write:
      [/etc/lvm/backup]
    read:
      [/etc/lvm/backup]

  information:
    interface: system-files
    read:
      [/etc/visual_lvm]
    write:
      [/etc/visual_lvm]

  enum-devices:
    interface: system-files
    read:
      [/sys/devices,/proc,/dev]

parts:
  visual-lvm-remote:
    plugin: dump
apps:
  start:
    command: bin/vlvmservice start $SNAP_DATA
    plugs:
      [block-devices,system-observe,enum-devices,network-bind,etc-lvm-backup,information]

Who knows why? Thank you

Same issue i have also faced !!

I fixed the formatting on your post so it’s easier to read and comment on the usage of system-files you have.

This snippet is redundant since write implies read for system-files.

Same.

It’s unclear what might be causing the problem for information, but if you have the interface connected, you will also need to make sure that the user trying to access the file has permission, as traditional unix MAC still applies, i.e. if the file is 0600 and owned by root, then only root can read/write that file.

What is the purpose of this system-files interface plug you have here? system-files does not support file globbing and so as declared this just allows reading those verbatim directories, not any files underneath those directories, and also the documentation for system-files reads:

Importantly, this interface should not be used as a means to give access to system files where the snap is not the clear owner (eg, /dev, /proc, /sys, /usr, etc).

(from https://snapcraft.io/docs/system-files-interface)

So I’m curious what you’re trying to accomplish with this interface, perhaps there is a better interface that could be used instead to get the information or access you were trying to get with this.

Thanks for your work & reply.
What I want (with listed configure) are 2 goal:

  1. Create a install information file in /etc/visual_lvm(if it was not existing, create first) for upgrade, and delete it and /etc/visual_lvm with removing.
  2. Read files /etc/lvm/backup to analysis lvm information.

BTW: this application have to be run with root.