Hi I am packaging to-do list program for my school project. (My team is the only team using snapcraft)
I am using executable .jar file and .jar file itself runs fine after installing it through snapstore.
I added some to-dos in my list, when I called the list it works fine.
but the problem is, after I turned off and execute program again, the list doesn’t show anything.
I thought db file is automatically created and save its data on the same directory when I first execute my program.
How do I package it?
Hey! Thank you for using snapcraft. I don’t know the details of your program so I wanted to ask some questions that may help us identify the issue:
Where does your application store the list?
When you run the program do you see any apparmor denials? You can see them by running
dmesg | grep DENIED
I think it is supposed to be stored on ./testDB file on same directory. (+ We’re using sqlite)
And this is my apparmor denials:
[ 29.111896] audit: type=1400 audit(1527690828.655:36): apparmor=“DENIED” operation=“open” profile=“snap.todo-b7.todo-b7” name="/home/dain/" pid=2364 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=1000
Does that mean the program is trying to access db file from my home directory, not snap dir?
@promise I don’t know where you define the db-dir/file, but probably you want to use one of these environment variables for them (Probably SNAP_USER_COMMON):
It specifically means your snap is trying to read the contents of the ‘/home/dain/’ directory. I’m not sure if it is doing that as a first step to drill down to some subdirectory or not, but as @datenhahn suggested, you might adjust your program to save its files directly in $SNAP_USER_COMMON (which is exported to your snap’s environment as
/home/dain/snap/todo-b7/common). Another option would be SNAP_USER_DATA.