Linux - CentOS 8的gnome-terminal无法弹到CentOS 7.9桌面

Linux - CentOS 8的gnome-terminal无法弹到CentOS 7.9桌面

问题

CentOS 8的gnome-terminal无法弹到CentOS 7.9桌面,报错

Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached

问题分析

CentOS 7.9的gnome-terminal使用的是per session的dbus环境,而CentOS 8的桌面环境使用的是per user的。因此从CentOS 8的gnome-terminal弹到CentOS 7.9的X Server上,无法弹出来,会超时报错退出。

定制gnome-terminal启动环境

定制modulefile,名称为gnome_terminal_setting_modulefile

[thesre@centos8 ~]$ cat ~/privatemodules/opensource/gnome_terminal_setting/1.0
#%Module1.0
#Author: thensre

# Alias only be set when loaded.
switch -- [module-info mode] {
        add -
        load -
        switch2 {
                set-alias gnome-terminal "source ~/privatemodules_procedures/gnome_terminal_settings.csh \\\\!\\*; \\\\gnome-terminal \\\\!\\*"
        }
}
[thesre@centos8 ~]$ 
[thesre@centos8 ~]$ cat ~/privatemodules_procedures/gnome_terminal_setting.csh
if ($?DBUS_SESSION_BUS_ADDRESS) then
        if ($DBUS_SESSION_BUS_ADDRESS =~ unix:path=/run/user/*) then
                goto dbus_setting_for_gnome_terminal
        endif
else
        goto dbus_setting_for_gnome_terminal
endif

dbus_setting_for_gnome_terminal:
        if ($#argv > 0) then
                set __display=`echo \!* | sed -r 's#.*--display=([^ ]*).*#\1#g'`
        endif
        if ((!$?__display || $__display == "") && $?DISPLAY) then
                set __display="$DISPLAY"
        endif

        if ($?__display && $__display != "") then
                set display_string=`echo $__display | sed -r -e 's#:#_#g' -e 's#\.[0-9]$##g'`
                set machine_id="`cat /var/lib/dbus/machine-id`"
                set dbus_file="~/.dbus/session-bus/${machine_id}-${display_string}"
                if (-f ${dbus_file}) then
                        eval `cat ${dbus_file} | grep -v '^#' \
                        | sed -r -e 's#DBUS_SESSION_BUS_ADDRESS=#setenv DBUS_SESSION_BUS_ADDRESS #g; \
                                 -e 's#DBUS_SESSION_BUS_PID=#setenv DBUS_SESSION_BUS_PID #g; \
                                 -e 's#DBUS_SESSION_BUS_WINDOW=#setenv DBUS_SESSION_BUS_WINDOW #g; \
                        '`
                endif
                ps -p $DBUS_SESSION_BUS_PID >& /dev/null
                if ($? != 0) then
                        rm -rf ${dbus_file}
                        eval `timeout 5s /usr/bin/dbus-launch --csh-syntax`
                endif
        else
                eval `timeout 5s /usr/bin/dbus-launch --csh-syntax`
        endif
        unset __display display_string machine_id dbus_file
        

参考资料

https://thesre.wordpress.com/2020/04/05/error-constructing-proxy-for-org-gnome-terminal-org-gnome-terminal-factory0-error-calling-startservicebyname-for-org-gnome-terminal-timeout-was-reached/

https://bugzilla.redhat.com/show_bug.cgi?id=1353953

https://dbus.freedesktop.org/doc/dbus-specification.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王万林 Ben

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值