File system exception | permission denied

I made an app using Flutter UI toolkit. Everything goes fine in debug mode. But after build the snap (which goes fine as well) and installing it I get a “permission denied”

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: FileSystemException: Cannot open file, path = '<path>' (OS Error: Permission denied, errno = 13)
#0      GetStorage._init (package:get_storage/src/storage_impl.dart:47)
<asynchronous suspension>
#1      new GetStorage._internal.<anonymous closure> (package:get_storage/src/storage_impl.dart:28)
<asynchronous suspension>
#2      main (package:app_name/main.dart:15)
<asynchronous suspension>

It seem to be a permission issue where system do not allow the app read/write on the disc. But flutter documentation don’t have anything related to permission for apps targeting linux OS.

How to solve this?

Sounds like you may be trying to read/write to a location which is not allowed by the sandbox. However, the backtrace you provided does not indicate what that location is, so I’d start by trying to figuring that out first.

Please take a look at https://snapcraft.io/docs/data-locations which lists the locations that are specific for each snap and are always writable.

1 Like

you should also install the snappy-debug snap and then run the snappy-debug command in a second terminal while running your app.

this will give you some clues about things blocked by confinement and how to solve them.

1 Like

Thanks a lot! Snapcraft documentation is not so clear about this. I just added plugs: [home] in the snapcraft.yaml file and everything worked :slight_smile: !

Thanks! This tool helped a log!

1 Like