Snaps not running after installation

I am created a simple snapcraft.yaml file as just to print hello in python.

name: hellotest
version: 1.0
summary: testing
description: |
  testing

grade: devel
confinement: devmode

apps:
  hellotest:
    command: bin/main.py

parts:
  hellotest:
    plugin: python
    python-version: python3
    python-packages: [six]

and main.py file is

print("hello world")

I put this file in snap/prime/bin location.
after installing snap when I run the command hellotest it gives me error as
/snap/hellotest/x2/command-hellotest.wrapper: 5: exec: /snap/hellotest/x2/bin/main.py: Permission denied

I am new in snapcraft… Please any one has solution reply me…

You really should include file under a new part with the dump plugin.

This indicates that the file doesn’t have the executable file permission. Search “unix file permission” on the net to find out how to set it properly.

Thanks for reply Lin-Buo-Ren,

I just solved the issue while trying different combinations. Its a file location issue first then for python I am adding command: python3 main.py

Now its running. Is this a correct method of running snaps?

I received one more error after installing it as prime

root@mayur-VirtualBox:/home/mayur/mysnap/python/snap# snap install hellotest_1.0_amd64.snap 
error: cannot find signatures with metadata for snap "hellotest_1.0_amd64.snap"
root@mayur-VirtualBox:/home/mayur/mysnap/python/snap# snap install hellotest_1.0_amd64.snap --force-dangerous
error: cannot perform the following tasks:
- Mount snap "hellotest" (unset) (snap "hellotest" requires devmode or confinement override)

Is there any way to resolved this issue

It’s not a wrong one, to be the least. In this case you’re loading the script to the interpreter instead of directly executing it, but the result is the same.

Should be snap install --devmode hellotest_1.0_amd64.snap as your snap is now in devmode confinement, refer Snap confinement for more info.

please, could you tell me what tutorial you’re following that tells you to use --force-dangerous? Thank you.

2 Likes