Ubuntu 20.04.2 启动时自动登录

Ubuntu 20.04.2 启动时自动登录

首先,Ubuntu 20.04.2 桌面版最小化安装,包含了我们作为服务器所需的软件包。

这样做是因为 GUI 更容易安装。服务器设置为在多用户模式下启动,没有 GUI。我需要一个用户自动登录并在 tty6 上启动 GUI,tty7 会更好。我尝试了

systemctl edit [email protected] 

并重新启动。我收到消息

服务具有多个 ExecStart= 设置,这仅允许用于 Type=oneshot 服务。

我不明白为什么当我查看“override.conf”时,只看到一次。我在这里错过了什么?

答案1

我只需要ExecStart=在之前添加ExecStart= ....

[Service]
# the VT is cleared by TTYVTDisallocate
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=
ExecStart=-/sbin/agetty -a auto --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

相关内容