SystemD --user services (from ~/.config) break container's xdg-open

For a long time, I had a problem, where xdg-open ran from inside of a container would result in something like Error: no DISPLAY environment variable specified.

I found out that it only happens on fresh boot and if I log out and log in again, it works as it should.

Eventually I found out that if I disable all --user services that I manually put in ~/.config/systemd/user, it works like expected (on fresh boot without logging out).

I still have podman.socket from /usr/lib/systemd/user enabled and that doesn’t cause the problem.

Tested it on my custom image on PC1 and on silverblue-main on a different PC2. It breaks on both.

The service I used to ran is Syncthingy service. Could someone confirm that this is an actual issue and perhaps offer a solution ? I have no idea what else I could do about it.

Not sure if this is your exact issue, but we had experienced similar behavior with Flatpaks in Clicking from flatpak apps doesn't open the browser · Issue #575 · ublue-os/bluefin · GitHub (including log-out-then-log-back-in being a workaround, and the problem going away when all user services are disabled and, in my case, the SyncThingy Flatpak being affected). The fix there was to check whether any user services have a directive which causes to start prematurely (in our case via a Requires= directive) - and remove any such directives (in our case from ublue-user-setup.service).

1 Like

Yeah I thought that might be related, but I guess it’s not. :confused:

Just tried in a VM (silverblue-main), only enabled the syncthingy.service.

  • Clicking links in Flatpak works (NewsFlash flatpak, link in an article)
  • xdg-open from a distrobox container does not.

You might have a look at what i did here, there might be pieces that you might want to replicate…

Especially the entry i use in the install section…