Error With xdg-desktop-portal-gtk service, on fedora 38 Server

I am in the process of customizing a fedora server installation with xserver and any window manager as a side project, but i cannot make xdg-desktop-portal-gtk to work. Any application trying to use the gtk backend craches. Looking into the systemctl --user status xdg-desktop-portal-gtk, i can see that that the service has failed and aborted with an error message of xdg-desktop-por[4669]: cannot open display. I am trying things out on a VM so i dont expect any driver issues. Trying to start the service again causes the same error.
I dont know what is configured wrong in the system, but i have documented the simple steps i have followed and the installed packages in a readme
Additionally with some google searching i found about the /usr/share/xdg-desktop-portal/portals/gtk.portal file and changed the UseIn=bspwm but nothing changed.
Any help is welcome, thank you!

journalctl -u xdg-desktop-portal-gtk
Provide logs.

Yea sorry, i should have provided logs from the start…
This is a snippset from the logs of the system initialization

And each time a application using the gtk backend is started the journal looks something like the following

The journalctl -u xdg-desktop-portal-gtk commands returns – No entries –. Probably because the service never runs in the first place ?
Thanks dearly for the help :slight_smile:

Check if the service is installed: Verify that the xdg-desktop-portal-gtk package is installed
Provide output in </>

systemctl enable xdg-desktop-portal-gtk.service
systemctl start xdg-desktop-portal-gtk.service

The package is already installed. However trying to enable the service returns with the following error:

Failed to enable unit: Unit file xdg-desktop-portal-gtk.service does not exist.

Of course trying to start the service leads to the same error:

Failed to start file xdg-desktop-portal-gtk.service: Unit file xdg-desktop-portal-gtk.service not found.

Since the xdg-desktop-portal.service is a --user service i also tried the same commands with the --user option and the enable command returns the following:

The unit files have no installation config (WantedBy=, RequiredBy=, Also=,Alias= settings in the
[Install] section, and DefaultInstance= for template units). This means they are not meant to be
enabled or disabled using systemctl.

Looking through my host device, the xdg-desktop-portal-gtk"service" has exactly the same behavior. So this may be expected ?

My bet might be the xdg-desktop-por: cannot open display warning. Looking around I came across with the following (Reddit - Dive into anything). That at least might prove helpful.

That service shows this on my system.

$ systemctl --user status xdg-desktop-portal-gtk
● xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Thu 2023-07-06 21:12:54 CDT; 18h ago
   Main PID: 3765 (xdg-desktop-por)
      Tasks: 5 (limit: 38356)
     Memory: 6.0M
        CPU: 1.609s
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gtk.service
             └─3765 /usr/libexec/xdg-desktop-portal-gtk

Jul 06 21:12:52 eagle.home.domain systemd[2720]: Starting xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation>
Jul 06 21:12:54 eagle.home.domain systemd[2720]: Started xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation).

Notice that service is static and does not get enabled or disabled.

1 Like

Remove it and reinstall it first that you can do.
From the output it does not seems like it installed.

Update: Thanks Both for the Help.
The service and the package existed.
The problem seem to disappear when initializing the Xserver through lightdm (Any display manager should do) instead of just running startx. ( Something that in hindsight should have mentioned from the start ). That way the static service is exactly like Jeff V mentioned. The environmental variables or something else does not get set / initialized correctly and that leads to the error xdg-desktop-por: cannot open display. Even when i env DISPLAY=:0 the error persists. There is a greater problem with initializing just through xinitrc.

Possibly i should end the topic because the error is not with xdg-desktop-portal but with how to correctly initialize Xserver through startx. Thanks again for the help :slight_smile: