regolith-desktop
regolith-desktop copied to clipboard
Long delays for app launch of x11 and sway sessions on mantic
This issue is blocking the Regolith 3.1 beta release
probably related:
- https://bugzilla.redhat.com/show_bug.cgi?id=2176759
- https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/74
- https://forum.manjaro.org/t/very-slow-startup-on-some-apps-after-update/141806
Verified that the package causing the issue (xdg-desktop-portal-gnome
) is installed by default in Mantic. Unsure of the repercussions to flatpack users if we add a conflicts such that this package is removed upon Regolith install. Searching for workarounds that do not require removal of packages, but so far no luck.
It looks like a fix was merged upstream a few months: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/95
I worked-around this issue by masking the systemd-unit:
systemctl --user mask xdg-desktop-portal-gnome
Unfortunately this breaks screen sharing. Setting XDG_CURRENT_DESKTOP=sway
as per https://github.com/orgs/regolith-linux/discussions/914 restores the functionality but seems to have other side effects, such as not allowing me to run gnome-control-center
Anyone got a better workaround?
deeper down the rabbit hole: https://github.com/linuxmint/cinnamon/issues/11857
It looks like a fix was merged upstream a few months: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/95
I could be wrong but this fix only applies in cases where wayland and x11 backends fail to initialize for some reason. In grepping logs on an affected machine, I don't notice this error path executing (the path that provides only settings). I don't think this particular patch applies to our situation, but would love to hear if I'm incorrect.
This appears to be the intended escape hatch for DEs like regolith, but early attempts at setting this up don't result in a fix.
https://man.archlinux.org/man/portals.conf.5
My working theory is that it is possible to use portals.conf
to route dbus bindings to the appropriate portal backends for Regolith. This hypothetical configuration would prevent the xdg-desktop-portal-gnome
portal from being invoked in cases that timeouts would occur.
This theory rests in part upon the guess that the app launch delays are a result of timeouts (vs something else). eg
xdg-desktop-por[62144]: Failed to create settings proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
I've tried ~10 variations on this, and have noticed changes in log failures based on variation (leading me to guess that the regolith config is being read, although I have no direct evidence), but have yet to be able to launch apps upon session start without the delay if the gnome
portal package is installed.
~$ cat /usr/share/xdg-desktop-portal/regolith-portals.conf
[preferred]
default=wlr;gtk;
this command's output seems helpful:
$ /usr/libexec/xdg-desktop-portal --verbose
evidence that regolith config file is being loaded:
XDP: Using portal configuration file '/usr/share/xdg-desktop-portal/regolith-portals.conf' for desktop 'regolith'
a hint at what's causing the delay (this log entry is printed after ~1 min delay, when xdg-desktop-portal-gnome
is installed:
(/usr/libexec/xdg-desktop-portal:81487): xdg-desktop-portal-WARNING **: 00:40:10.425: Failed to create background proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
Budgie DE's portal config: https://github.com/BuddiesOfBudgie/budgie-desktop/blob/main/data/budgie-portals.conf
Verified that previous ubuntu versions (23.04) did contain the package xdg-portal-desktop-gnome
(version 44)
Filed an issue against GNOME for help: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104
Configuration elements believed to be associated with this issue:
-
XDG_CURRENT_DESKTOP
value -
/usr/share/xdg-desktop-portal/regolith-portals.conf
- Debian package
xdg-desktop-portal-gnome
Debugging tool: https://github.com/bilelmoussaoui/ashpd
https://github.com/bilelmoussaoui/ashpd/issues/174
vala
based backend implementation: https://github.com/elementary/portals
For what it's worth, I was having this issue after updating to mantic. I ended up running sudo apt purge xdg-desktop-portal-gnome
and it solved my problem. I admit to basically having no idea what I'm doing with this stuff but I don't seem to have created a different problem for myself. Zoom screen sharing still works, Flameshot still works, the Gnome settings app still works.
I can post any configuration, environment settings or logs if that would be helpful.
Edit 27-NOV-2023: Full screen sharing works but I have lost the ability to share just a specific window
Thanks for the feedback @dpbackes!
Zoom screen sharing still works, Flameshot still works, the Gnome settings app still works.
Do you mean, these work within a Regolith session, or another session? I guess my concern is that not having xdg-desktop-portal-gnome
installed will cause regressions while using gnome-shell or other gnome-based sessions.
I have had some limited success in overcoming what I believe to be the rootcause for the launch delay:
xdg-desktop-por[5678]: Failed to create settings proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
I took the Elementary OS portal implementation and modified it to be the "Regolith" portal backend (see patch). I updated the dbus bindings such that it responds to the org.freedesktop.impl.portal.desktop.gnome
dbus name.
If I manually start the backend from the command-line, and then launch a gtk-based app (calculator), the timeout message does not appear in the log and the app does not appear to have a startup delay, while logged into the X11 regolith session and having xdg-desktop-portal-gnome
installed.
~$ /usr/libexec/xdg-desktop-portal-regolith -r -v
** (xdg-desktop-portal-regolith:7347): DEBUG: 09:18:04.504: XdgDesktopPortalRegolith.vala:36: Access Portal registered!
** (xdg-desktop-portal-regolith:7347): DEBUG: 09:18:04.504: XdgDesktopPortalRegolith.vala:39: AppChooser Portal registered!
** (xdg-desktop-portal-regolith:7347): DEBUG: 09:18:04.505: XdgDesktopPortalRegolith.vala:42: Background Portal registered!
** (xdg-desktop-portal-regolith:7347): DEBUG: 09:18:04.506: XdgDesktopPortalRegolith.vala:49: org.freedesktop.impl.portal.desktop.gnome acquired
** (xdg-desktop-portal-regolith:7347): DEBUG: 09:18:13.346: XdgDesktopPortalRegolith.vala:57: bus watch 2
elementary-portal-patch.diff.zip
It's unclear to me why the portals broker is not automatically loading my backend. I did not spend much time with the patching though, it could be that I missed something. I believe my backend should be being loaded because:
-
XDG_CURRENT_SESSION = Regolith;GNOME-Flashback;GNOME
-
/usr/share/xdg-desktop-portal/portals/regolith.portal
exists
CC @SoumyaRanjanPatnaik
Hey. I was going to try and replicate your findings on my system. So I installed the xdg-desktop-portal-gnome
package. But surprisingly enough, the launch delay did not exist for me.
I have no idea what fixed it. Maybe an update to xdg-desktop-portal
? Sounds unlikely. Do you have any ideas how I can re-bug my system and in the process, figure out a potential fix?
Maybe this? - https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/95
BTW you might to look at these issues /comments -
- https://github.com/flatpak/xdg-desktop-portal/pull/955#issuecomment-1705301396
- https://github.com/flatpak/xdg-desktop-portal/issues/656#issuecomment-966276573
Thanks for the links Soumya. I'm digging more into what org.freedesktop.impl.portal.desktop.gnome
provides,as it seems to be most directly related to the issue.
Do you have any ideas how I can re-bug my system and in the process, figure out a potential fix?
I have a test environment setup with Mantic and unreleased Regolith 3.1 snapshot that's in currently in testing
. I can repro the issue, and my packages are up to date so expect the issue is still present but LMK if you see different behavior in a clean setup.
It seems that org.freedesktop.impl.portal.desktop.gnome
is just the gnome-specific interface that the portal broker (xdg-desktop-portal) is to delegate when configured to use the gnome portal backend. As in, it does not offer some specific application interface itself, but is rather the middleman interface (I'm guessing).
Based on this, the question becomes, why is it not possible to compose a Regolith portal config file that prevents the portal broker from trying to instantiate this non-existent dbus service in the Regolith session.
Adding the following file (copied and adapted from gnome-portals.conf
) causes the regolith backend to be loaded upon desktop session start by the portals broker:
$ cat /usr/share/xdg-desktop-portal/regolith-portals.conf
[preferred]
default=regolith;gtk;
org.freedesktop.impl.portal.Access=gtk;
org.freedesktop.impl.portal.Secret=gnome-keyring;
Updating the regolith portals configuration file to "handle" (do not handle, but by declaring in the file, presumably preventing the broker from trying to invoke the gnome portal backend with it's lengthy timeout) allows the Regolith X11 session to coexist with the gnome portal backend. I don't this in itself is "the fix" but provides backing proof for basis for a proper solution.
$ cat /usr/share/xdg-desktop-portal/portals/regolith.portal
[portal]
DBusName=org.freedesktop.impl.portal.desktop.regolith
Interfaces=org.freedesktop.impl.portal.FileChooser;org.freedesktop.impl.portal.AppChooser;org.freedesktop.impl.portal.Print;org.freedesktop.impl.portal.Notification;org.freedesktop.impl.portal.Inhibit;org.freedesktop.impl.portal.Access;org.freedesktop.impl.portal.Account;org.freedesktop.impl.portal.Email;org.freedesktop.impl.portal.DynamicLauncher;org.freedesktop.impl.portal.Lockdown;org.freedesktop.impl.portal.Settings;org.freedesktop.impl.portal.Background;org.freedesktop.impl.portal.Wallpaper;org.freedesktop.impl.portal.ScreenCast;org.freedesktop.impl.portal.RemoteDesktop;org.freedesktop.impl.portal.Clipboard;org.freedesktop.impl.portal.InputCapture;org.freedesktop.impl.portal.Screenshot;
UseIn=regolith
I amended the "Implements" section by observing in /var/log/syslog
the interfaces the portal broker was calling into the gnome backend with, and then adding them. Once they were all added the launch behavior appears to no longer timeout on the gnome portal backend.
Going back to a previous experiment that I want to retry given findings in the last post, I uninstalled the regolith portal backend from my test environment. I created a regolith-portals.conf
file that maps all dbus names to the gtk backend. However, at runtime I see that the portal broker continues to try calling into the gnome portal backend despite my explicit mapping in the config file. This behavior seems to be incorrect, will post a question on upstream ticket to see if I've missed something such that this issue can be resolved without a custom portal implementation.
$ cat /usr/share/xdg-desktop-portal/regolith-portals.conf
[preferred]
default=gtk;
org.freedesktop.impl.portal.Secret=gnome-keyring;
org.freedesktop.impl.portal.Access=gtk;
org.freedesktop.impl.portal.Account=gtk;
org.freedesktop.impl.portal.AppChooser=gtk;
org.freedesktop.impl.portal.Background=gtk;
org.freedesktop.impl.portal.Clipboard=gtk;
org.freedesktop.impl.portal.DynamicLauncher=gtk;
org.freedesktop.impl.portal.Email=gtk;
org.freedesktop.impl.portal.FileChooser=gtk;
org.freedesktop.impl.portal.Inhibit=gtk;
org.freedesktop.impl.portal.InputCapture=gtk;
org.freedesktop.impl.portal.Lockdown=gtk;
org.freedesktop.impl.portal.Notification=gtk;
org.freedesktop.impl.portal.Print=gtk;
org.freedesktop.impl.portal.RemoteDesktop=gtk;
org.freedesktop.impl.portal.ScreenCast=gtk;
org.freedesktop.impl.portal.Screenshot=gtk;
org.freedesktop.impl.portal.Settings=gtk;
org.freedesktop.impl.portal.Wallpaper=gtk;
2023-11-24T10:20:57.834510-08:00 ltpt xdg-desktop-por[2731]: Failed to create screenshot proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
2023-11-24T10:20:57.835696-08:00 ltpt xdg-desktop-por[2731]: Choosing gnome.portal for org.freedesktop.impl.portal.Background via the deprecated UseIn key
2023-11-24T10:21:22.867919-08:00 ltpt xdg-desktop-por[2731]: Failed to create background proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
2023-11-24T10:21:22.869739-08:00 ltpt xdg-desktop-por[2731]: Choosing gnome.portal for org.freedesktop.impl.portal.Wallpaper via the deprecated UseIn key
2023-11-24T10:21:47.896237-08:00 ltpt xdg-desktop-por[2731]: Failed to create wallpaper proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gnome: Timeout was reached
2023-11-24T10:21:47.921624-08:00 ltpt xdg-desktop-por[2731]: Choosing gnome.portal for org.freedesktop.impl.portal.ScreenCast via the deprecated UseIn key
Can you try running /usr/libexec/xdg-desktop-portal-gnome
?
I get the following:
Non-compatible display server, exposing settings only.
This is exactly the fix introduced in https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/95. And fixes https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/74.
Also, here's what the logs for me look like:
XDP: Using gnome.portal for org.freedesktop.impl.portal.Settings (config)
XDP: Found 'gtk' in configuration for default
XDP: Using gtk.portal for org.freedesktop.impl.portal.Settings (config)
XDP: providing portal org.freedesktop.portal.Settings
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.FileChooser (config)
XDP: providing portal org.freedesktop.portal.FileChooser
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.AppChooser (config)
XDP: providing portal org.freedesktop.portal.OpenURI
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.Print (config)
XDP: providing portal org.freedesktop.portal.Print
XDP: Found 'gtk' in configuration for default
XDP: Using gtk.portal for org.freedesktop.impl.portal.Notification (config)
XDP: providing portal org.freedesktop.portal.Notification
XDP: Found 'gtk' in configuration for default
XDP: Using gtk.portal for org.freedesktop.impl.portal.Inhibit (config)
XDP: providing portal org.freedesktop.portal.Inhibit
XDP: Found 'gtk' in configuration for default
XDP: Using gtk.portal for org.freedesktop.impl.portal.Access (config)
XDP: providing portal org.freedesktop.portal.Device
XDP: providing portal org.freedesktop.portal.WebExtensions
XDP: providing portal org.freedesktop.portal.Location
XDP: providing portal org.freedesktop.portal.Camera
XDP: Found 'wlr' in configuration for default
XDP: Using wlr.portal for org.freedesktop.impl.portal.Screenshot (config)
XDP: providing portal org.freedesktop.portal.Screenshot
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.Background (config)
XDP: Starting background app monitor
XDP: providing portal org.freedesktop.portal.Background
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.Wallpaper (config)
XDP: providing portal org.freedesktop.portal.Wallpaper
XDP: Found 'gnome' in configuration for default
XDP: Using gnome.portal for org.freedesktop.impl.portal.Account (config)
XDP: using org.freedesktop.impl.portal.Account at org.freedesktop.impl.portal.desktop.gnome
Here's what my regolith-portals.conf
looks like:
[preferred]
default=wlr;gtk;gnome
Notice that I'm not seeing the timeouts and the following error doesn't exist anymore:
Choosing gnome.portal for org.freedesktop.impl.portal.Background via the deprecated UseIn key
Potential fix - setting the preferred value for interfaces that gnome exposes to none
until we have our own portals implementation for some of these interfaces.
org.freedesktop.impl.portal.Access=none;
org.freedesktop.impl.portal.Account=none;
org.freedesktop.impl.portal.AppChooser=none;
.
.
.
org.freedesktop.impl.portal.Wallpaper=none;
Can you test this out?
Can you try running
/usr/libexec/xdg-desktop-portal-gnome
? I get the following:Non-compatible display server, exposing settings only.
This is exactly the fix introduced in https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/95. And fixes https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/74.
On my test environment (X11, Mantic) I do not see anything about Non-compatible display server, exposing settings only.
when running the backend. I have xdg-desktop-portal-gnome
version 45.0-1
installed. I have verified from the Ubuntu source tarball for the package that the fix is indeed built into this version, but for some reason isn't being triggered for the x11 session on my test instance. I have not yet looked into the sway session, as I don't want to complexify test results for config changes across the sessions.