ubuntu23.04 lightdm重启后卡在登录界面,情况如下
旧主机无显示器、ubuntu23.04、安装了向日葵、安装了lightdm(向日葵必须使用这个)、ssh可正常访问
之前都是正常的,今天重启了几次,登录后就卡在加载页进不去桌面了(向日葵操作)但ssh正常
注意区分自己的情况
有的是显卡问题,有的是权限问题,还有让删除.Xauthority文件的,还有重装lightdm的。这些对我都没用。
可以查看 ~/.xsession-errors 中的错误信息。
我这里报如下错误:
/etc/X11/Xsession.d/30x11-common_xresources: line 16: has_option: command not found
/etc/X11/Xsession.d/75dbus_dbus-launch: line 9: has_option: command not found
/etc/X11/Xsession.d/90x11-common_ssh-agent: line 9: has_option: command not found
中文:
/etc/X11/Xsession.d/30x11-common_xresources: 行 16: has_option: 未找到命令
/etc/X11/Xsession.d/75dbus_dbus-launch: 行 9: has_option: 未找到命令
/etc/X11/Xsession.d/90x11-common_ssh-agent: 行 9: has_option: 未找到命令
如下链接解决了以上错误:
https://ubuntu-mate.community/t/xsession-d-errors-how-to-fix-line-has-option-command-not-found/25673/2
就是在终端执行以下代码:
cat <<\EOF | sudo tee /etc/X11/Xsession.d/20x11-add-hasoption
# temporary fix for LP# 1922414, 1955135 and 1955136 bugs
# read OPTIONFILE
OPTIONS=$(cat "$OPTIONFILE") || true
has_option() {
if [ "${OPTIONS#*
$1}" != "$OPTIONS" ]; then
return 0
else
return 1
fi
}
EOF
虽然可以解决以上问题,但依然进不去系统。但我的 ~/.xsession-errors内容如下:

.xsession-errors内容
解决办法
1、修改 /etc/default/grub 的内容: "quiet splash" 改为 "quiet splash nomodeset"
修改之前,注意备份一下

修改grub
2、更新grub
sudo update-grub
3、reboot重启
4、重启后,设置lightdm为默认桌面
sudo dpkg-reconfigure lightdm
按tab选择lightdm,然后回车

设置默认
5、重启lightdm
sudo service lightdm restart
再次登录就可以进入桌面了
非常感谢文章:
https://blog.csdn.net/weixin_48404151/article/details/109369361