Firejail sometimes gets reliably stuck, unable to open application

REPRODUCIBILITY: Variable, happens almost daily, don’t know how to reliably reproduce
OS VERSION: 4.5.0.24
HARDWARE: Xperia XA2 - Dual SIM
UI LANGUAGE: Finnish
REGRESSION: n/a

DESCRIPTION:

Sometimes, firejail gets stuck. When I close the child process from the GUI, or if the child process dies because of something else, the parent firejail process hangs around. If I try to restart the application from the GUI, it tries for a while, and then gives up. If I try to run just the application from the CLI, outside firejail, it will start, but its permissions won’t work. If I try to run the application in firejail from the CLI, it says “Error: can’t chdir to privileged” and will get as stuck as the other stuck firejail process: I cannot kill it by ctrl-C, nor by sending SIGKILL or SIGTERM from another terminal. It’s just stuck. The only way to unstuck it is to reboot the whole phone.

PRECONDITIONS:

I really don’t know. I try to restart a program - e.g. jolla-calendar, jolla-messages, etc - that has stopped before, either by me stopping it or by it crashing. It does not start. But this doesn’t happen always; sometimes, there’s no stuck firejail process, and the program will start.

STEPS TO REPRODUCE:

  1. Stop a program, eg. jolla-messages, jolla-calendar
  2. Try to restart it
  3. Repeat until you get the behaviour described (will sometimes happen on the first time, will sometimes take days)

EXPECTED RESULT:

Firejail process dies when the child dies. A new firejail and child is started.

ACTUAL RESULT:

Firejail process does not die when the child dies and cannot be killed by any means short of restarting the phone. Trying to start the program anew fails.

MODIFICATIONS:

ADDITIONAL INFORMATION:

I think this appeared at some point during Sailfish 4 but not sure when. Earlier, if a program was stuck, I could always kill it from the CLI. But these firejail processes won’t die anymore.

1 Like

My first thought, back up what you can and go for reinstall of the OS.

Second thought, decided to look for sailjail in the repo, by devel-su pkcon search name sailjail and note that it is installed and can likely be uninstalled, if not the CLI should warn you it’s not possible as it will break the system and so uninstall will quit.

Third thought, while in CLI, hit devel-su pkcon refresh, the do devel-su pkcon update. Perhaps this might help fix any broken packages.

All of this is guess work, but if it were me, I’d likely reinstall the OS and start afresh!

I sometimes also have messages app that won’t start again. After several minutes (5, 10, 15?), it starts again.
Perhaps the same cause as yours.
How did you find out that some SJ processes were the culprits?

@Edz I don’t think uninstalling firejail/sailjail is a good idea. Same for re-installing the OS - that way we won’t find out what’s going on.

I think I have seen similar behavior on my phone but not so often.

As ric9k asked: how do you know that specific firejail process is still around?
Have you tried killing it with root privileges?
Assuming that succeeds, can you then normally restart the app in question?

I had a similar problem when i single-instance-adapted SeaPrint.
In that case it was the ExecDBus/prestart pattern that was (is) the culprit. If i restart an app that uses that pattern too fast the name sometimes has not been freed up on dbus, the prestart instance fails silently, and the call that would bring it to front goes somewhere out into the void.

This was very reproducible even with e.g. the Documents app. However, it would self-heal in not too long, so no restart or further action was needed for me.

So i guess i’ll add to the crowd asking: “how do you observe this?”.

Messages not restarting several times a day happens a lot to mes atm.

Journalctl gives this:

Summary

Mar 06 16:39:03 XperiaXA2-DualSIM systemd[5536]: jolla-messages.service: Start operation timed out. Terminating.
Mar 06 16:39:03 XperiaXA2-DualSIM /usr/libexec/mapplauncherd/booster-generic[5582]: warning: terminating: booster:965 invoker:1525 socket:12
Mar 06 16:39:03 XperiaXA2-DualSIM /usr/libexec/mapplauncherd/booster-generic[5582]: warning: Daemon: sending exit(1) to invoker(1525)
Mar 06 16:39:03 XperiaXA2-DualSIM /usr/libexec/mapplauncherd/booster-generic[5582]: warning: sending SIGTERM to booster (pid=965)
Mar 06 16:39:03 XperiaXA2-DualSIM systemd[5536]: jolla-messages.service: Failed with result ‘timeout’.
Mar 06 16:39:03 XperiaXA2-DualSIM systemd[5536]: Failed to start Jolla messaging.

I’m suspecting the Messages app being too long to start as I have a lot of messages.
(incl. all N900 SMSes since ~2011 too. I know, I know… :-))

Setting a longer timeout would perhaps help, as it says “Start operation timed out. Terminating.” ?
So the question is: How do one set the timeout for apps startup?

How do I know a specific firejail process is still around? By looking at the process list and taking note that it’s the same PID as before. And yes, I’ve tried to kill it using root privileges, both with SIGTERM and SIGKILL. It doesn’t react to them. There really seems to be no way to get rid of it short of restarting the phone, I assume it has something to do with the more advanced privileges or sandboxing or something that modern Linux kernels have that I’m not at all familiar with. It used to be the case that root could do anything, less so these days.

I guess this is the salient point.

Which process is that again? I can’t seem to wrapmy head around your issue anymore.

The firejail process that doesn’t die when the application inside it dies or is terminated from the GUI. Once one firejail process is stuck, I cannot restart the application from the GUI - e.g. jolla-camera or whatever, sometimes the messaging app, sometimes jolla-browser. What happens is, the GUI launches a new firejail process that tries to get some resource that is hogged by the stuck firejail process and the new firejail process also ends up stuck. The only way to get rid of these firejail processes and to start the application inside firejail again is to reboot the phone.

I can restart the application from the CLI outside firejail though. But then I don’t get access to all the resources the application might need (e.g. contacts).