进入xwindows后系统挂起(黑屏)键盘鼠标没有响应@FreeBSD

news/2025/3/15 21:42:02/

问题:黑屏能看见鼠标,键盘和鼠标没有反应

在不小心升级pkg包后,系统无法进入xfce等xwindows,表现为黑屏和能看见鼠标,左上角有一个白字符块,键盘鼠标没有反应,整个系统卡住。但是可以ssh登录,内部的服务一切正常。

处理过程:

前面都是弯路,直接可以跳到Xorg配置和解决no screens found 报错问题这两部分。

使用xrandr查看显示

输入xrandr

报错can't open display

现在的问题就是解决么有display的问题,大约是在某个时间段,FreeBSD修改了xwindows的某个部件。。。。

用ssh登进去测试:

startx

xauth:  file /home/skywalk/.serverauth.7188 does not exist

/usr/local/libexec/Xorg.wrap: Only console users are allowed to run the X server

xinit: giving up

xinit: unable to connect to X server: Connection refused

xinit: server error

最后发现本身正常的时候,在tty控制台执行xrandr也是报错can't open display,所以这里走了弯路,一直在尝试解决这个报错。也就是这个报错不用去管它。

安装wayfile试试

# pkg install wayfire wf-shell alacritty swaylock-effects swayidle wlogout kanshi mako wlsunset

问题照旧

咨询bing

You could do this (if your DISPLAY is :0):

export DISPLAY=:0

xrandr --listmonitors

xrandr your_command

输入set DISPLAY=:0

xrandr --listmonitors

还是Can't open display

