Content Interface Writeable

I have created Producer snap with Writeable content slot. I have two consumer snap with plug to them. When I try to write i.e copy files in the consumer snap to the writeable folder, it doesn’t allow it to write. If I write via a process in the consumer snap, it is able to write files in the writeable content.

Can you clarify how to write/copy files to the writeable content by a consumer snap?

The snaps are available- https://github.com/muthiahn/test-content-interface

ubuntu@iot-cloud-01:~/test-content-interface/sample-slot$ plug1.test
total 512
-rwxrwxr-x 1 root root 58 Feb 21 05:12 slot-exec.sh
cp: cannot create regular file ‘/snap/plug1/x1/slot-writeable/./test.out’: Read-only file system
I am the slot-side executable running!
ubuntu@iot-cloud-01:~/test-content-interface/sample-slot$

well, you are exporting a place from a readonly (squashfs) filesystem, what do you expect ? :slight_smile:

Instead of $SNAP/slot-writable try to export $SNAP_DATA/slot-writeable (or SNAP_COMMON if you do not want it to be versioned) … and if you want non-root users to be able to write, SNAP_USER_DATA or SNAP_USER_COMMON … or indeed any dir underneath these paths …

If I have use SNAP_COMMON also I facing issues.

slots:
  myslot:
    interface: content
    content: tmp-slot
    write: [$SNAP_COMMON]

consumer-plug snap
plugs:
  myplug:
    interface: content
    content: tmp-slot
    target: $SNAP/slot-tmp

Script
#!/bin/bash
SLOT_LOC=$SNAP/slot-tmp

ls -lrth $SLOT_LOC
cp -R $SNAP/mywrite/* $SLOT_LOC```


ubuntu@iot-cloud-01:~/test-content-interface/sample-plug1$ plug1.test
total 0
-rw-r--r-- 1 root root 0 Feb 21 09:52 me.txt
-rw-r--r-- 1 root root 0 Feb 21 10:06 b.txt
cp: cannot create regular file '/snap/plug1/x9/slot-tmp/test.out': Permission denied
/snap/plug1/x9/plug-exec.sh: line 7: /snap/plug1/x9/slot-tmp/slot-exec.sh: No such file or directory
ubuntu@iot-cloud-01:~/test-content-interface/sample-plug1$

@muthiah read carefully:

Thanks, it worked fine with that change