一、起因
因部署oracle过程中需开启图形化界面而无法唤起,使用xclock测试图形化界面
二、环境:
系统:
CentOS Linux release 7.8.2003 (Core)
x11包版本如下:
[root@OEMPRINT-T-APP01 ~]# yum list installed|grep x11
x11vnc.x86_64 0.9.13-12.el7 @epel
x11vnc-javaviewers.noarch 0.9.13-12.el7 @epel
xorg-x11-apps.x86_64 7.7-7.el7 @os
xorg-x11-server-Xorg.x86_64 1.20.4-23.el7_9 @updates
xorg-x11-server-Xvfb.x86_64 1.20.4-23.el7_9 @updates
xorg-x11-server-common.x86_64 1.20.4-23.el7_9 @updates
xorg-x11-server-utils.x86_64 7.7-20.el7 @os
xorg-x11-xauth.x86_64 1:1.0.9-1.el7 @os
xorg-x11-xinit.x86_64 1.3.4-2.el7 @os
xorg-x11-xkb-utils.x86_64 7.7-14.el7 @os
二、使用xhost 测试图形化界面发现报错
[root@OEMPRINT-T-APP01 ~]# xclock
Error: Can't open display
三、解决
1.运行statrtx尝试运行X报错如下:unable to connect to X server: Connection refused
[root@OEMPRINT-T-APP01 ~]# startx
xauth: file /root/.serverauth.85539 does not exist
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: 3.10.0-957.1.3.el7.x86_64
Current Operating System: Linux OEMPRINT-T-APP01 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-1127.19.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8
Build Date: 05 April 2023 01:48:15PM
Build ID: xorg-x11-server 1.20.4-23.el7_9
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Aug 16 13:14:39 2023
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
VMware: No 3D enabled (0, Success).
Couldn't open libEGL.so.1: libEGL.so.1: cannot open shared object file: No such file or directory
(EE)
(EE) Backtrace:
(EE) 0: /usr/bin/X (xorg_backtrace+0x55) [0x55a6e8eedae5]
(EE) 1: /usr/bin/X (0x55a6e8d3c000+0x1b5769) [0x55a6e8ef1769]
(EE) 2: /lib64/libpthread.so.0 (0x7f4f9729e000+0xf630) [0x7f4f972ad630]
(EE) 3: /lib64/libc.so.6 (gsignal+0x37) [0x7f4f96f06387]
(EE) 4: /lib64/libc.so.6 (abort+0x148) [0x7f4f96f07a78]
(EE) 5: /lib64/libepoxy.so.0 (0x7f4f92d2d000+0x5e404) [0x7f4f92d8b404]
(EE) 6: /lib64/libepoxy.so.0 (0x7f4f92d2d000+0x5e764) [0x7f4f92d8b764]
(EE) 7: /lib64/libepoxy.so.0 (0x7f4f92d2d000+0xb7b3f) [0x7f4f92de4b3f]
(EE) 8: /lib64/libepoxy.so.0 (0x7f4f92d2d000+0xb9c1f) [0x7f4f92de6c1f]
(EE) 9: /lib64/libepoxy.so.0 (epoxy_has_egl_extension+0x18) [0x7f4f92de8088]
(EE) 10: /usr/lib64/xorg/modules/libglamoregl.so (glamor_egl_init+0x6f) [0x7f4f9326f8df]
(EE) 11: /usr/lib64/xorg/modules/drivers/modesetting_drv.so (0x7f4f93499000+0xae1e) [0x7f4f934a3e1e]
(EE) 12: /usr/bin/X (InitOutput+0x9b9) [0x55a6e8dda7a9]
(EE) 13: /usr/bin/X (0x55a6e8d3c000+0x61a20) [0x55a6e8d9da20]
(EE) 14: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7f4f96ef2555]
(EE) 15: /usr/bin/X (0x55a6e8d3c000+0x4bd0e) [0x55a6e8d87d0e]
(EE)
(EE)
Fatal server error:
(EE) Caught signal 6 (Aborted). Server aborting
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for 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.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
2.按照官方说法,添加DISPLAY变量即可解决,尝试未果
DISPLAY=<machine-name>:0.0
[root@OEMPRINT-T-APP01 ~]# export DISPLAY=localhost:0.0
[root@OEMPRINT-T-APP01 ~]# xclock
Error: Can't open display: localhost:0.0
查询了很多资料都是让DISPLAY绑定服务器host等等。
注:这里的<machine-name>实际指的是客户端远程ssh的主机名或者IP,也就是客户机的IP
MacBook-Pro ~ % ifconfig|grep 10.137
inet 10.137.102.39 netmask 0xffffff00 broadcast 10.137.102.255
重新给DISPLAY的环境变量解决。