How can I launch gnome-terminal remotely on my headless server? (fails to launch over X11 forwarding)
That doesn't work because gnome-terminal
(like any other gnome-thing
) will try to connect to dbus and fail after not receiving a response for a long while.
The easiest work-around is just to start a dbus instance for your session:
export $(dbus-launch)
gnome-terminal
If you started a Wayland session on the remote machine since you have first run the export $(dbus-launch)
, you'll have to run it again, or if not gnome-terminal
will start a Wayland instance of gnome-terminal
on the remote display instead of an X11 one on your forwarded display.
Another workaround in this case is to explicitly run an X11 gnome-terminal-server
which will terminate after the last window using it had closed. Example:
#! /bin/bash
ID=foo.bar$RANDOM
GDK_BACKEND=x11 /usr/libexec/gnome-terminal-server --app-id "$ID" &
sleep .4 # yuck
gnome-terminal --app-id "$ID"
wait
Related videos on Youtube
Nicholas Clark
Updated on September 18, 2022Comments
-
Nicholas Clark over 1 year
I have a headless VM (running Ubuntu server 17.04) that I use SSH to access. I'm comfortable with the basics of X11 forwarding, and I can forward xterm and friends just fine. XFCE terminal also forwards OK.
I'd like to be able to use Gnome terminal, but it doesn't seem to launch. Instead, it just hangs for awhile and eventually errors out with:
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached
Interestingly, gnome-terminal works remotely over X11 if I have a local desktop session running on my VM (launched via startx).
I'm guessing there's some kind of Gnome service that needs to be running, but I can't figure out what it is or how to start it outside of the context of a full desktop session. I don't usually launch those because the VM is headless by default.
Anybody got some insight on what I could do to get Gnome-terminal working remotely without having to start a GUI desktop session locally on my VM?
-
tink over 6 yearsWhat exactly are you trying to accomplish by having a remote graphical terminal running?
-
Nicholas Clark over 6 yearsI do a lot of development work on the VM, mostly in terminal windows. I like using a graphical terminal so that I get tabs, window management, etc. It's not uncommon for me to have 3 or 4 terminal windows open with 4 or 5 tabs each. Rather than try to manage all that by starting tons of SSH sessions (or running a GUI in my VM), I like to start the a graphical terminal and use it that way (then I can switch between native apps and my VM seamlessly).
-
JdeBP over 6 yearsThis is really the same as unix.stackexchange.com/questions/344617 .
-
Nicholas Clark over 6 years@JdeBP woah dang, you nailed it!! That works perfectly. If you put that in an answer I'll accept it
-
JdeBP over 6 years
-
-
Nicholas Clark over 6 yearsI'm actually using SSH forwarding to talk to a VM running locally on my employer-provided machine. Our IT department is zealous that nobody's machine can boot to a non-blessed OS. Xfce-terminal works OK for me, but I'd like some of the polish that gnome provides.
-
bootbeast over 6 yearsExactly, I like it too. So you can tunnel VNC over SSH and run gnome-terminal remotely.