2

I' try to play with Xephyr under tty:

$ DISPLAY=:0 Xephyr -ac -screen 800x600 -host-cursor

Xephyr cannot open host display. Is DISPLAY set?

As u can see, DISPLAY has been set, but Xephyr still cannot see it.

Chen Li
  • 377
  • DISPLAY cannot be just anything. For :0 there should be a /tmp/.X11-unix/X0 unix socket (or an @/tmp/.X11-unix/X0 abstract unix socket on Linux) and an X11 server listening on it. And DISPLAY is not always :0. On some distros, it's something like :8 or similar. When forwarded via ssh, it's localhost:10.0. –  Mar 07 '20 at 10:49
  • Also, why are you using -ac? It's pointless. Is that copied from somewhere else? Where from? –  Mar 07 '20 at 10:53
  • You have to export DISPLAY=:0; most programs get it from their environment. IIRC, some systems need 0.0. The generic format is 'hostname:workstation.screen' – Paul_Pedant Mar 07 '20 at 11:44
  • 1
    @Paul_Pedant no, FOO=bar cmd will export FOO in the environment of cmd, just try with FOO=bar printenv FOO. And :0 is enough, no need of :0.0. –  Mar 07 '20 at 12:11
  • @mosvy. Actually, Xephyr documentation specifically shows (a) export DISPLAY=:1.0, and (b) Display is an arg:: Xephyr -ac -screen 1024x768 -br -reset -terminate 2> /dev/null :1 &. It's an X-on-X server and apparently abhors :0. If we do not change it, Xephyr won't get any data forwarded to it. – Paul_Pedant Mar 07 '20 at 19:55
  • Xephyr is a nested X server. You're mixing up the display Xephyr runs on with the one it creates for other X11 clients to run on. And no, there's no need of .0, screen 0 is the default anyway (and the only one in 99.99% of cases). –  Mar 07 '20 at 20:28
  • @Paul_Pedant if the OP doesn't add a :1 or :7 (or whatever free display name) to their command, as in DISPLAY=:0 Xephyr :1 -screen 800x600 -host-cursor, then Xephyr will die with an error like Another server is already active for display :0. But they haven't reached that point yet. Their Xephyr has yet to connect to the display it should run in. –  Mar 07 '20 at 20:42
  • @mosvy, And, although it apparently got passed the X server DISPLAY, it says it is unset. So presumably we can't diagnose the fault from the information provided. Maybe there is a log, or a diagnostic mode, or a better manual, or a bug-fix. – Paul_Pedant Mar 07 '20 at 21:38
  • @Paul_Pedant The same error happens when it cannot open the display unix socket. Try with DISPLAY=:19 Xephyr :1 or (on Linux) unshare -Urnm sh -c 'mkdir -p /tmp/junk; mount -B /tmp/junk /tmp/.X11-unix; Xephyr :1' (which runs in a namespace where it doesn't have access to /tmp/.X11-unix/X0 or @ /tmp/.X11-unix/X0. It's nothing special; the error has been that obtuse since 40 years or so. –  Mar 07 '20 at 22:06

1 Answers1

1

Xephir runs on X11. If you are running on a tty (i.e., virtual console on Linux, no graphics), there is no X server to connect to. Ditto if you are running Wayland on your display server, no X server around.

vonbrand
  • 18,253