How can i add a daemon in a flatpak?

Alec Leamas leamas.alec at gmail.com
Thu Jul 7 09:27:52 UTC 2022


Hi Lothar,

On 03/07/2022 05:18, Lothar Scholz wrote:
> For my P2P application i need a sync daemon running always.
> 
> Is there any way to set this up with flatpak?
> It's just putting a little config file into the systemd directory.
> 
> What about user daemon that run during every user session?
> Is this possible?


I'm not the expert here, but perhaps have some notes.

First: "Just adding a file to the systemd directory" actually requires 
root permissions. Flatpak is definitely not designed to have root 
permissions, so this track is likely to run into all sorts of problems.

Installing files into ~/.config/systemd/user should be possible if you 
give your application access to these areas. However, running systemd 
commands is another issue, see below.

A user daemon is sort of possible. The main problem is that a Flatpak 
application isn't allowed so start separate processes by default, for 
this it needs --devel permissions. Given such, it can start a process 
-- we are using this to have a helper process in a corner case involving 
a specific plugin.

Another dirty way we are using to install a udev rule is to provide 
simple command line instructions which user can copy-paste to install 
using sudo.

However, if I understand you correctly you need a "real" daemon which 
runs in the background. For this, IMHO Flatpak just isn't the right 
tool, it is designed to handle GUI programs.

HTH,
--alec


More information about the Flatpak mailing list