4

I just upgraded from Ubuntu 16.04 to 18.04. My workflow is to connect from Windows using VcXsrv to Ubuntu (ssh with X tunneling), starting a xterm on Ubuntu. Inside the xterm I am typing gnome-terminal to get a gnome-terminal.

Since the upgrade this is not working anymore. I am getting

$ gnome-terminal  
# Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.  
# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Fehler beim Aufruf von StartServiceByName für org.gnome.Terminal: Zeitüberschreitung wurde erreicht  

or when starting with English locale

$ LANG=en_US.utf8 gnome-terminal  
# Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.  
# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached

I am not always getting the first line, but I am always gettint the timeout error.

Digging more into the issue I found out

  • sudo gnome-terminal works
  • gnome-terminal works when run in a xterm when locally logged in on the PC
  • when I am also logged in locally on the PC then gnome-terminal in the remote session's xterm opens a gnome-terminal on the local session on the PC (still getting the first error line about registering with accessibility bus)
  • when I am also logged in over rdp (Windows network connection) then a gnome-terminal in the ssh session opens a gnome-terminal in the xrdp session
  • when I login over rdp (Windows network connection), logoff there, then gnome-terminal can open a gnome-terminal

What can I do to get gnome-terminal in a remote session's xterm to work?

1
  • 1
    I encountered this issue after installing google remote desktop
    – dan carter
    May 19 '19 at 22:33
13

Identical issue, found the solution.

Running 'tail -f /var/log/syslog' in a 2nd terminal when testing in the first terminal gives the following when I launch gnome-terminal after 'sudo bash':

Mar 23 10:11:59 X399-DESIGNARE-EX dbus-daemon[2584]: [session uid=0 pid=2582] Activating service name='org.gnome.Terminal' requested by ':1.6' (uid=0 pid=2929 comm="/usr/bin/gnome-terminal.real " label="unconfined")
Mar 23 10:11:59 X399-DESIGNARE-EX gnome-terminal-[2934]: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-GAXcx1c8OL: Connection refused
Mar 23 10:11:59 X399-DESIGNARE-EX dbus-daemon[2584]: [session uid=0 pid=2582] Successfully activated service 'org.gnome.Terminal'
Mar 23 10:11:59 X399-DESIGNARE-EX gnome-terminal-[2934]: The owner of /home/<user>/.config/ibus/bus is not root!

I get the following when running gnome-terminal as myself:

Mar 23 10:16:30 X399-DESIGNARE-EX dbus-daemon[2564]: [session uid=1000 pid=2564] Activating via systemd: service name='org.gnome.Terminal' unit='gnome-terminal-server.service' requested by ':1.4' (uid=1000 pid=2959 comm="/usr/bin/gnome-terminal.real " label="unconfined")
Mar 23 10:16:30 X399-DESIGNARE-EX systemd[2435]: Starting GNOME Terminal Server...
Mar 23 10:16:30 X399-DESIGNARE-EX systemd[2435]: gnome-terminal-server.service: Main process exited, code=exited, status=10/n/a
Mar 23 10:16:30 X399-DESIGNARE-EX gnome-terminal-server[2962]: Unable to init server: Could not connect: Connection refused
Mar 23 10:16:30 X399-DESIGNARE-EX gnome-terminal-server[2962]: Failed to parse arguments: Cannot open display:
Mar 23 10:16:30 X399-DESIGNARE-EX systemd[2435]: gnome-terminal-server.service: Failed with result 'exit-code'.
Mar 23 10:16:30 X399-DESIGNARE-EX systemd[2435]: Failed to start GNOME Terminal Server.

...after a lot of digging I finally found gnome-terminal not starting, which indicated there is an issue with dbus not refreshing its environment when services get requested from non-root. The following steps work around the problem:

  1. Create a script in your home folder, e.g.:

vim ~/term

  1. Add the following to the script and save it:

#!/usr/bin/env bash dbus-update-activation-environment --systemd --all gnome-terminal &

  1. Make script executable

chmod 755 ~/term

  1. Run '~/term' to start up gnome-terminal as user (not root) and it should start correctly.

NOTE TO MODERATOR:

Please do NOT delete an answer that provides additional detail for the problem. What you deleted was not any violation of the posting guidelines, and provided substantial additional information for anyone trying to track down the solution. This answer does not provide that additional information and I am disinclined to go through the effort of recovering it.

This answer solves the problem.

PLEASE DO NOT DELETE IT!

4
  • 1
    That worked great!! I just edited the gnome-terminal desktop file in /usr/share/applications to point to the script. TryExec=/opt/scripts/term Given the catch22 of you can't open a terminal to run the script this is the best way to preempt the direct execution of /usr/bin/gnome-terminal
    – DKebler
    Jan 27 '20 at 17:36
  • Re: catch22 -- some of the younger readers may not know what that means. :) My approach was a bit more convoluted: (1) move gnome-terminal app to gnome-terminal-orig, (2) modify above script to invoke gnome-terminal-orig, and (3) link /usr/bin/gnome-terminal to the above script. Yeah, your way is much simpler. Mar 21 '20 at 19:33
  • 1
    in the end I opted for @kch approach as then it works no matter where called even from x11forwarding. Also another gotcha is that if you have python 3.8 installed and linked as python3 you need to change the shebang in gnome-terminal (the original) to #!/usr/bin/python3.6 as gnome-terminal doesn't like 3.8.
    – DKebler
    Mar 26 '20 at 18:15
  • 1
    copy and paste this to a prompt. Does all the steps at once sudo mv /usr/bin/gnome-terminal /usr/bin/gnome-terminal.py && \ echo ' #!/usr/bin/env bash dbus-update-activation-environment --systemd --all gnome-terminal.py & ' | sudo tee /usr/bin/gnome-terminal && \ sudo chmod a+rx /usr/bin/gnome-terminal
    – DKebler
    Mar 26 '20 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.