Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subprocess and systemctl issues in Flatpak #80

Open
Torbuntu opened this issue Sep 2, 2021 · 6 comments
Open

Subprocess and systemctl issues in Flatpak #80

Torbuntu opened this issue Sep 2, 2021 · 6 comments
Labels
bug Something isn't working flatpak-issue

Comments

@Torbuntu
Copy link

Torbuntu commented Sep 2, 2021

Version: 0.9.0
Install: Flathub's flatpak
OS: Fedora Mobile Remix

When selecting a device in siglo and the Keep paired toggle is active, Siglo throws an errors in the console:

Traceback (most recent call last):
  File "/app/share/siglo/siglo/window.py", line 209, in on_watches_listbox_row_activated
    subprocess.Popen(["systemctl", "--user", "start", "siglo"])
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'systemctl'

I'm thinking that this means flatpak can't make calls directly to systemcl.

I did quickly find this article: https://gabmus.org/posts/making-a-dbus-daemon/ which lays out how to setup a daemon in a flatpak using python. Hopefully something in there can be of use?

Let me know if I can help collect any other information.

@theironrobin
Copy link
Owner

@jwillikers i just want to run systemctl in a subprocess. is this a quick fix to get it working on flatpak?

@jwillikers
Copy link
Contributor

@alexr4535 Not without subverting the sandbox by allowing arbitrary code execution on the host. There's an existing Flatpak issue, flatpak/flatpak#2787, regarding this kind of thing, but a solution for Systemd isn't available yet. I know GTK/GNOME exposes functions for running in the background, which should integrate nicely with Flatpak, like this comment mentions. I think there's way that GTK Flatpaks like GNOME Boxes, Geary, and NewsFlash accomplish this which integrates with the Background portal. I can look more into this when I get time.

@theironrobin
Copy link
Owner

Thanks, I've added a warning to the readme that SMS notifications are broken currently in the flatpak version

@jwillikers
Copy link
Contributor

jwillikers commented Sep 3, 2021

The graphical apps that I mentioned seem to run in the background by hiding their main window when it is closed instead of exiting the application. This combined with the background portal should be enough run continually in the background, granted this doesn't provide service management in case of a crash. A Systemd user unit could be provided to users to manually install / enable for running the Flatpak'd Siglo app as a Systemd service until this is possible in Flatpak itself.

@WhyNotHugo
Copy link

When selecting a device in siglo and the Keep paired toggle is active,

Thanks for mentioning this, I was at a dead end and hadn't realised that turning the toggle off fixed it.

@WhyNotHugo
Copy link

Siglo tries to run systemctl, but that's not installed its package/image. There's two potential fixes for this:

  • Check if systemctl is executable, and hide the button if it isn't. This'll hide it in the flatpak for now, or any other isolation where that binary is not present.
  • Use systemd's D-Bus API. This won't work with flatpak (due to Consider exporting systemd user units flatpak/flatpak#2787), but will work on firejail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flatpak-issue
Projects
None yet
Development

No branches or pull requests

4 participants