"Deploy failed" while trying to run apps from Linux / Sailfish IDE

Hi there,

I am not very used to develop apps and when I do I am quite happy with printf debugging.

However, this time I need to understand the code of an existing app and I would’ve liked to try the SailfishIDE debugger for that.

The app I’m trying to run in Amazfish. I did enter the tool/target to add chum and the kf5 deps. The target device(s) - I’ve tried the C2 and Zenfone 8 - also have chum and amazfish already installed.

When using the debug button in SailfishIDE, the end of the output is

sending incremental file list
harbour-amazfish-2.5.0-1.aarch64.rpm

sent 5,083,296 bytes  received 35 bytes  3,388,887.33 bytes/sec
total size is 5,081,921  speedup is 1.00
Installing harbour-amazfish-2.5.0-1.aarch64.rpm
Deploy failed
02:15:56: The process "/home/vlad/SailfishOS/bin/sfdk" exited with code 1.
Error while building/deploying project harbour-amazfish (kit: SailfishOS-4.6.0.13-aarch64 (in sailfish-sdk-build-engine:vlad))

The SDK/sfdk was installed using Docker.

What I tried:

  • restart docker service on the host
  • update and check virtualbox works - maybe it is still needed
  • re-creating deployment keys (another set instead of default).

Any other ideas?


Thanks!

Not sure what you mean with SailfishIDE. For SailfishOS SDK in my experience the installation of SDK and VirtualBox is fine, when you see messages like:
sent 5,083,296 bytes received 35 bytes 3,388,887.33 bytes/sec
total size is 5,081,921 speedup is 1.00
Installing harbour-amazfish-2.5.0-1.aarch64.rpm

In case of the SailfishOS SDK you can try the build option “Build RPM Package for Manual Deployment”, inspect the created rpm, copy the rpm to your device and install. The install process maybe will show the real problem.

Please share your findings. Thx.

Some more context: Failed to request file installation: "Not connected to D-Bus server" is the error from sfdk deploy --sdk.

Thanks for your suggestion - indeed that works for the deployment, not sure how to debug then the attaching to a running process fails with gdbserver getting “Operation not permitted” on the phone,

Selecting “Deploy by copying binaries” seems to correctly start the attached debugger, but the service I want to debug seems it is launched in another way, that it is not able to read config file(s) and connect to DBus(?).


P.S. Sailfish IDE is the name of the shortcut pointing to ~/SailfishOS/bin/qtcreator

“Deploy by copying binaries” has some issues in earlier versions of the SDK. Here you are up to date? Whats happend using “Deploy as RPM packes”. The debugger will work with this. But you confirm the installing of the RPM on your device.

Maybe there is another difference. Please check the user used in the debugging process. Maybe there is your point. As I remember acts not with your good name. And so the path is changed.

printf debuging getting worse here … :slight_smile:

The dbus error seems to be in the logs of the device:

 sdk-deploy-rpm[17685]: QObject::connect: No such signal QDBusAbstractInterface::installFinished(bool,QString)
 sdk-deploy-rpm[17685]: QObject::connect: No such signal QDBusAbstractInterface::needConfirm()
 sdk-deploy-rpm[17685]: Failed to request file installation: "Not connected to D-Bus server"

I traced that back to sdk-deploy-rpm which is installed and works and sailfish-installationhandler which is also installed and responds as user to

dbus-send --type=method_call --print-reply --dest=org.sailfishos.installationhandler /org/sailfishos/installationhandler org.freedesktop.DBus.Introspectable.Introspect

with (snippet)

<node>
  <interface name="org.sailfishos.installationhandler">
    <signal name="installFinished">
      <arg name="success" type="b" direction="out"/>
      <arg name="errorString" type="s" direction="out"/>
    </signal>
    <signal name="needConfirm">
    </signal>

Since all this works on the device, and Qt Creator executes sfdk deploy --sdk (that also fails for me from the host), and only by this code path it is failing, - and on any device of mine - I would assume the bug is in sfdk on the host… grepping through sailfish-qtcreator/src/tools/sfdk/ and sailfish-qtcreator/src/libs/sfdk next…

Got an inch closer - I moved /usr/bin/sdk-deploy-rpm to /usr/bin/sdk-deploy-rpm-bin and replaced it with a wrapper script:

#!/bin/env sh
LOGGIN=/var/tmp/sdk.log
echo "=====" >> $LOGGIN
set >> $LOGGIN
echo "-----" >> $LOGGIN
ps aux | grep $PPID >> $LOGGIN
echo "-----" >> $LOGGIN
echo whoami=$(whoami) >> $LOGGIN
echo "sdk-deploy-rpm $@" >> $LOGGIN

# Have our tee and eat it too
set -o pipefail
strace -o $LOGGIN.strace /usr/bin/sdk-deploy-rpm-bin "$@" | tee -a $LOGGIN
exit "$?"

And what is immediately visible in the log is that the set command does not show user profile vars. Adding this in the wrapper:

# Attempt for fix
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/100000/dbus/user_bus_socket

does proceed with installation, but then running the app fails…

error: XDG_RUNTIME_DIR is invalid or not set in the environment.
[C] unknown:0 - Failed to create display (No such file or directory)

The ppid is sshd-session. Since all phone devices exhibit this error, I will again assume sfdk from my laptop is the culprit, but this time I am thinking of a ssh client parameter mishandling / recent behavior change on my OS.

Ok, after much stracing and env printing, I found this variable ENV=/usr/libexec/openssh/load_developer_profile which lead me to believe that script was supposed to be executed.

After much back and forh why is it not (again, logging from it) and seeing that the emulator device did execute it…

I just switched from gnu-bash back to busybox-symlinks-bash and… deployment started to work :angry:

On all my devices I had gnu-bash, turns out.

Basically if you run ENV=/path/to/some/script bash with busybox, the script gets sourced. Not with bash though. Unless your shell is /bin/sh, in which case it is.

My local man sh says

ENV This variable, when and only when an interactive shell is invoked, shall be subjected to parameter expansion (see Section 2.6.2, Parameter Expansion) by the shell, and the resulting value shall be used as a pathname of a file containing shell commands to execute in the current environment. The file need not be executable. If the expanded value of ENV is not an absolute pathname, the results are unspecified. ENV shall be ignored if the real and effective user IDs or real and effective group IDs of the process are different.

This is one of the aspects where bash is not Posix compliant.

In /etc/ssh/sshd_config, there is a lineSetEnv ENV=.... You could try replacing ENV on that line with BASH_ENV . I think that could work with bash, but then again it won’t work with the busybox version.

1 Like

Not sure about compliance, didn’t dig further than the man page that specifically says “when and only when an interactive shell is invoked”

What made me less happy was that this was only ever tested with busybox…

But thanks for answering @vige, your guidance around sfdk was put into action here :wink: