Score:0

Gtk desktop app delayed on first launch (20.04)

ht flag

I have a Gtkmm desktop app that requires root access. It worked fine on 18.04 using Lxqt-sudo but after upgrading to 20.0.4, it takes ~30 seconds to open only the first time after booting. In addition, it will skip the splash screen that's supposed to show for 3 seconds. However, every subsequent launch will show the splash screen and everything works fine, until the system is rebooted again. Logs for the minute this occurs:

Mar 15 11:38:07 ubuntu-VirtualBox systemd[1053]: Started Application launched by gnome-shell.
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] AppArmor D-Bus mediation is enabled
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.portal.Desktop' requested by ':1.0' (uid=0 pid=3140 comm="/usr/bin/configuration-tool " label="unconfined")
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.portal.Documents' requested by ':1.1' (uid=0 pid=3155 comm="/usr/libexec/xdg-desktop-portal " label="unconfined")
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.impl.portal.PermissionStore' requested by ':1.2' (uid=0 pid=3160 comm="/usr/libexec/xdg-document-portal " label="unconfined")
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.impl.portal.PermissionStore'
Mar 15 11:38:09 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.portal.Documents'
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.impl.portal.desktop.gtk' requested by ':1.1' (uid=0 pid=3155 comm="/usr/libexec/xdg-desktop-portal " label="unconfined")
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.gtk.vfs.Daemon' requested by ':1.4' (uid=0 pid=3174 comm="/usr/libexec/xdg-desktop-portal-gtk " label="unconfined")
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.gtk.vfs.Daemon'
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='ca.desrt.dconf' requested by ':1.4' (uid=0 pid=3174 comm="/usr/libexec/xdg-desktop-portal-gtk " label="unconfined")
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.impl.portal.desktop.gtk'
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.FileManager1' requested by ':1.1' (uid=0 pid=3155 comm="/usr/libexec/xdg-desktop-portal " label="unconfined")
Mar 15 11:38:10 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'ca.desrt.dconf'
Mar 15 11:38:35 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Activating service name='org.freedesktop.secrets' requested by ':1.1' (uid=0 pid=3155 comm="/usr/libexec/xdg-desktop-portal " label="unconfined")
Mar 15 11:38:35 ubuntu-VirtualBox org.freedesktop.secrets[3218]: GNOME_KEYRING_CONTROL=/root/.cache/keyring-88PV11
Mar 15 11:38:35 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.secrets'
Mar 15 11:38:35 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.portal.Desktop'
Mar 15 11:38:35 ubuntu-VirtualBox dbus-daemon[3152]: [session uid=0 pid=3150] Successfully activated service 'org.freedesktop.FileManager1'
Mar 15 11:38:35 ubuntu-VirtualBox nautilus[3201]: Unable to get contents of the bookmarks file: Error opening file /root/.gtk-bookmarks: No such file or directory
Mar 15 11:39:05 ubuntu-VirtualBox xdg-desktop-por[3155]: Failed to get application states: GDBus.Error:org.freedesktop.portal.Error.Failed: Could not get window list

What I've tried:
Simply modifying the Desktop file as shown below (see 'Exec' value) seemed to solve this for most users here, but no luck. I am now using pkexec instead of lqxt-sudo, since this seems to be the recommended approach.

[Desktop Entry]
Encoding=UTF-8
Version=1.8.3
Name=Configuration Tool
Exec=sh -c "pkexec --disable-internal-agent env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/configuration-tool"
Icon=/usr/share/icons/configuration-tool/icon_v2.png
Terminal=false
Type=Application
Categories=GNOME;GTK;

I've also tried building a policykit action as some posts suggested, but even when I give the program full access, there is still a delay on first launch:

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE policyconfig PUBLIC
  "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
 <policyconfig>
   <action id="org.freedesktop.policykit.pkexec.run-configuration-tool">
    <description>Run configuration-tool</description>
    <message>Authentication is required to run configuration-tool</message>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/configuration-tool</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
  </action>
 </policyconfig>
Score:1
gf flag

Looks like an issue with xdg-desktop-portal. Other users have reported a similar issue: https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/1878081

Try uninstalling xdg-desktop-portal and see if it fixes it:

sudo apt remove xdg-desktop-portal

EDIT: Or a better option, try downgrading to a working version.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.