Daemon crashes with "run.sh" wrapper (was: Application with keys to run from the script)

Hello.

The script that runs the application contains such a string

$SNAP/bin/./CORE -D "$SNAP_USER_DATA" -T "$SNAP_USER_DATA" -S "${1:-${RANDOM}}"

This is necessary for data files that the application will create, for log files, for files with keys.

-S #seed [optional]
-D \"data path\" [optional]
-T \"temp path\" [optional]

If I run this script on Ubuntu desktop it’s working.
But on Ubuntu-core I see this error

Loading module: 'libubuntu_application_api_desktop_mirclient.so.3.0.0'
/snap/bsp095project/x1/bin/./CORE: invalid option -- 'D'
/snap/bsp095project/x1/bin/./CORE: invalid option -- 'T'
/snap/bsp095project/x1/bin/./CORE: invalid option -- 'S'

Can anyone know if there is some special feature when working with Ubuntu-core?

Are you running the script as root or as a regular user? Note that $SNAP_DATA is designed for services (only one instance of the data exists) while $SNAP_USER_DATA is, as the name says, for per-user data.

If I start the script as a regular user then I can not get the connection through the port:

[  0:245 ] log;GenersControllerCommon;Starting detection on /dev/ttyUSB0
[  0:245 ] main;initialization finished at 10:08:25.203
[  0:246 ] extern;port setup failed: "/dev/ttyUSB0"

But if I run like root that, the connect passes without problems.

[  0:242 ] log;GenersControllerCommon;Starting detection on /dev/ttyUSB0                                                                                                                                                                           
[  0:243 ] main;initialization finished at 10:09:46.417

But the question is in another, why I see message about the keys?
This message is I see no matter regardless of which user I run script.

@zyga-snapd

Do you have a suggestion why on the Ubuntu desktop these keys pass normally, but on Ubuntu-core gives an error?
Without keys, can not run the application, it’s a problem.

Maybe in cases with work in Ubuntu-core I need to transfer these keys differently to run in the script?

By

keys

do mean command line options? No I don’t have any ideas off the top of my head, sorry.

do you use the same wrapper script in both cases ?

Yes, I have the same script.
Because the function of running this application is to run the binary

$SNAP/bin/./CORE

and send the keys to the binaries indicating where to create the data files:
-D “data path”
-S (create files with key. PrimaryKey and SecondaryKey)
-T “temp path”

Perhaps in the case of snap, keys must be transferred in another way?
But in cases of launch on Ubuntu desktop, this works as it should.
Problema, why in snap it’s not working?
This is the same function for the application, run it through the keys that are required.

A quick shoot in the dark, does it work if you put the whole command to run in a wrapper script and then run your script from the command in your apps declaration?

No, it’s not working.

bsp095project.BSP095launcherCoreSimulation 
/snap/bsp095project/x1/bin/./CORE: symbol lookup error: /snap/bsp095project/x1/bin/./CORE: undefined symbol: _ZN24TherapyRunnersController17DisconnectRequestEi

debugger write the message:

= AppArmor =
Time: Aug 24 13:52:53
Log: apparmor="DENIED" operation="open" profile="snap.bsp095project.BSP095launcherGui" name="/usr/share/applications/" pid=4210 comm="BTL095" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
File: /usr/share/applications/ (read)
Suggestions:
* adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
* add 'unity7' to 'plugs'

And in wrapper I has:

apps:
    BSP095launcherCoreSimulation:
        command: bin/run_new.sh $SNAP/bin/./CORE
        plugs: [mir, mir-libs, home, opengl, unity7, gsettings, raw-usb, serial-port, network, fuse-support, hardware-observe, network-control, system-trace]
        environment:
            LD_LIBRARY_PATH: $SNAP/btl_libs/Simulation:$SNAP/btl_libs:$LD_LIBRARY_PATH

On your advice, I moved the launch of the application right here, and removed the keys

The denial is irrelevant to the problem at hand. You need to figure out what’s missing in the library path. You app didn’t start because it did not find the right symbol. This is something you have to investigate. Which library holds that symbol, where is that library, what is LD_LIBRARY_PATH when you start?

https://www.dropbox.com/s/pvbbnaojoatz1ga/run_new.sh?dl=0
Here all the paths are pointed to the libraries, modules, fonts.
Plus, what is about Mir.

P.S. Another mistake that is interesting is that of locale. But I do not think that it can affect the launch of the application.
xkbcommon: ERROR: couldn’t find a Compose file for locale “C.UTF-8”
xkbcommon: ERROR: couldn’t find a Compose file for locale “C.UTF-8”

I really hope if you tell me what I missed or did not see.
Thx.

Hello, @zyga-snapd
Did you see what I sent you?

Again, this is something you have to investigate. See what is set at runtime (snap run --shell your-snap-name; run env and explore), see if something strikes you as odd. If you can reduce this to a simple example that I can run I can try to debug that.

Hello @zyga-snapd,
What I sent you it possible to understand what the problem is?

Thx.

Hey!

I’m a bit swamped with tasks lately and I cannot promise to look at this today. I’ve added it to my backlog and I’ll try to check it out in the next few days.

@zyga-snapd As you’ll come back here in the next few days, I’m moving this to upcoming.

Thx @zyga-snapd, I’ll wait when you have time.

Hi @zyga-snapd, I wanted to ask you if it was possible to understand the error.
Thx.

Hey @blinct, sorry for the delay.

I’ll check this out now. I sent you a PM with a request for the full snap file to examine.