Score:1

autostart is delayed? takes around 90s

cn flag

After login i expected my autostart apps to immediately start, but they seem to only start after about 90s.

I tried googling but all i see is people who want to delay apps in startup... i was looking for the opposite.

I use guake (dropdown terminal) and sometimes want to hit that imediately after login, but i have to wait for autostart to kick in.

This has been like this a long time and im not even sure if its by design, but i wonder if there is a way to run it immediately (i tried with systemd but i guess for X11 apps that is not appropriate either). This behaves the same across my multiple machines... previous and current desktops and laptops and i never took the time to look into it because i can simply start the app on login and it does work immediately... but when i leave it to autostart its delayed. Today i tried figuring it out and i totally failed to even figure out how to debug this...

Also tried with diff app (gedit) just to see if it was something the app was doing but it behaves the same and looking at top you clearly see that they are not running... and then (90s later) they are started.

~  cat ~/.config/autostart/guake.desktop                                                                                                                            seg 20 dez 2021 11:35:40
[Desktop Entry]
Name=Guake Terminal
Comment=Use the command line in a Quake-like terminal
TryExec=guake
Exec=guake
Icon=guake
Type=Application
Categories=GNOME;GTK;System;Utility;TerminalEmulator;
StartupNotify=true
X-Desktop-File-Install-Version=0.22
X-GNOME-Autostart-Delay=0
 ~  cat /etc/*elease                                                                                                                                                 seg 20 dez 2021 11:38:38
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Does anyone have some insight into what is going on?

** edit **

~  free -h                                                                                                                                                          qui 30 dez 2021 19:07:54
              total        used        free      shared  buff/cache   available
Mem:           31Gi       2,6Gi        25Gi        30Mi       2,9Gi        28Gi
Swap:         2,0Gi          0B       2,0Gi
 ~  sysctl vm.swappiness                                                                                                                                             qui 30 dez 2021 19:07:56
vm.swappiness = 60

top after login but before autostart apps are started

top - 19:12:55 up 10 min,  5 users,  load average: 0,11, 0,32, 0,31
Tasks: 460 total,   1 running, 458 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0,0 us,  0,4 sy,  0,0 ni, 99,6 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :  32015,8 total,  27507,7 free,   1505,3 used,   3002,8 buff/cache
MiB Swap:   2048,0 total,   2048,0 free,      0,0 used.  30073,2 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                
    832 root      20   0       0      0      0 S   1,7   0,0   0:09.37 nvidia-modeset/                                                                                                        
   6604 root      20   0   24,2g  55624  35720 S   1,3   0,2   0:01.70 Xorg                                                                                                                   
   7245 pguedes   20   0  816508  84356  49328 S   1,0   0,3   0:01.19 guake                                                                                                                  
    200 root      20   0       0      0      0 I   0,3   0,0   0:00.08 kworker/15:1-events                                                                                                    
   1517 root     -51   0       0      0      0 S   0,3   0,0   0:02.13 irq/110-nvidia                                                                                                         
   6747 pguedes   20   0 5041032 374532 112356 S   0,3   1,1   0:03.69 gnome-shell                                                                                                            
   6757 pguedes   20   0  153416   8964   7020 S   0,3   0,0   0:00.19 gesticled                                                                                                              
   7931 pguedes   20   0   12272   4156   3076 R   0,3   0,0   0:00.20 top                                                                                                                    
      1 root      20   0  168648  12748   8436 S   0,0   0,0   0:01.21 systemd                                                                                                                
      2 root      20   0       0      0      0 S   0,0   0,0   0:00.00 kthreadd                                                                                                               
      3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp                                                                                                                 
      4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp                                                                                                             
      6 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/0:0H-events_highpri                                                                                            
      7 root      20   0       0      0      0 I   0,0   0,0   0:00.04 kworker/0:1-rcu_par_gp                                                                                                 
      9 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 mm_percpu_wq                                                                                                           
     10 root      20   0       0      0      0 S   0,0   0,0   0:00.00 rcu_tasks_rude_                                                                                                        
     11 root      20   0       0      0      0 S   0,0   0,0   0:00.00 rcu_tasks_trace                                                                                                        
     12 root      20   0       0      0      0 S   0,0   0,0   0:00.00 ksoftirqd/0                                                                                                            
     13 root      20   0       0      0      0 I   0,0   0,0   0:00.13 rcu_sched                                                                                                              
     14 root      rt   0       0      0      0 S   0,0   0,0   0:00.00 migration/0                                                                                                            
     15 root     -51   0       0      0      0 S   0,0   0,0   0:00.
vanadium avatar
cn flag
If you expect info, then provide concise information about your current system. Autostart applications are defined through .desktop files that live, among others, in ~ /config/autostart, and should kick in immediately after logging in.
cn flag
@vanadium not sure what info you mean. I am aware of how autostart works... as explained above i'm trying to run guake but also tried with gedit (tried setting X-GNOME-Autostart-Delay=0)... but the delay is for any app in the autostart and not a specific one... if there's some specific info that would help i can provide it, but im just not sure what info would be helpful
heynnema avatar
ru flag
@vanadium You *really* mean `~ /.config/autostart` :-)
vanadium avatar
cn flag
@heynnema For sure a typo. I changed my keyboard to English (intl, with AltGr dead keys) so I only need to hit accents once - they are only a dead key in combination with AltGr. Still, I continue typing spaces after these -formally dead - keys. That includes ~. I then have to go back and remove the space - here I remoced the . instead. Old habbits die very hard.
vanadium avatar
cn flag
@PedroGuedes Point is that your question does not provide any concise info with which others could debug the issue. We all seem to know how autostart work. What you see is rarely seen - you do not find reports in the internet you say, and strangely enough, you have it on all your machines. Providing specific info on your Ubuntu version and desktop, and eventually including the Guake autostart .desktop could be a good start. Also provide info on any changes you may have done to your system. Temp. create a new account, then check if the issue is also there when logging into that new account...
cn flag
@vanadium added .desktop and OS details. But as i mentioned i tried with a diff basic .desktop to launch gedit and it behaves the same... delay seems unrelated to launcher and feels like some default delay for all app startup. Is there logs that i could look into to figure out when login vs app startup happens?
vanadium avatar
cn flag
Temp. create a new account, then check if the issue is also there when logging into that new account. This way you can rule out a system wide issue.
heynnema avatar
ru flag
@vanadium Good idea. Up vote.
heynnema avatar
ru flag
Status please...
cn flag
@vanadium sorry for the delay but Christmas took over my life for a minute :) anyway... tried the new account...exact same behavior. Exact same behavior also on x1 carbon gen 4 and gen 9 (my two laptops). I'm going to run a VM with Ubuntu and see what it does there... if you have, for example gedit does it popup immediately after login?
cn flag
btw guys... happy holidays and thanks for the help :)
cn flag
@vanadium ok def something on my setup.... on the VM it just starts imediately (as expected)... since it happens on my account and freshly created account where else could i look?
heynnema avatar
ru flag
@PedroGuedes Edit your question and show me `free -h` and `sysctl vm.swappiness` and a screenshot of `top`. Also, boot to a Ubuntu Live USB and see if it happens there.
cn flag
@heynnema updated response... looking for a pen to create bootable :)
cn flag
ok... it's my own damn software i built this gesture daemon a couple of years ago for my christmas vacation project https://github.com/pguedes/gesticle (i wanted to learn about the linux desktop dev env and rust) and that's what is causing it... i just tried installing it in the VM and it immediately reproduces my issue... i guess i need to figure out why that happens (daemon is responsive but seems to cause the delay) but at least i know who is to blame... it's me! sorry for the wild-goose chase!!
cn flag
i guess its a separate issue but if anyone has hints on what is wrong with this https://github.com/pguedes/gesticle/blob/master/deb-assets/gesticle.desktop i would be happy to get your input... I'll go digging on that file i guess
cn flag
took me all of 1 min to find this in the gnome docs... `An application's startup phase is controlled by the X-GNOME-Autostart-Phase key in its .desktop file. If this is not set, it defaults to the Applications phase. Applications in the first 4 phases MUST signal to the session manager when they are up and running (via XSMP); the session manager won't start the next phase until every app in the current phase has indicated that it is ready. Applications in the Applications phase aren't necessarily expected to communicate with the session manager. ` embarassing
Score:0
cn flag

Eventually i found the issue to be a daemon (something i wrote myself) to be causing this because i missed the following lines in the gnome docs.

An application's startup phase is controlled by the X-GNOME-Autostart-Phase key in its .desktop file. If this is not set, it defaults to the Applications phase. Applications in the first 4 phases MUST signal to the session manager when they are up and running (via XSMP); the session manager won't start the next phase until every app in the current phase has indicated that it is ready. Applications in the Applications phase aren't necessarily expected to communicate with the session manager.

and also later on the same page:

In the "Initialization" phase, an application can just exit with status 0 to indicate that it is done setting up.

see https://wiki.gnome.org/Projects/SessionManagement/NewGnomeSession#Startup

which means that applications started during the Initialization phase need to return 0 to indicate that they are done setting up and the gnome session startup can continue... or it times out (like was happening to me). I missed this in the docs and so I was basically launching my daemon from that .desktop on that phase :facepalm:

fix was very basic: https://github.com/pguedes/gesticle/commit/7ad281066e77614a6a8f56cd37eef3a40fedab28#diff-80193a39279910d0f7d03cd29dba92ad660f9f167b53480f9a36e461868e8903

leaving the answer here in case it helps someone debugging something similar

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.