本文没有截图,当时无法截图,现在也不想复现当时的问题,所有也不会有截图,因为实在是太难搞了!!!!

现象:文字描述下吧

1. 重启ubuntu系统

2. 桌面显示操作系统logo

3. 桌面左上角显示命令行模式的登录界面

4. 命令行模式登录界面显示不超过半秒钟,出现黑屏

5. 左上角一个小横线一直闪烁

直接说解决方法,中间走的些错路弯路就不写了:

1. 修改启动参数,把启动参数quiet splash删除,加上debug console=tty0,然后把loglevel改为7,这一步是为了看启动日志,后面的问题是通过这个找到的

1. ctrl+alt+Fx进入命令行界面,x为1,2,3,4,5,6。。。。

(这一步才发现系统竟然是好的)

2. 不知道怎么发现的是lightdm的问题,应该是日志打出来的,可以看syslog,dmesg,journal

3. 查看lightdm服务/lib/systemd/system/lightdm.service文件,修改完如下所示

[Unit]
Description=Light Display Manager
Documentation=man:lightdm(1)
Conflicts=getty@tty7.service plymouth-quit.service
#After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service
After=systemd-user-sessions.service

[Service]
# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
#ExecStartPre=/bin/sh -c '[ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "lightdm" ]'
ExecStart=/usr/sbin/lightdm
Restart=always
BusName=org.freedesktop.DisplayManager

4. 通过手动执行/usr/sbin/lightdm命令发现后续问题,这个命令可以用--help查看怎么使用,主要是打开debug,然后单独指定日志存放目录,然后通过日志查找到问题,单独指定日志目录是为了看得更清楚,此处为/usr/sbin/lightdm  -d --log-dir=xx

root@whz-PC:/home/whz# /usr/sbin/lightdm --help
Usage:
  lightdm [OPTION?] - Display Manager

Help Options:
  -h, --help                Show help options

Application Options:
  -c, --config=FILE         Use configuration file
  -d, --debug               Print debugging messages
  --test-mode               Run as unprivileged user, skipping things that require root access
  --pid-file=FILE           File to write PID into
  --log-dir=DIRECTORY       Directory to write logs to
  --run-dir=DIRECTORY       Directory to store running state
  --cache-dir=DIRECTORY     Directory to cache information
  --show-config             Show combined configuration
  -v, --version             Show release version

5. 截一点日志查看发现配置文件在以下这个目录

[+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-autologin-user.conf
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
[+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-slscreenagrentsvr.conf

6. 日志中还发现以下问题

[+0.43s] DEBUG: Process 4115 exited with return value 1
[+0.43s] DEBUG: Seat seat0: Exit status of xhost +: 1

7. 进入配置文件目录

grep -nr xhost

发现在50-slscreenagrentsvr.conf文件里有这个内容,注释掉,重启lightdm

[SeatDefaults]
#greeter-setup-script=xhost +
#display-setup-script=xhost +

8. over!!!!!!!!!!!!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