(最终知道,xrandr这里是走弯路了,tty等下面本身就是Can't open display,在xwindows下才能显示显示器那些数值)

重新学习FreeBSD手册

学到使用pciconf来查看显卡

pciconf -lv|grep -B4 VGA
vgapci0@pci0:0:2:0:	class=0x030000 rev=0x09 hdr=0x00 vendor=0x8086 device=0x1616 subvendor=0x17aa subdevice=0x2226vendor     = 'Intel Corporation'device     = 'HD Graphics 5500'class      = displaysubclass   = VGA
查看是biso还是uefi
sysctl machdep.bootmethod
machdep.bootmethod: UEFI

当然这个数据不重要 

安装intel显卡

pkg install drm-kmod
sysrc kld_list+=i915kms

降低intel显卡的cpu占用

pkg install libva-intel-driver mesa-libs mesa-dri

当然这不是必须的。 

Xorg配置

Xorg Configuration

Xorg supports most common video cards, keyboards, and pointing devices.

Video cards, monitors, and input devices are automatically detected and do not require any manual configuration. Do not create xorg.conf or run a Xorg -configure step unless automatic configuration fails.

 也就是除非自动配置失败,否则不需要使用下面命令或创建xorg.conf文件

sudo Xorg -configure
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
(EE) 
Please consult the The X.Org Foundation support at http://wiki.x.orgfor help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

 intel显卡配置

Example 1. Select Intel® Video Driver in a File

/usr/local/etc/X11/xorg.conf.d/20-intel.conf

Section "Device"Identifier "Card0"Driver     "intel"
EndSection

尝试手工写这个文件20-intel.conf(当然最终是没有用到,把这个文件屏蔽掉了)

再次看显卡: 

pciconf -lv | grep -B3 display
vgapci0@pci0:0:2:0:	class=0x030000 rev=0x09 hdr=0x00 vendor=0x8086 device=0x1616 subvendor=0x17aa subdevice=0x2226vendor     = 'Intel Corporation'device     = 'HD Graphics 5500'class      = display

使用X -config调用配置文件

执行测试

sudo X -config /root/xorg.conf.new
密码:
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
(EE) 
Please consult the The X.Org Foundation support at http://wiki.x.orgfor help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

执行startx(好像问题照旧)

重新删除和安装Xorg和xfce包

重新删除Xorg和xfce包,重新安装,执行startx

报错no screens 。现在的问题就变成解决no screens这个问题了。这个问题最终解决方法,见后面。

查看生成的X配置文件

cat /root/xorg.conf.new 
Section "ServerLayout"Identifier     "X.org Configured"Screen      0  "Screen0" 0 0InputDevice    "Mouse0" "CorePointer"InputDevice    "Keyboard0" "CoreKeyboard"
EndSectionSection "Files"ModulePath   "/usr/local/lib/xorg/modules"FontPath     "/usr/local/share/fonts/misc/"FontPath     "/usr/local/share/fonts/TTF/"FontPath     "/usr/local/share/fonts/OTF/"FontPath     "/usr/local/share/fonts/Type1/"FontPath     "/usr/local/share/fonts/100dpi/"FontPath     "/usr/local/share/fonts/75dpi/"FontPath     "catalogue:/usr/local/etc/X11/fontpath.d"
EndSectionSection "Module"Load  "glx"
EndSectionSection "InputDevice"Identifier  "Keyboard0"Driver      "kbd"
EndSectionSection "InputDevice"Identifier  "Mouse0"Driver      "mouse"Option	    "Protocol" "auto"Option	    "Device" "/dev/sysmouse"Option	    "ZAxisMapping" "4 5 6 7"
EndSectionSection "Monitor"Identifier   "Monitor0"VendorName   "Monitor Vendor"ModelName    "Monitor Model"
EndSectionSection "Device"### Available Driver options are:-### Values: <i>: integer, <f>: float, <bool>: "True"/"False",### <string>: "String", <freq>: "<f> Hz/kHz/MHz",### <percent>: "<f>%"### [arg]: arg optional#Option     "Accel"              	# [<bool>]#Option     "AccelMethod"        	# <str>#Option     "Backlight"          	# <str>#Option     "CustomEDID"         	# <str>#Option     "DRI"                	# <str>#Option     "Present"            	# [<bool>]#Option     "ColorKey"           	# <i>#Option     "VideoKey"           	# <i>#Option     "Tiling"             	# [<bool>]#Option     "LinearFramebuffer"  	# [<bool>]#Option     "HWRotation"         	# [<bool>]#Option     "VSync"              	# [<bool>]#Option     "PageFlip"           	# [<bool>]#Option     "SwapbuffersWait"    	# [<bool>]#Option     "TripleBuffer"       	# [<bool>]#Option     "XvPreferOverlay"    	# [<bool>]#Option     "HotPlug"            	# [<bool>]#Option     "ReprobeOutputs"     	# [<bool>]#Option     "XvMC"               	# [<bool>]#Option     "ZaphodHeads"        	# <str>#Option     "VirtualHeads"       	# <i>#Option     "TearFree"           	# [<bool>]#Option     "PerCrtcPixmaps"     	# [<bool>]#Option     "FallbackDebug"      	# [<bool>]#Option     "DebugFlushBatches"  	# [<bool>]#Option     "DebugFlushCaches"   	# [<bool>]#Option     "DebugWait"          	# [<bool>]#Option     "BufferCache"        	# [<bool>]Identifier  "Card0"Driver      "intel"BusID       "PCI:0:2:0"
EndSectionSection "Screen"Identifier "Screen0"Device     "Card0"Monitor    "Monitor0"SubSection "Display"Viewport   0 0Depth     1EndSubSectionSubSection "Display"Viewport   0 0Depth     4EndSubSectionSubSection "Display"Viewport   0 0Depth     8EndSubSectionSubSection "Display"Viewport   0 0Depth     15EndSubSectionSubSection "Display"Viewport   0 0Depth     16EndSubSectionSubSection "Display"Viewport   0 0Depth     24EndSubSection
EndSection

这样一通,启动后报错:no screens found 

至少现在启动Xwindows不会卡死了,有小小的进步。

解决no screens found 报错问题

详细见:Xorg启动后报错no screens found(EE)(未解决)-CSDN博客

装驱动试试

sudo pkg install libva-intel-media-driver

startx后同样报错

试试安装intel-compute-runtime-llvm13

intel-compute-runtime-llvm13

问题照旧

后面重装了Xorg、Xfce4

更新升级FreeBSD

具体做了如下操作:

upgrade FreeBSD 13.1 to 13.3 and then upgrade to 14.1 

reinstall intel driver and Xorg  Xfce4

at last install xf86-input-evdev

升级FreeBSD从13.1到13.3,然后再升级到14.1版本。

重新安装了Intel 显卡驱动和Xorg Xfce4

这时候startx还是报错,但是startxfce4能够进入Xfce4桌面了,问题是鼠标和键盘会卡住。

这个时候跟刚开始有点类似,只不过刚开始的时候是无法进入Xfce4桌面,而是屏幕显示左上角一个白色方块,中间是鼠标,鼠标和键盘都无法响应。而现在是能进入Xfce4桌面,鼠标和键盘都无法响应。

尝试安装envdev,try install evdev

通过搜索网上得知,鼠标和键盘无法响应可能是输入模块有问题,也就是xf86-input-evdev模块,于是安装这个模块:

pkg install xf86-input-evdev

then keyboard and mouse are OK ! 

安装完成后,鼠标和键盘正常。这样系统就基本修复完成了。

总结

整个解决问题的过程可以说是步履蹒跚。大致分成三个组成部分:

1 尝试解决xrandr的报错:can't open display,后来发现是乌龙,tty下本来就是报错的。这里走了弯路。

2 一顿操作猛如虎,现在至少每次startx的时候,系统不会卡住了。也就是启动后,鼠标键盘不会卡死,可以通过Ctrl+alt+Fn组合键,切换到Tty控制台,进行后面的操作。

所做的主要操作就是升级了FreeBSD的核心,从13.1升级到14.1,并重装了xorg Xfce以及其它驱动软件包。

最后发现更新完这些软件包后,删除掉以前手工写的config文件后(/usr/local/etc/X11/xorg.conf.d/)系统能够进入xfce桌面,但是鼠标和键盘卡住。

3 解决鼠标键盘卡住的问题

操作就是安装xf86-input-evdev

pkg install xf86-input-evdev

关于no screens found的问题,值得单开一篇,文档记录:Xorg启动后报错no screens found(EE)(未解决)-CSDN博客


http://www.ppmy.cn/news/1536623.html

相关文章

SpringBoot助力校园资料分享:快速上手指南

2相关技术 2.1 MYSQL数据库 MySQL是一个真正的多学生、多线程SQL数据库服务器。 是基于SQL的客户/服务器模式的关系数据库管理系统&#xff0c;它的有点有有功能强大、使用简单、管理方便、安全可靠性高、运行速度快、多线程、跨平台性、完全网络化、稳定性等&#xff0c;非常适…

HTML图形

HTML图形 1. HTML5 Canvas2.HTML5 内联 SVG3.HTML 5 Canvas vs. SVG 1. HTML5 Canvas HTML5 的 canvas 元素使用 JavaScript 在网页上绘制图像。画布是一个矩形区域&#xff0c;您可以控制其每一像素。canvas 拥有多种绘制路径、矩形、圆形、字符以及添加图像的方法。 1、创建…

Spring与Spring Boot之间的区别

Spring和Spring Boot是用于开发Java企业应用的两个主流框架。虽然它们都属于Spring生态系统的一部分&#xff0c;但是它们各自有不同的使用场景和特点。 在本文中&#xff0c;我们将探讨Spring与Spring Boot之间的差异&#xff0c;针对他们之间特性的差异&#xff0c;做一个详…

AI学习指南深度学习篇-生成对抗网络的数学原理

AI学习指南深度学习篇-生成对抗网络的数学原理 引言 生成对抗网络&#xff08;GAN&#xff09;是一种深度学习模型&#xff0c;由Ian Goodfellow等人在2014年提出。GAN采用生成器与判别器对抗的方式进行数据生成&#xff0c;其在图像生成、图像超分辨率、文本生成等领域有着广…

Python绘制--绘制心形曲线

今天&#xff0c;我们将通过Python代码来绘制一个心形曲线&#xff0c;这是一个经典的数学表达。 一、心形曲线的数学原理 心形曲线&#xff0c;也被称为心脏曲线&#xff0c;是一个代数曲线&#xff0c;可以通过参数方程定义。其数学表达式如下&#xff1a; x16sin⁡3(t)x16…

PostgreSQL中使用RETURNING子句来返回被影响行的数据

在 PostgreSQL 中&#xff0c;当你执行一个 UPDATE 或 DELETE 操作时&#xff0c;通常希望获取被修改或删除行的数据。为此&#xff0c;PostgreSQL 提供了一个强大的特性&#xff0c;即使用 RETURNING 子句来返回被影响行的数据。 使用 RETURNING 子句 RETURNING 子句允许你在…

Klick‘r3.0.4 |智能自动点击,高效省力

Klick’r 是一款专为 Android 设计的开源自动点击工具&#xff0c;能识别屏幕上的图像并进行相应操作。支持游戏中的自动点击、应用测试及日常任务自动化。 大小&#xff1a;27M 百度网盘&#xff1a;https://pan.baidu.com/s/1881Zfevph6_2Zhdc-H_R4A?pwdolxt 夸克网盘&…

spring boot3.2.x与spring boot2.7.x对比

Spring Boot 3.2.x 相比 Spring Boot 2.7.x 带来了许多重要的变化、新特性以及性能改进。这些新功能不仅提升了开发者的效率&#xff0c;还优化了应用的性能和安全性。以下是两者的主要差异、优势以及使用说明&#xff1a; 1. JDK 17 支持 Spring Boot 2.7.x 支持 JDK 8 至 J…