Posix does not work in Flatpak package while it works in the ordinary compiled one

58 Views Asked by At

I have simple app, one of its functionalities ends with shutting down the computer using Posix.system("shutdown now"); In the ordinary ninja compiled version, the app works fine. However, in the flatpak version, it does not work. I tried to repackaging it again with adding couple of finish args in the yml file.,

finish-args:
  - '--share=ipc'
  - '--socket=fallback-x11'
  - '--socket=wayland'
  - '--filesystem=home'
  - '--socket=session-bus'
  - '--socket=system-bus' 

but it does not work too.

1

There are 1 best solutions below

0
On

This is likely due to Flatpaks running in a sandbox with limited permissions, this prevents access to other processes and limits access to the operating system.

You have given your Flatpak access to the system D-Bus, so you can try using the PowerOff method available through org.freedesktop.systemd1.Manager.