X 服务器的启动时间如此之长的原因是什么?

X 服务器的启动时间如此之长的原因是什么?

背景

我目前在我的机器上经历了很长的“启动”时间(并且早于大猩猩):

            .-/+oossssoo+/-.               sterlingbutters@butters-ubuntu 
        `:+ssssssssssssssssss+:`           ------------------------------ 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu Groovy Gorilla (development branch) x86_64 
    .ossssssssssssssssssdMMMNysssso.       Kernel: 5.8.0-16-generic 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 45 mins 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Packages: 3776 (dpkg), 9 (snap) 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Shell: bash 5.0.17 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Resolution: 3840x2160 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   DE: GNOME 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM Theme: Adwaita 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Theme: Yaru [GTK2/3] 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Icons: Yaru [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Terminal: gnome-terminal 
  +sssssssssdmydMMMMMMMMddddyssssssss+     CPU: Intel i9-7940X (28) @ 4.400GHz 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      GPU: NVIDIA GeForce GTX 1080 Ti 
    .ossssssssssssssssssdMMMNysssso.       Memory: 6434MiB / 31817MiB 
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`                                   
            .-/+oossssoo+/-.                                       

查看journalctl,似乎需要大约 44 秒(从第一个条目开始)来初始化 X 服务器。我使用 的lightdm系统钩子推断出这一点,即:

/etc/lightdm/lightdm.conf.d/50-system-hooks.conf

[SeatDefaults]
display-setup-script=echo "This text is produced after the X server starts but before the user session / greeter is run. Change the display-setup-script in /etc/lightdm/lightdm.conf.d/50-system-hooks.conf to configure anything special here. It is run as root. If this command returns an error code the X server is stopped."
display-stopped-script=echo "This text is produced after the X server exits. Change the display-stopped-script in /etc/lightdm/lightdm.conf.d/50-system-hooks.conf to configure anything special here. It is run as root."
greeter-setup-script=echo "This text is produced before a greeter starts. Change the greeter-setup-script in /etc/lightdm/lightdm.conf.d/50-system-hooks.conf to configure anything special here. It is run as root. If this command returns an error code the greeter fails to start (which will cause LightDM to stop)."
session-setup-script=echo "This text is produced before a user session starts. Change the session-setup-script in /etc/lightdm/lightdm.conf.d/50-system-hooks.conf to configure anything special here. If this command returns an error the session will not start (user is returned to a greeter)."
session-cleanup-script=echo "This text is produced after a greeter or user session stops. Change the session-cleanup-script in /etc/lightdm/lightdm.conf.d/50-system-hooks.conf to configure anything special here. It is run as root." 
#session-wrapper= is a the command to run for a session. This command is run as the user and needs to exec the command passed in the arguments to complete running the session. Use this if you need to do special setup for a user session. Note the default is 'lightdm-session' so you should chain to this if you need to override this setting.
#greeter-wrapper= is a the command to run a greeter. It is the equivalent of session-wrapper for greeters. 

启动 X 服务器似乎需要很长的时间,特别是考虑到我的机器的规格。

X 服务器的启动时间如此之长的原因是什么?

此外,一旦 X 服务器初始化,启动欢迎程序(unity)所需的时间非常短(<1 秒)。对我来说奇怪的是,尽管systemctl get-default等于graphical.target,但在显示问候语之前我会立即看到控制台(~2s)(不是最重要的 - 只是奇怪)。

将我的凭据输入到迎宾程序中几乎立即会在迎宾程序初始化和用户会话初始化之间产生大约 23 秒的时间。这就是时间线开始变得不一致的地方:即使迎宾者接受凭据并似乎启动了用户会话,我通常会在凭据和可用桌面之间等待大约 1 分钟(也就是说,我可以看到壁纸并使用鼠标,但不能图标、菜单、窗口等可见)。

我看到lightdm通过以下方式初始化 Greeter:

/usr/share/xgreeters/unity-greeter.desktop

[Desktop Entry]
Name=Unity Greeter
Comment=Unity Greeter
Exec=unity-greeter
Type=Application
X-Ubuntu-Gettext-Domain=unity-greeter

和DE通过

/usr/share/xsessions/ubuntu.desktop

[Desktop Entry]
Name=Ubuntu
Comment=This session logs you into Ubuntu
Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu
TryExec=/usr/bin/gnome-shell
Type=Application
DesktopNames=ubuntu:GNOME
X-GDM-SessionRegisters=true
X-Ubuntu-Gettext-Domain=gnome-session-3.0

使用以下文件:

/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

[Seat:*]
user-session=ubuntu

/usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

[Seat:*]
greeter-session=unity-greeter

(虽然我不确定什么50-greeter-wrapper.conf[Seat:*]\n greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session在同一目录中)

相关内容