很多用户创建dmdba用户安装达梦数据库,为了确保dmdba用户能正常调用图形化界面,已经参考root用户中xhost +后的环境变量即echo $DISPLAY命令得到的值,给该用户的.bash_profile中设置了环境变量export DISPLAY=:0(root用户echo $DISPLAY得到的)。
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host
[root@localhost ~]# echo $DISPLAY
:0
[root@localhost ~]# su - dmdba
上一次登录:一 2月 22 09:28:54 CST 2021pts/1 上
[dmdba@localhost ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin:/dm8/bin:/dm8/tool
export DISPLAY=:0
export PATH
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
[dmdba@localhost ~]$
[dmdba@localhost ~]# echo $DISPLAY
:0
这样看来,的确应该是没有问题了,但是在实际调用时却报“吐核”的错,无法打开图形化界面。
[root@localhost ~]# su - dmdba
上一次登录:日 2月 21 21:18:19 CST 2021pts/0 上
[dmdba@localhost ~]$ manager
No protocol specified
(Manager:18811): GLib-GObject-WARNING **: 09:28:03.212: invalid (NULL) pointer instance
(Manager:18811): GLib-GObject-CRITICAL **: 09:28:03.212: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(Manager:18811): Gtk-CRITICAL **: 09:28:03.212: IA__gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gtk-WARNING **: 09:28:03.263: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window
(Manager:18811): Gtk-WARNING **: 09:28:03.263: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_display: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_display_get_pointer: assertion 'GDK_IS_DISPLAY (display)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_monitor_at_point: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gtk-WARNING **: 09:28:03.263: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_n_monitors: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gtk-WARNING **: 09:28:03.263: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_monitor_geometry: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_colormap_get_visual: assertion 'GDK_IS_COLORMAP (colormap)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed
(Manager:18811): Gdk-CRITICAL **: 09:28:03.263: IA__gdk_window_new: assertion 'GDK_IS_WINDOW (parent)' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fdad82da2c7, pid=18811, tid=140578067654400
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.1-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libgdk-x11-2.0.so.0+0x7b2c7] __float128+0x7
#
# An error report file with more information is saved as:
# /home/dmdba/hs_err_pid18811.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/dm8/tool/manager: 行 17: 18811 已放弃 (吐核)"$JAVA_HOME/bin/java" -XX:+PerfDisableSharedMem -DDM_HOME="$DM_HOME" -Djava.library.path="$DM_HOME/bin" -Ddameng.log.file="$TOOL_HOME/log4j.xml" -DeclipseHome="$TOOL_HOME" -Dosgi.nl="$INSTALL_LANGUAGE" -Ddameng.dts.explorer.root="$TOOL_HOME/workspace/local/dts" -Ddameng.isql.explorer.root="$TOOL_HOME/workspace/local/isql" -Duse_bak2=true -Dapp.name=manager -XX:MaxPermSize=256m -jar "$TOOL_HOME/plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar" -os linux -ws gtk -arch x86_64 -showsplash "$TOOL_HOME/manager.bmp" -data "$TOOL_HOME/workspace/manager" -product com.dameng.manager.product -name Manager
[dmdba@localhost ~]$ echo $DISPLAY
:0
[dmdba@localhost ~]$ xhost +
No protocol specified
xhost: unable to open display ":0"
可以看到,经过环境变量已经生效但是依旧报错。这个时候我们在dmdba用户中执行了xhost +却报错No protocol specified、xhost: unable to open display ":0"。
这个时候我们先在root用户中执行xhost +,然后再切回到dmdba中执行xhost +。
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host
[root@localhost ~]# su - dmdba
上一次登录:一 2月 22 09:36:48 CST 2021pts/2 上
[dmdba@localhost ~]$ xhost +
access control disabled, clients can connect from any host
[dmdba@localhost ~]$
[dmdba@localhost ~]$ manager
ok,完美解决。
更多资讯请上达梦技术社区了解:https://eco.dameng.com