I am trying to use the azure iotedge snap and it seems to have issues with the layout.
That is, when I try to configure the package it complains about certain paths not existing:
Command failed: could not create /etc/aziot/config.toml
Caused by:
No such file or directory (os error 2)
In the snapcraft file I see that the snap has this layout:
However, I think the target directory is never created, because its a symlink (copied from your docs):
If <source-path> and <target-path> donât already exist, they will be automatically created by snapd. This includes the creation of new empty files, but doesnât include the creation of symbolic link targets. This is because snapd doesnât know what kind of objects they may eventually point to. In the previous example, $SNAP_DATA/etc/foo.conf is created before any snap application code is executed.
Question 1: Where would be the correct location to create the target-pathâs this snap needs?
Question 2: I see in your documentation layouts are âtransparently supportedâ from base core22, but the snap that is using this has core20⌠Will it still work?
The location is fine, the directory structure should be creatdd from the install hook (IIRC symlink layouts do not create the target dir structure while bind and bind-file ones do) ⌠(you will also find the install hook has slightly broken code that tries to create these dirs in differnt locations already, at least that is what i vaguely remember from looking at it last time, this will need some cleanup)
I dont thonk layout behavior has changed a lot between core20 and 22 so it should be fineâŚ
What is the easiest way to debug the install hook?
I am trying with snapcraft -v try and sudo snap try prime but I have the feeling it is not running (again)? I might be wrong. Still getting used to the locations of $SNAP_COMMON when installing a snap and doing snap try.
That is, when I log $SNAP_COMMON from inside my app I print /var/snap/azure-iot-edge/common/ but when I am trying to add anything to this folder in my install hook I donât see anything added to this directory (when doing .
I also find I donât have to rerun snapcraft try, but I can edit prime/meta/hooks/install directly (ofcourse, if I do snapcraft try after it will overwrite this file).
I also found that although some of the folders needed are in prime/etc in the install stage the files are written to /var/snap/azure-iot-edge/..., and this is what the application uses. This makes sense now (was just confusing at first, I thought everything would be in prime).
I am still struggling to find out how to give the app permissions to make a new file. I get a permissions error. I am assuming I am missing a plug, but I got the plugs defined as: