笔记本Kali系统主屏幕损坏后利用屏幕2启动失败修复

笔记本搭建Kali系统,但是屏幕1彻底坏了,无法进入系统,尝试使用屏幕2进入

报错lightdm.service启动失败

启动顺序问题ctrl + alt + f2进入命令行页面,通过tty输入帐号密码进入系统

排查lightdm服务问题

systemctl status lightdm 
lightdm --test-mode --debug

查看控制台日志,查找error报错信息,看到错误

...
[+0.02s] WARNING: Error reading existing Xauthority: Failed to open file ?/run/lightdm/root/:0?: Permission denied
[+0.02s] WARNING: XServer 0: Failed to write authority: Failed to open X authority /run/lightdm/root/:0: Permission denied
...

这一步一度以为是文件夹找不到或者文件权限问题。调试日志也会在/var/log/xorg.0.log文件中生成错误信息,根据关键字google大法是加载顺序问题,修改lightdm.conf文件

vi /etc/lightdm/lightdm.conf

[LightDM]
logind-check-graphic=true

使用reboot重启,不显示报错信息,但是黑屏,只有一个输入符闪动,重新进入shell排查。

排查xfce问题

这次在shell中启动startxfce4查看错误信息,可以发现是查找screen出现问题,报错核心信息no screens found,因为多屏幕不知道该使用哪个屏幕。

Screen(s) found, but none have a usable configuration

使用export DISPLAY=:1,通过启动startxfce4充分暴露问题,开始仍然报错找不到屏幕,然后查找cat /etc/X11/default-display-manager,发现display的管理还是回归到lightdm.conf,继续排查[LightDM]模块,对一些参数开启

[LightDM]
#start-default-seat=true
#greeter-user=lightdm
minimum-display-number=1
minimum-vt=7
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
logind-check-graphical=true
log-directory=/var/log/lightdm
run-directory=/var/run/lightdm
cache-directory=/var/cache/lightdm
sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions:/usr/share/wayland-sessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=$XDG_DATA_DIRS/lightdm/greeters:$XDG_DATA_DIRS/xgreeters
backup-logs=true
dbus-service=true

注意 这里的参数minimum-display-number=1就是控制屏幕顺序,主屏幕顺序是0。
重启startxfce4进入黑屏,但是依然无法正常启动,使用ctrl + alt + f1退出程序,出现不一样的错误,说明修改配置生效,继续排查,看到网上有人说需要修改xorg.conf,find定位只有/usr/share.../doc下存在,网上有一种方案重新生成配置文件,这种很合理,因为换了屏幕,很有可能原来的配置文件失效

Xorg -configure
dpkg --configure -a

这一步会生成/root/xorg.conf.new文件,这一步就很清晰了,查看该文件发现Screen1 Screen2的相关配置,很有可能是读取这里的配置,直接删除Screen1相关行内容,复制到/etc/X11/目录

cp xorg.conf.new /etc/X11/xorg.conf

xorg.conf可以参考如下(默认生成的大部分不需要修改):

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      1  "Screen1"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection
...
Section "Screen"
        Identifier "Screen1"
        Device     "Card1"
        Monitor    "Monitor1"
        SubSection "Display"
                Viewport   0 0
                Depth     1
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     8
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     15
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     16
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection

重启startxfce4,完美进入系统。
直接reboot,系统恢复正常使用
success

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值