emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
596 stars 59 forks source link

xdpw fails to start automatically #123

Closed ghost91- closed 3 years ago

ghost91- commented 3 years ago

I have problems with xdpw not starting automatically. I don't really have any idea what is going on. xdg-desktop-portal seems to start correctly and also tries to use xdpw but the xdpw service fails to start for some reason. I am using Arch with sway. Here are some logs:

loherj@avior:~> systemctl -n500 --user status xdg-desktop-portal-wlr.service
● xdg-desktop-portal-wlr.service - Portal service (wlroots implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-wlr.service; static)
    Drop-In: /home/loherj/.config/systemd/user/xdg-desktop-portal-wlr.service.d
             └─override.conf
     Active: activating (start) since Mon 2021-04-26 17:07:29 CEST; 921us ago
   Main PID: 13227 (xdg-desktop-por)
      Tasks: 1 (limit: 38189)
     Memory: 256.0K
        CPU: 80us
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-wlr.service
             └─13227 /usr/lib/xdg-desktop-portal-wlr --loglevel=DEBUG

Apr 26 17:07:29 avior systemd[1285]: Starting Portal service (wlroots implementation)...
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [INFO] - config: no config file found
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [DEBUG] - config: config file parsed
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [DEBUG] - config: outputname  (null)
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [DEBUG] - config: chooser_cmd: (null)
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [DEBUG] - config: chooser_type: default
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [DEBUG] - dbus: connected
Apr 26 17:07:29 avior xdg-desktop-portal-wlr[13227]: 2021/04/26 17:07:29 [ERROR] - wayland: failed to connect to display
Apr 26 17:07:29 avior systemd[1285]: xdg-desktop-portal-wlr.service: Main process exited, code=exited, status=1/FAILURE
Apr 26 17:07:29 avior systemd[1285]: xdg-desktop-portal-wlr.service: Failed with result 'exit-code'.
Apr 26 17:07:29 avior systemd[1285]: Failed to start Portal service (wlroots implementation).

Logs from xdg-desktop-portal:

loherj@avior:~> /usr/lib/xdg-desktop-portal -r -v
XDP: load portals from /usr/share/xdg-desktop-portal/portals
XDP: loading /usr/share/xdg-desktop-portal/portals/wlr.portal
XDP: portal implementation for sway, Wayfire, river
XDP: portal implementation supports org.freedesktop.impl.portal.Screenshot
XDP: portal implementation supports org.freedesktop.impl.portal.ScreenCast
XDP: providing portal org.freedesktop.portal.MemoryMonitor
XDP: providing portal org.freedesktop.portal.NetworkMonitor
XDP: providing portal org.freedesktop.portal.ProxyResolver
XDP: providing portal org.freedesktop.portal.Trash
XDP: providing portal org.freedesktop.portal.GameMode
XDP: providing portal org.freedesktop.portal.Settings
XDP: Using wlr.portal for org.freedesktop.impl.portal.Screenshot in sway

** (/usr/lib/xdg-desktop-portal:14889): WARNING **: 17:39:28.055: Failed to create screenshot proxy: Fehler beim Aufruf von StartServiceByName für org.freedesktop.impl.portal.desktop.wlr: Zeitüberschreitung wurde erreicht

** (/usr/lib/xdg-desktop-portal:14889): WARNING **: 17:39:28.055: No skeleton to export
XDP: Using wlr.portal for org.freedesktop.impl.portal.ScreenCast in sway

** (/usr/lib/xdg-desktop-portal:14889): WARNING **: 17:39:53.080: Failed to create screen cast proxy: Fehler beim Aufruf von StartServiceByName für org.freedesktop.impl.portal.desktop.wlr: Zeitüberschreitung wurde erreicht

** (/usr/lib/xdg-desktop-portal:14889): WARNING **: 17:39:53.080: No skeleton to export
XDP: org.freedesktop.portal.Desktop acquired

The override of the systemd service file doesn't do anything aside from setting the log level and adding a restart delay, otherwise it's the same as the one provided by Arch:

[Unit]
Description=Portal service (wlroots implementation)
PartOf=graphical-session.target
After=graphical-session.target

[Service]
Type=dbus
BusName=org.freedesktop.impl.portal.desktop.wlr
ExecStart=
ExecStart=/usr/lib/xdg-desktop-portal-wlr --loglevel=DEBUG
Restart=on-failure
RestartSec=5

If I start xdpw manually with /usr/lib/xdg-desktop-portal-wlr -r (with xdg-desktop-portal not running yet), everything works fine when I try to start sharing. If xdg-desktop-portal is already running when I manually start xdpw, I can't get it to work. Any idea what might be going on here? The funny thing is that this has worked fine for me in the past and suddenly stopped without me changing anything (except for installing system updates). It also works on another laptop, where I didn't do anything differently, as far as I know. Is there any more information I can provide to find out what's going on?

danshick commented 3 years ago

Can you take a look at this document? Specifically items four and five? https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist

ghost91- commented 3 years ago

Thanks for your help, I didn't see this document until know. Item 5 did the trick. Any idea why this might be necessary one one system but not the other? They are basically set up in exactly the same way for all I know.

danshick commented 3 years ago

Thanks for your help, I didn't see this document until know. Item 5 did the trick. Any idea why this might be necessary one one system but not the other? They are basically set up in exactly the same way for all I know.

No problem. Importing environment variables from sway into systemd has never been optional to avoid edge cases, but it has recently began to bite more people. As best I can guess, when WAYLAND_DISPLAY === "wayland-0" a default value in the wayland protocol code "guesses" it correctly. If it is any other value, importing the environment is the only fix.

This is equally important a step for ensuring XDG_CURRENT_DESKTOP is correctly set.