X-server and X11 forwarding #105

Closed
boulund opened this Issue May 15, 2014 · 8 comments

Projects

None yet

5 participants

@boulund
boulund commented May 15, 2014

I was looking for a way to enable X11 forwarding (when I SSH to remote Linux computers) but couldn't find anything mentioned about this. How is this supposed to work? What can I do to help?

When I connect to a server with ssh -X user@server and try to run e.g. xterm I just get the following error message:

xterm: Xt error: Can't open display:
xterm: DISPLAY is not set

I tried installing xterm into babun using pact, like so: pact install xterm and it installed a lot of dependencies, but I get the same error message trying to run xterm from my local babun shell.
I could also mention that I'm using VcXsvr on my Windows 8.1 machine as X-server normally (when using PuTTY) and it works great. I also tried setting DISPLAY=localhost:10.0 which usually fixes things, but this had no effect in babun:

xterm Xt error: Can't open display: localhost:10.0
@tombujok
Contributor

You would have to have a look how to do it - it's documented in the cygwin manual.
Please let us know if you get it working - I will include this in the doc.

@boulund
boulund commented May 15, 2014

Ok, making progress but still not quite there.
Following instructions in the official Cygwin documentation (http://x.cygwin.com/docs/ug/setup-cygwin-x-installing.html) I found the following packages which supposedly include all the required stuff:

  • xorg-server
  • xinit
  • xorg-docs (optional)

Now, running pact install xorg-server xinit xorg-docs installs all the packages and their dependencies. However, when running xinit or startxwin I get an error related to fonts:

Warning: Cannot convert string "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-*" to type FontStruct
Warning: Unable to load any usable ISO8859 font
Warning: Unable to load any usable ISO8859 font
Error: Aborting: no font found

I don't have time to dig further right now, but figured I'd post this in the hope it might be useful for someone else trying to use X11 forwarding in babun.

@tombujok tombujok added the feedback label May 15, 2014
@robertvesco

I had a similar issue to you. I've mostly figure it out though it's not elegant. It has to do with improperly configured fonts.
Cygwin used to have this problem: http://www.cygwin.com/ml/cygwin-xfree/2009-02/msg00116.html

More about fonts can be found here:
http://unix.stackexchange.com/questions/107807/how-to-configure-fonts-on-a-remote-x-connection-xdmcp-vs-ssh

Some ways to fix (from memory so some things may be wrong)

  1. startxwin tries to start xterm, but fails because xterm cannot find the right fonts
  2. Change startxwin so that it does not start xterm automatically. Do this by creating an .Xwin file in your home directory. See example in man page.
  3. Now you can start startxwin without it crashing.
    Now you can type the commands in the first link above, but you need to prepend the display of the xserver, so

DISPLAY=:0 xset fp built-ins
DISPLAY=:0 xlsfonts -fn "----R----120-----ISO8859-*"
DISPLAY=:0 xterm

This will start xterm in bash, type zsh to get to z-shell.

I also had some issues with dbus (for emacs-x11).
that was solve with this http://vm89.blogspot.com/2013/09/d-bus-library-appears-to-be-incorrectly.html
but putting the uuid to /etc/machine-id instead.

So, in sum, this was an issue that cygwin used to have, but was apparently fixed. It may be that it was reintroduced or perhaps some setting by the babun devs recreated this.

I would like to know if the babun devs have successfully run cygwin-x programs or not. If not, they should make sure their default configurations work with it as cygwin-x is very important for a lot of people.

Hope this helps. And thanks to the babun devs - it solves a lot of problems and I love it.

@robertvesco

Here is probably a simpler solution:
Create a .XWinrc file in your home directory and fill it with this

MENU systray {
xterm EXEC "xterm -display %display% -fn fixed -e zsh"
emacs EXEC "emacs-X11 -display %display%"
SEPARATOR
}
ROOTMENU systray

Create a .Xresources file and fill it with this. This controls fonts and colors of xterm. Change to your liking, but the font line is crucial.

Xft_antialias: true
Xft_autohint: true
XTerm_background: black
XTerm_foreground: grey
XTerm_cursorColor: grey
XTerm.vt100.geometry: 79x25
XTerm_scrollBar: true
XTerm_rightScrollBar: true
XTerm_saveLines: 10000
XTerm_faceName: Monospaced
XTerm_faceSize: 12
XTerm_toolBar: off
xTerm.VT100.utf8: 1
xTerm.VT100.renderFont: true
XTerm_font: -misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1

Lastly, create a .startxwinrc file

#!/bin/sh
xrdb -merge ~/.Xresources

then from the babun terminal type
startxwin

that will load the x windows applet in your system tray. Select xterm in the system tray. The ssh -X to whatever server you want. You'll then be able to use xterm.

Hope this helps.

@coulas
coulas commented Jun 11, 2014

rlvesco7 ๐Ÿ‘ : I confirm it does the job.
tombujok ๐Ÿ‘ : I was looking for a way to get an XServer able to launch a local xterm and receive X11 forwarding from ssh (displaying gedit from remote servers). The above comment helped me to do exactly that.
One may need to add the launch of startxwin in a babun startup script (bashrc ?)

Many thanks to both of you !

@tombujok
Contributor

Great guys, would anybody volunteer to be the proud author and contributor of this feature?
We would need a pull request with a new plugin: xserver.
All the modifications would be included there -> pact plugin is a great example of a small plugin to start with.
How to code up a plugin is described here: http://babun.github.io/development/

Community appreciation guaranteed ๐Ÿ‘ :)

@tombujok tombujok removed the feedback label Feb 4, 2015
@tombujok
Contributor
tombujok commented Feb 4, 2015

Moved to FAQ.
It would be great if somebody contributed a plugin with these fixes

@tombujok tombujok closed this Feb 4, 2015
@jhpaul jhpaul referenced this issue May 26, 2015
Merged

xserver plugin #343

@WASasquatch

As a note, I had no issues start xterm! How I did this, right out of the box is I ran a couple commands

pact install openbox
CHMOD 0700 /tmp/uscreens/S-$USER && screen -dmS x bash -c 'startxwin' <-- Testing startxwin on screen
startx /usr/bin/openbox

Though this was just for openbox, and all it's features will not be install (gimp, browser, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment