Bug 476647 - xdg-portal-desktop-kde start after xdg-portal-desktop, if it even starts
Summary: xdg-portal-desktop-kde start after xdg-portal-desktop, if it even starts
Status: REPORTED
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 5.27.9
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-06 22:03 UTC by Dennis
Modified: 2025-09-09 07:28 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Solus KDE Discover Boot Log Diff (405.51 KB, application/gzip)
2025-09-09 07:28 UTC, Joshua Vanderzee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis 2023-11-06 22:03:40 UTC
SUMMARY

I have this problem on all of my Arch Linux systems, and they are installed at different time, one is only a few weeks old.
The problem is that the user service "xdg-portal-desktop-kde.service" starts before the service "xdg-portal-desktop.service".

I have tried to search on the web, but without any real luck.

STEPS TO REPRODUCE
1. Reboot the computer and login into a user
2. Run system "systemctl --user status plasma-xdg-desktop-portal-kde.service xdg-desktop-portal.service"

OBSERVED RESULT
```text
○ plasma-xdg-desktop-portal-kde.service - Xdg Desktop Portal For KDE
     Loaded: loaded (/usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service; static)
     Active: inactive (dead)

● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Mon 2023-11-06 21:55:47 CET; 9s ago
   Main PID: 756 (xdg-desktop-por)
      Tasks: 6 (limit: 18586)
     Memory: 6.9M
        CPU: 36ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─756 /usr/lib/xdg-desktop-portal

Nov 06 21:55:47 my-pc systemd[698]: Starting Portal service...
Nov 06 21:55:47 my-pc xdg-desktop-por[756]: No skeleton to export
Nov 06 21:55:47 my-pc systemd[698]: Started Portal service.
```

EXPECTED RESULT
```text
● plasma-xdg-desktop-portal-kde.service - Xdg Desktop Portal For KDE
     Loaded: loaded (/usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service; static)
     Active: active (running) since Mon 2023-11-06 22:34:06 CET; 5s ago
   Main PID: 4875 (xdg-desktop-por)
      Tasks: 5 (limit: 18586)
     Memory: 18.9M
        CPU: 65ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-xdg-desktop-portal-kde.service
             └─4875 /usr/lib/xdg-desktop-portal-kde

Nov 06 22:34:06 my-pc systemd[698]: Starting Xdg Desktop Portal For KDE...
Nov 06 22:34:06 my-pc systemd[698]: Started Xdg Desktop Portal For KDE.

● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Mon 2023-11-06 22:34:06 CET; 5s ago
   Main PID: 4878 (xdg-desktop-por)
      Tasks: 8 (limit: 18586)
     Memory: 4.4M
        CPU: 18ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─4878 /usr/lib/xdg-desktop-portal

Nov 06 22:34:06 my-pc systemd[698]: Starting Portal service...
Nov 06 22:34:06 my-pc systemd[698]: Started Portal service.
```

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: ArchLinux/5.27.9
(available in About System)
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION

My current workaround is to create the following 2 files:

/usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service.d/override.conf

```ini
[Unit]
Before=xdg-desktop-portal.service
Upholds=xdg-desktop-portal.service

[Service]
# Environment=QT_LOGGING_RULES=*.debug=true QT_DEBUG_PLUGINS=1

[Install]
WantedBy=plasma-workspace.target
```

/usr/lib/systemd/user/xdg-desktop-portal.service.d/override.conf

```ini
[Unit]
BindsTo=plasma-xdg-desktop-portal-kde.service
PartOf=plasma-xdg-desktop-portal-kde.service

[Service]
# Environment="G_MESSAGES_DEBUG=all"

Restart=on-failure
```

and enable the service `plasma-xdg-desktop-portal-kde.service` by running

```bash
systemctl --user enable plasma-xdg-desktop-portal-kde.service
```
Comment 1 Joshua Vanderzee 2025-09-09 07:17:00 UTC
I am experiencing this same race condition on Solus with Plasma 6.4.4.

I have confirmed my system integrity is clean (eopkg check passes) and that the underlying backends (pkcon, flatpak) work correctly from the command line.

Most importantly, I have fully implemented the systemd override workaround suggested in this report (creating both override.conf files and enabling the service), and the xdg-desktop-portal-kde service still fails to start correctly after a normal shutdown and boot.

The only thing that has ever allowed the service to start correctly was a complete battery drain of the laptop.

I am attaching a diff of the system logs from a successful boot (after the power drain) versus a failed boot, which clearly shows the org.freedesktop.DBus.Error.NoReply timeout failure.

Discover does not bring up a window in the bad state, and on the good state I encountered a "The name is not activatable" but the service is running.
Comment 2 Joshua Vanderzee 2025-09-09 07:28:43 UTC
Created attachment 184832 [details]
Solus KDE Discover Boot Log Diff

My boot log from my diff command.