You are not logged in.

#1 2019-02-19 22:14:59

indianahorst
Member
Registered: 2008-08-23
Posts: 127

[Solved] Xorg starting slow using automatic login

Hello everybody,

I'm looking for a solution for a very specific problem:

My HTPC shall boot directly into KODI and use automatic login into a virtual console with a given username and then start XFCE.

In short:
Autologin -> automatic start of X in .bash_profile -> automatic start of XFCE in .xinitrc.


Problem:
When booting, I see the normal boot messages. Then the automatic login happens, it begins to start X and then the screen goes black and hangs for circa 1 minute after the autologin. After that, Xorg and  XFCE start to the desktop, but the delay of one minute is annoying.


Configuration:
I followed this guide for automatic login:
https://wiki.archlinux.org/index.php/Ge … al_console

$ cat /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
Type=simple
ExecStart=
ExecStart=-/usr/bin/agetty --autologin MyUsername --noclear %I $TERM

Then I followed https://wiki.archlinux.org/index.php/Xi … X_at_login

$ cat ~/.bash_profile
#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc


if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
   exec startx
fi

and at last https://wiki.archlinux.org/index.php/Xfce#Starting

$ cat .xinitrc
# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

# twm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &
# exec xterm -geometry 80x66+0+0 -name login

exec startxfce4

I have no clue where I should search for the reason why the start of Xorg takes so long, because there are no error messages in journalctl or dmesg.

Can anybody give me a hint where I can search for the delay of one minute?
Thanks!

Last edited by indianahorst (2019-02-20 22:36:56)

Offline

#2 2019-02-19 22:17:02

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Xorg starting slow using automatic login

If you swap xfce for twm, does it still exhibit the delay?

Please paste your Xorg.log.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-02-19 23:20:29

indianahorst
Member
Registered: 2008-08-23
Posts: 127

Re: [Solved] Xorg starting slow using automatic login

jasonwryan wrote:

If you swap xfce for twm, does it still exhibit the delay?

Please paste your Xorg.log.

I switched from

exec startxfce4

to

exec twm

(after installing extra/xorg-twm) and then I got a complete black screen with a blinking cursor, but no keyboard inputs possible. The same result when renaming .xinitrc to .xinitrc_backup (in this case also TWM should start). 

Then I switched to IceWM:

exec icewm-session

which led to an IceWM starting almost immediately after the automatic login.

Here is the Xorg.log with "exec startxfce4" set in xinitrc:

https://pastebin.com/rt4GCBcG

Offline

#4 2019-02-19 23:23:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Xorg starting slow using automatic login

I'd look through your xfce configs, especially anything in autostart or whatever it is that saves sessions.

(And with twm, you need to start a terminal, eg., xterm as well).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2019-02-19 23:37:55

indianahorst
Member
Registered: 2008-08-23
Posts: 127

Re: [Solved] Xorg starting slow using automatic login

Here the other Xorg.log with "exec icewm-session" in xinitrc:

https://pastebin.com/YqAZs7YH

Offline

#6 2019-02-19 23:54:53

indianahorst
Member
Registered: 2008-08-23
Posts: 127

Re: [Solved] Xorg starting slow using automatic login

I tried another thing:

Removed

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec startx
fi

from .bash_profile and rebooted.

I end up - as expected - logged in as MyUsername on the virtual console.
Then I start "startxfce4" by hand and get the XFCE desktop immediately.

So, it has something to do with the autostart mechanism of .xinitrc?

Offline

#7 2019-02-20 08:22:05

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [Solved] Xorg starting slow using automatic login

A few things could be relevant here, two things to check spring to mind, one is to ensure you have a proper hostname set and there's also a chance that your entropy pool is too low during automated startup and your system hanging on some cryptographic function (by manually logging in, your keyboard input will fill up the entropy pool, bypassing the issue). What's your output for

hostnamectl

and to test the entropy situation, if

lscpu | grep rdrand

gives you output you can try to add random.trust_cpu=on to your kernel parameters otherwise install and enable haveged.

Offline

#8 2019-02-20 22:34:22

indianahorst
Member
Registered: 2008-08-23
Posts: 127

Re: [Solved] Xorg starting slow using automatic login

In the meantime, I tried some other things as deactivating the automatic console login and switching to different Display Managers (tested: nodm and lightdm), but I got the same result: Xorg starts, I can see the mouse pointer, but XFCE starts not before 30 tp 60 seconds.


V1del wrote:

A few things could be relevant here, two things to check spring to mind, one is to ensure you have a proper hostname set and there's also a chance that your entropy pool is too low during automated startup and your system hanging on some cryptographic function (by manually logging in, your keyboard input will fill up the entropy pool, bypassing the issue). What's your output for

hostnamectl

and to test the entropy situation, if

lscpu | grep rdrand

gives you output you can try to add random.trust_cpu=on to your kernel parameters otherwise install and enable haveged.

Thanks V1del, this was a great hint! It was the entropy pool!

After adding random.trust_cpu=on to the kernel parameters and rebooting, Xorg and XFCE start immediatly and without any delay. Thanks again!

Offline

#9 2019-02-21 09:13:41

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [Solved] Xorg starting slow using automatic login

Glad to hear, it looks like this might get mitigated a bit with the 4.20.11 kernel as that includes https://git.kernel.org/pub/scm/linux/ke … 3f4ce7c7eb so hard disks should contribute to the entropy generation again.

Offline

Board footer

Powered by FluxBB