Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Failed to run Emacs in X windows mode on remote host over ssh with X11 forwarding enabled.

302 views
Skip to first unread message

hongy...@gmail.com

unread,
Jul 27, 2021, 9:30:51 AM7/27/21
to
On LAN, I'm trying to run Emacs on another machine, as shown below:

$ ssh -X wer...@192.168.10.100
$ emacs

At this moment, I noticed the following information:

Display localhost:10.0 unavailable, simulating -nw

As a result, Emacs will run in console mode and can't be able to
communicate with X.

Any hints for solving this problem?

Regards,
HY

Grant Taylor

unread,
Jul 27, 2021, 2:33:54 PM7/27/21
to
On 7/27/21 7:30 AM, hongy...@gmail.com wrote:
> Any hints for solving this problem?

What is the DISPLAY environment variable set to?

Do any X11 programs work through SSH?



--
Grant. . . .
unix || die

David W. Hodgins

unread,
Jul 27, 2021, 3:34:45 PM7/27/21
to
On the system you're connected to, in /etc/ssh/sshd_config is the config set to ...
X11Forwarding yes

Regards, Dave Hodgins

--
Change dwho...@nomail.afraid.org to davidw...@teksavvy.com for
email replies.

Keith Thompson

unread,
Jul 27, 2021, 3:58:13 PM7/27/21
to
Apparently $DISPLAY is being set to "localhost:10.0", which is typical.

This is unlikely to be specific to emacs. I presume other X client
programs fail similarly, but to verify try running "xlogo" or "xclock".

Try running "xdpyinfo". (Warning: It produces several thousand lines of
output on my system).

It's possible that "ssh -Y" would avoid the problem. It's worth trying,
but be sure to read the documentation, since it bypasses some security
checks. (It might be acceptable if the LAN is entirely under your
control, though others might disagree with that.)

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

hongy...@gmail.com

unread,
Jul 27, 2021, 9:32:25 PM7/27/21
to
On Wednesday, July 28, 2021 at 2:33:54 AM UTC+8, Grant Taylor wrote:
> On 7/27/21 7:30 AM, hongy...@gmail.com wrote:
> > Any hints for solving this problem?
> What is the DISPLAY environment variable set to?

On server side:

werner@X10DAi:~$ echo $DISPLAY
:1

On client side, it's empty:

$ echo $DISPLAY

$

> Do any X11 programs work through SSH?

I run ssh in verbose mode (-v):

$ ssh -vX wer...@192.168.10.100

Then xterm also fails to open display, and it says that X11 connection
rejected because of wrong authentication. I've enabled the
following options on server and client sides:

On server side:

$ grep ^X11Forwarding /etc/ssh/sshd_config
X11Forwarding yes

On client side:

$ grep '^[ ]*ForwardX11' /etc/ssh/ssh_config
ForwardX11 yes

hongy...@gmail.com

unread,
Jul 27, 2021, 9:33:56 PM7/27/21
to
On Wednesday, July 28, 2021 at 3:34:45 AM UTC+8, David W. Hodgins wrote:
> On Tue, 27 Jul 2021 09:30:48 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
>
> > On LAN, I'm trying to run Emacs on another machine, as shown below:
> >
> > $ ssh -X wer...@192.168.10.100
> > $ emacs
> >
> > At this moment, I noticed the following information:
> >
> > Display localhost:10.0 unavailable, simulating -nw
> >
> > As a result, Emacs will run in console mode and can't be able to
> > communicate with X.
> >
> > Any hints for solving this problem?
> On the system you're connected to, in /etc/ssh/sshd_config is the config set to ...
> X11Forwarding yes

Yes:

Grant Taylor

unread,
Jul 27, 2021, 9:41:01 PM7/27/21
to
On 7/27/21 7:32 PM, hongy...@gmail.com wrote:
> On server side:
>
> werner@X10DAi:~$ echo $DISPLAY
> :1

Did you run that from your SSH connection? Or directly on the server?

:1 /may/ be okay for a remote connection. But it may also be a
reference to a local / physical display on the server.

> On client side, it's empty:
>
> $ echo $DISPLAY

I would have expected the client to have a DISPLAY variable set.
ESPECIALLY if running it form in a GUI terminal emulator.

> I run ssh in verbose mode (-v):

Verbose mode shouldn't change the behavior of X11 forwarding. But it
will give more information.

> Then xterm also fails to open display, and it says that X11 connection
> rejected because of wrong authentication.

Okay. That's sort of what I was expecting.

You can use the 'xhost' command to allow other clients to connect
bypassing the ~/.Xauthority (?) cooky. E.g.

xhost +192.0.2.1

That should allow 192.0.2.1 to connect to your local X11 display.

N.B. You can remove the IP and just use "+" to allow all IPs to connect
too.

Use the following command to remove permission:

xhost -

N.B. My understanding is that the xhost permissions are non-persistent.

> I've enabled the following options on server and client sides:

That means that OpenSSH is configured to allow X11 forwarding.

As Keith mentioned, the "-Y" option may help.

hongy...@gmail.com

unread,
Jul 27, 2021, 9:44:25 PM7/27/21
to
On Wednesday, July 28, 2021 at 3:58:13 AM UTC+8, Keith Thompson wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> > On LAN, I'm trying to run Emacs on another machine, as shown below:
> >
> > $ ssh -X wer...@192.168.10.100
> > $ emacs
> >
> > At this moment, I noticed the following information:
> >
> > Display localhost:10.0 unavailable, simulating -nw
> >
> > As a result, Emacs will run in console mode and can't be able to
> > communicate with X.
> >
> > Any hints for solving this problem?
> Apparently $DISPLAY is being set to "localhost:10.0", which is typical.
>
> This is unlikely to be specific to emacs. I presume other X client
> programs fail similarly, but to verify try running "xlogo" or "xclock".

Both "xlogo" and "xclock" run correctly.

> Try running "xdpyinfo". (Warning: It produces several thousand lines of
> output on my system).

werner@X10DAi:~$ xdpyinfo
name of display: localhost:10.0
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 12008000
X.Org version: 1.20.8
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
number of supported pixmap formats: 7
supported pixmap formats:
depth 1, bits_per_pixel 1, scanline_pad 32
depth 4, bits_per_pixel 8, scanline_pad 32
depth 8, bits_per_pixel 8, scanline_pad 32
depth 15, bits_per_pixel 16, scanline_pad 32
depth 16, bits_per_pixel 16, scanline_pad 32
depth 24, bits_per_pixel 32, scanline_pad 32
depth 32, bits_per_pixel 32, scanline_pad 32
keycode range: minimum 8, maximum 255
focus: window 0x3805921, revert to Parent
number of extensions: 30
BIG-REQUESTS
Composite
DAMAGE
DOUBLE-BUFFER
DPMS
DRI2
GLX
Generic Event Extension
MIT-SCREEN-SAVER
MIT-SHM
NV-CONTROL
NV-GLX
Present
RANDR
RECORD
RENDER
SECURITY
SHAPE
SYNC
X-Resource
XC-MISC
XFIXES
XFree86-DGA
XFree86-VidModeExtension
XINERAMA
XINERAMA
XInputExtension
XKEYBOARD
XTEST
XVideo
default screen number: 0
number of screens: 1

screen #0:
dimensions: 1920x1080 pixels (602x343 millimeters)
resolution: 81x80 dots per inch
depths (7): 24, 1, 4, 8, 15, 16, 32
root window id: 0x1dd
depth of root window: 24 planes
number of colormaps: minimum 1, maximum 1
default colormap: 0x20
default number of colormap cells: 256
preallocated pixels: black 0, white 16777215
options: backing-store WHEN MAPPED, save-unders NO
largest cursor: 256x256
current input event mask: 0xda0033
KeyPressMask KeyReleaseMask EnterWindowMask
LeaveWindowMask StructureNotifyMask SubstructureNotifyMask
SubstructureRedirectMask PropertyChangeMask ColormapChangeMask
number of visuals: 132
default visual id: 0x21
visual:
visual id: 0x21
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x22
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x24
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x25
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x26
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x27
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x28
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x29
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2a
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2b
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2c
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2d
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2e
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x2f
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x30
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x31
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x32
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x33
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x34
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x35
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x36
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x37
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x38
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x39
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3a
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3b
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3c
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3d
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3e
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x3f
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x40
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x41
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x42
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x43
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x44
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x45
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x46
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x47
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x48
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x49
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4a
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4b
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4c
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4d
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4e
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x4f
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x50
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x51
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x52
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x53
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x54
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x55
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x56
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x57
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x58
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x59
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5a
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5b
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5c
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5d
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5e
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x5f
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x60
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x61
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x62
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x63
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x64
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x65
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x66
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x67
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x68
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x69
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6a
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6b
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6c
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6d
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6e
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x6f
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x70
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x71
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x72
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x73
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x74
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x75
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x76
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x77
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x78
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x79
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 11 bits
visual:
visual id: 0x23
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7a
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7b
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7c
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7d
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7e
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x7f
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x80
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x81
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x82
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x83
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x84
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x85
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x86
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x87
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x88
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x89
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8a
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8b
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8c
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8d
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8e
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x8f
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x90
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x91
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x92
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x93
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x94
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x95
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x96
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x97
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x98
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x99
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9a
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9b
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9c
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9d
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9e
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x9f
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa0
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa1
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa2
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa3
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa4
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits



> It's possible that "ssh -Y" would avoid the problem. It's worth trying,
> but be sure to read the documentation, since it bypasses some security
> checks. (It might be acceptable if the LAN is entirely under your
> control, though others might disagree with that.)

I tried with:

$ ssh -Y wer...@192.168.10.100

But still meet the following msg:

werner@X10DAi:~$ emacs
Display localhost:10.0 unavailable, simulating -nw

HY

Keith Thompson

unread,
Jul 27, 2021, 10:04:46 PM7/27/21
to
"hongy...@gmail.com" <hongy...@gmail.com> writes:
> On Wednesday, July 28, 2021 at 2:33:54 AM UTC+8, Grant Taylor wrote:
>> On 7/27/21 7:30 AM, hongy...@gmail.com wrote:
>> > Any hints for solving this problem?
>> What is the DISPLAY environment variable set to?
>
> On server side:
>
> werner@X10DAi:~$ echo $DISPLAY
> :1
>
> On client side, it's empty:
>
> $ echo $DISPLAY
>
> $

That seems inconsistent with your original post. You said you got this
message from emacs:

Display localhost:10.0 unavailable, simulating -nw

which strongly implies that $DISPLAY was set to "localhost:10.0", at
least in your emacs process.

Try `echo $DISPLAY` and `emacs` from the same shell process. If you get
an empty string from the first (it's more likely that $DISPLAY is not
set than that it's set to the empty string) and "Display localhost:10.0
unavailable, simulating -nw" from emacs, then something very strange is
going on.

What does `env | grep '^DISPLAY='` print?

Keith Thompson

unread,
Jul 27, 2021, 10:06:42 PM7/27/21
to
"hongy...@gmail.com" <hongy...@gmail.com> writes:
> On Wednesday, July 28, 2021 at 3:58:13 AM UTC+8, Keith Thompson wrote:
>> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>> > On LAN, I'm trying to run Emacs on another machine, as shown below:
>> >
>> > $ ssh -X wer...@192.168.10.100
>> > $ emacs
>> >
>> > At this moment, I noticed the following information:
>> >
>> > Display localhost:10.0 unavailable, simulating -nw
>> >
>> > As a result, Emacs will run in console mode and can't be able to
>> > communicate with X.
>> >
>> > Any hints for solving this problem?
>> Apparently $DISPLAY is being set to "localhost:10.0", which is typical.
>>
>> This is unlikely to be specific to emacs. I presume other X client
>> programs fail similarly, but to verify try running "xlogo" or "xclock".
>
> Both "xlogo" and "xclock" run correctly.
>
>> Try running "xdpyinfo". (Warning: It produces several thousand lines of
>> output on my system).
>
> werner@X10DAi:~$ xdpyinfo
> name of display: localhost:10.0
> version number: 11.0
> vendor string: The X.Org Foundation
[993 lines deleted]

I guess I should have said that we don't need to see all the output.
It was basically a test to see whether the display is there.

>> It's possible that "ssh -Y" would avoid the problem. It's worth trying,
>> but be sure to read the documentation, since it bypasses some security
>> checks. (It might be acceptable if the LAN is entirely under your
>> control, though others might disagree with that.)
>
> I tried with:
>
> $ ssh -Y wer...@192.168.10.100
>
> But still meet the following msg:
>
> werner@X10DAi:~$ emacs
> Display localhost:10.0 unavailable, simulating -nw

hongy...@gmail.com

unread,
Jul 27, 2021, 10:07:19 PM7/27/21
to
On Wednesday, July 28, 2021 at 9:41:01 AM UTC+8, Grant Taylor wrote:
> On 7/27/21 7:32 PM, hongy...@gmail.com wrote:
> > On server side:
> >
> > werner@X10DAi:~$ echo $DISPLAY
> > :1
> Did you run that from your SSH connection? Or directly on the server?

Directly on the server:
werner@X10DAi:~$ echo $DISPLAY
:1

From the SSH connection

werner@X10DAi:~$ echo $DISPLAY
localhost:10.0

> :1 /may/ be okay for a remote connection. But it may also be a
> reference to a local / physical display on the server.
> > On client side, it's empty:
> >
> > $ echo $DISPLAY
> I would have expected the client to have a DISPLAY variable set.
> ESPECIALLY if running it form in a GUI terminal emulator.
> > I run ssh in verbose mode (-v):
> Verbose mode shouldn't change the behavior of X11 forwarding. But it
> will give more information.
> > Then xterm also fails to open display, and it says that X11 connection
> > rejected because of wrong authentication.
> Okay. That's sort of what I was expecting.
>
> You can use the 'xhost' command to allow other clients to connect
> bypassing the ~/.Xauthority (?) cooky. E.g.
>
> xhost +192.0.2.1
>
> That should allow 192.0.2.1 to connect to your local X11 display.
>
> N.B. You can remove the IP and just use "+" to allow all IPs to connect
> too.

Thanks. I've run the `xhost +' on server side now:

werner@X10DAi:~$ xhost +
access control disabled, clients can connect from any host


> Use the following command to remove permission:
>
> xhost -
>
> N.B. My understanding is that the xhost permissions are non-persistent.
> > I've enabled the following options on server and client sides:
> That means that OpenSSH is configured to allow X11 forwarding.
>
> As Keith mentioned, the "-Y" option may help.

Now, I connect to the server with the following setting:

$ ssh -Y wer...@192.168.10.100

The testing results:

Xterm works, but Emacs still report the same problem.

HY

hongy...@gmail.com

unread,
Jul 27, 2021, 10:18:59 PM7/27/21
to
On Wednesday, July 28, 2021 at 10:04:46 AM UTC+8, Keith Thompson wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> > On Wednesday, July 28, 2021 at 2:33:54 AM UTC+8, Grant Taylor wrote:
> >> On 7/27/21 7:30 AM, hongy...@gmail.com wrote:
> >> > Any hints for solving this problem?
> >> What is the DISPLAY environment variable set to?
> >
> > On server side:
> >
> > werner@X10DAi:~$ echo $DISPLAY
> > :1
> >
> > On client side, it's empty:
> >
> > $ echo $DISPLAY
> >
> > $
> That seems inconsistent with your original post. You said you got this
> message from emacs:
> Display localhost:10.0 unavailable, simulating -nw
> which strongly implies that $DISPLAY was set to "localhost:10.0", at
> least in your emacs process.
>
> Try `echo $DISPLAY` and `emacs` from the same shell process. If you get
> an empty string from the first (it's more likely that $DISPLAY is not
> set than that it's set to the empty string) and "Display localhost:10.0
> unavailable, simulating -nw" from emacs, then something very strange is
> going on.
>
> What does `env | grep '^DISPLAY='` print?

Sorry for my unclear description to some extent, especially on the network topology used by the testing in question. I restate the network topology below:

The ssh server: 192.168.10.100
The ssh client: 192.168.10.101

But the ssh client in my situation is a virtual machine running within Proxmox VE, so I must ssh into it first for doing the testing discussed here.

If I ssh to the client like the following:

$ ssh wer...@192.168.10.101
$ env | grep '^DISPLAY='
$

If with the following option:

$ ssh -Y wer...@192.168.10.101
$ env | grep '^DISPLAY='
DISPLAY=localhost:10.0

HY

David W. Hodgins

unread,
Jul 27, 2021, 11:49:11 PM7/27/21
to
Got emacs to work in gui mode under ssh.

Try running "ssh -X -Y wer...@192.168.10.101"
then running emacs.

David W. Hodgins

unread,
Jul 27, 2021, 11:49:12 PM7/27/21
to
On Tue, 27 Jul 2021 22:07:16 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> Xterm works, but Emacs still report the same problem.

In that case stop looking at X or ssh settings. It's a problem with emacs, not
the ssh or X setup.

The man page for emacs has a section for running it under X. It's not a program
I use or am familiar with.

If no one else here has an idea, please open a bug report for emacs. Perhaps
it's package maintainer will have an idea.

David W. Hodgins

unread,
Jul 27, 2021, 11:49:12 PM7/27/21
to
On Tue, 27 Jul 2021 22:18:56 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> Sorry for my unclear description to some extent, especially on the network topology used by the testing in question. I restate the network topology below:
>
> The ssh server: 192.168.10.100
> The ssh client: 192.168.10.101
>
> But the ssh client in my situation is a virtual machine running within Proxmox VE, so I must ssh into it first for doing the testing discussed here.
>
> If I ssh to the client like the following:
>
> $ ssh wer...@192.168.10.101
> $ env | grep '^DISPLAY='
> $
>
> If with the following option:
>
> $ ssh -Y wer...@192.168.10.101
> $ env | grep '^DISPLAY='
> DISPLAY=localhost:10.0

One point that is often misunderstood. When discussing X, the server is the one
that's physically connected to the monitor. The gui programs you run on the
system you're connecting to via ssh become clients of the X server running on
the machine you're connecting from.

I partially figure out how to get it working. After connecting via ssh to the
remote system, run "DISPLAY= emacs". It works, but runs emacs in text mode
instead of gui mode.

hongy...@gmail.com

unread,
Jul 28, 2021, 12:12:57 AM7/28/21
to
I tried the above from the server side itself:

$ ssh -XY wer...@192.168.10.100

Then run emacs, but encounter the same message:

$ emacs

hongy...@gmail.com

unread,
Jul 28, 2021, 12:32:31 AM7/28/21
to
I tried with your suggested method:

$ DISPLAY= emacs

But is seems that I still have the same result as before. To be clear, I want to have a pdf preview frame opened in Emacs with pdf-tools, which works smoothly when I locally use it on the machine.

HY

David W. Hodgins

unread,
Jul 28, 2021, 1:21:28 AM7/28/21
to
On Wed, 28 Jul 2021 00:12:54 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> I tried the above from the server side itself:
>
> $ ssh -XY wer...@192.168.10.100
>
> Then run emacs, but encounter the same message:
>
> $ emacs
> Display localhost:10.0 unavailable, simulating -nw

Strange. Try ...
$ ssh -XY wer...@192.168.10.100
$ DISPLAY=:0 emacs

hongy...@gmail.com

unread,
Jul 28, 2021, 1:25:07 AM7/28/21
to
On Wednesday, July 28, 2021 at 1:21:28 PM UTC+8, David W. Hodgins wrote:
> On Wed, 28 Jul 2021 00:12:54 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> > I tried the above from the server side itself:
> >
> > $ ssh -XY wer...@192.168.10.100
> >
> > Then run emacs, but encounter the same message:
> >
> > $ emacs
> > Display localhost:10.0 unavailable, simulating -nw
> Strange. Try ...
> $ ssh -XY wer...@192.168.10.100
> $ DISPLAY=:0 emacs

werner@X10DAi:~$ DISPLAY=:0 emacs
No protocol specified
Display :0 unavailable, simulating -nw

HY

David W. Hodgins

unread,
Jul 28, 2021, 1:51:23 AM7/28/21
to
I'm out of ideas. I know it's working for me, so it's not a Mageia bug, just
something different about that setup. Hopefully someone else here will figure
it out.

hongy...@gmail.com

unread,
Jul 28, 2021, 3:02:38 AM7/28/21
to
On Wednesday, July 28, 2021 at 1:51:23 PM UTC+8, David W. Hodgins wrote:
> On Wed, 28 Jul 2021 01:25:04 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
>
> > On Wednesday, July 28, 2021 at 1:21:28 PM UTC+8, David W. Hodgins wrote:
> >> On Wed, 28 Jul 2021 00:12:54 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> >> > I tried the above from the server side itself:
> >> >
> >> > $ ssh -XY wer...@192.168.10.100
> >> >
> >> > Then run emacs, but encounter the same message:
> >> >
> >> > $ emacs
> >> > Display localhost:10.0 unavailable, simulating -nw
> >> Strange. Try ...
> >> $ ssh -XY wer...@192.168.10.100
> >> $ DISPLAY=:0 emacs
> >
> > werner@X10DAi:~$ DISPLAY=:0 emacs
> > No protocol specified
> > Display :0 unavailable, simulating -nw
> I'm out of ideas. I know it's working for me, so it's not a Mageia bug, just
> something different about that setup. Hopefully someone else here will figure
> it out.

Got it. To be sure, your method is right, but I happened to use an error value of "$DISPLAY". Here, I summarize the successful methods as follows:

Obtain the value of `$DISPLAY' locally on the ssh server:

$ echo $DISPLAY
:1

Then all the following methods will do the trick:

Method 1:

$ ssh -X -f wer...@192.168.10.100 DISPLAY=:1 emacs
or
$ ssh -X -f wer...@192.168.10.100 env DISPLAY=:1 emacs

Method 2:

$ ssh -X wer...@192.168.10.100

Then run any of the following commands:

$ DISPLAY=:1 emacs
$ env DISPLAY=:1 emacs
$ emacs -d :1
$ emacs --display :1

NB.

[1]. I obtain the clues from here: <https://kb.iu.edu/d/acxu>
[2]. X server relevant options supplied by Emacs:

werner@X10DAi:~$ man emacs|grep -A 4 -- '-d '
-d displayname, --display=displayname
Create the Emacs window on the display specified by dis‐
playname. Must be the first option specified in the com‐
mand line.

werner@X10DAi:~$ emacs --help|grep -- '-d '
--display, -d DISPLAY use X server DISPLAY

Regards,
HY

hongy...@gmail.com

unread,
Jul 28, 2021, 3:36:18 AM7/28/21
to
On Wednesday, July 28, 2021 at 3:02:38 PM UTC+8, hongy...@gmail.com wrote:
> On Wednesday, July 28, 2021 at 1:51:23 PM UTC+8, David W. Hodgins wrote:
> > On Wed, 28 Jul 2021 01:25:04 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> >
> > > On Wednesday, July 28, 2021 at 1:21:28 PM UTC+8, David W. Hodgins wrote:
> > >> On Wed, 28 Jul 2021 00:12:54 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> > >> > I tried the above from the server side itself:
> > >> >
> > >> > $ ssh -XY wer...@192.168.10.100
> > >> >
> > >> > Then run emacs, but encounter the same message:
> > >> >
> > >> > $ emacs
> > >> > Display localhost:10.0 unavailable, simulating -nw
> > >> Strange. Try ...
> > >> $ ssh -XY wer...@192.168.10.100
> > >> $ DISPLAY=:0 emacs
> > >
> > > werner@X10DAi:~$ DISPLAY=:0 emacs
> > > No protocol specified
> > > Display :0 unavailable, simulating -nw
> > I'm out of ideas. I know it's working for me, so it's not a Mageia bug, just
> > something different about that setup. Hopefully someone else here will figure
> > it out.
> Got it. To be sure, your method is right, but I happened to use an error value of "$DISPLAY". Here, I summarize the successful methods as follows:
>
> Obtain the value of `$DISPLAY' locally on the ssh server:
>
> $ echo $DISPLAY
> :1

Or use the following method:

$ xdpyinfo | grep -i display
name of display: :1

hongy...@gmail.com

unread,
Jul 28, 2021, 8:45:29 AM7/28/21
to
Another issue: how to obtain the correct value of the above variable from within the ssh client instead of locally logged into the machine?

HY

Keith Thompson

unread,
Jul 28, 2021, 10:24:45 AM7/28/21
to
"hongy...@gmail.com" <hongy...@gmail.com> writes:
[...]
>> Got it. To be sure, your method is right, but I happened to use an
>> error value of "$DISPLAY". Here, I summarize the successful methods
>> as follows:
>>
>> Obtain the value of `$DISPLAY' locally on the ssh server:
>>
>> $ echo $DISPLAY
>> :1
>
> Or use the following method:
>
> $ xdpyinfo | grep -i display
> name of display: :1

That seems pointless. xdpyinfo gets the value to show by looking at
$DISPLAY. (I had suggested running xdpyinfo just to see whether it
succeeds or fails.)

hongy...@gmail.com

unread,
Jul 28, 2021, 10:51:04 PM7/28/21
to
On Wednesday, July 28, 2021 at 10:24:45 PM UTC+8, Keith Thompson wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> [...]
> >> Got it. To be sure, your method is right, but I happened to use an
> >> error value of "$DISPLAY". Here, I summarize the successful methods
> >> as follows:
> >>
> >> Obtain the value of `$DISPLAY' locally on the ssh server:
> >>
> >> $ echo $DISPLAY
> >> :1
> >
> > Or use the following method:
> >
> > $ xdpyinfo | grep -i display
> > name of display: :1
> That seems pointless. xdpyinfo gets the value to show by looking at
> $DISPLAY. (I had suggested running xdpyinfo just to see whether it
> succeeds or fails.)

Then, where does $DISPLAY come from?

HY

Janis Papanagnou

unread,
Jul 28, 2021, 10:56:31 PM7/28/21
to
From the environment. (As the man page also tells you.)

Janis

> HY
>

Keith Thompson

unread,
Jul 29, 2021, 12:50:12 AM7/29/21
to
It's an environment variable, of course. It's set by sshd (if X
forwarding is enabled) and inherited by your shell, or it's set by
whatever invokes your terminal emulator if you launch it on the system
itself, or by anything else that sets it.

emacs displays the message
Display localhost:10.0 unavailable, simulating -nw
if and only if XOpenDisplay("localhost:10.0") returns a null pointer.

Is it correct that running `emacs` displays that error message and
running `xlogo` *from the same shell process* successfully displays a
window with the X logo? (Please verify before answering.) If so, then
something weird is going on. I don't know why xlogo's call to
XOpenDisplay would succeed while emacs's call would fail. If that is
what's happening, try running emacs followed by xlogo, and xlogo
followed by emacs.

I suggest setting PS1 to some unique value so you can be sure you're
running all the commands from the same shell process. (Since you're
ssh'ing from one system to another, it's conceivable that you could
return to another shell without noticing it if the prompt never
changes.)

It's odd that in your original article your $DISPLAY was
"localhost:10.0" and in later followups it's ":1". I haven't followed
all the details.

hongy...@gmail.com

unread,
Jul 29, 2021, 5:05:16 AM7/29/21
to
Thank you for your explanation. I found the following option of sshd_config:

$ man sshd_config |egrep -A4 '^[ ]*X11DisplayOffset$'
X11DisplayOffset
Specifies the first display number available for sshd(8)'s X11 for‐
warding. This prevents sshd from interfering with real X11 servers.
The default is 10.


> Is it correct that running `emacs` displays that error message and
> running `xlogo` *from the same shell process* successfully displays a
> window with the X logo? (Please verify before answering.)

Yes.

> If so, then something weird is going on. I don't know why xlogo's call to
> XOpenDisplay would succeed while emacs's call would fail. If that is
> what's happening, try running emacs followed by xlogo, and xlogo
> followed by emacs.

Same results observed.

> I suggest setting PS1 to some unique value so you can be sure you're
> running all the commands from the same shell process. (Since you're
> ssh'ing from one system to another, it's conceivable that you could
> return to another shell without noticing it if the prompt never
> changes.)

Thank you for your suggestions. I always notice the host name part of the prompt string, which is different from each other for the test case discussed here, when I'm on different hosts.

> It's odd that in your original article your $DISPLAY was
> "localhost:10.0" and in later followups it's ":1". I haven't followed
> all the details.

If I logged in to the ssh server from the noVNC console of vitrual machine running in pve, the $DISPLAY value will be
"localhost:10.0"; if I locally check the variable's value on the ssh server, it will be ":1".

HY

Peter van Hooft

unread,
Jul 29, 2021, 5:30:06 AM7/29/21
to
On 2021-07-29, Keith Thompson <Keith.S.T...@gmail.com> wrote:
>
> I suggest setting PS1 to some unique value so you can be sure you're
> running all the commands from the same shell process. (Since you're
> ssh'ing from one system to another, it's conceivable that you could
> return to another shell without noticing it if the prompt never
> changes.)

*this*

>
> It's odd that in your original article your $DISPLAY was
> "localhost:10.0" and in later followups it's ":1". I haven't followed
> all the details.
>

A common pitfall is that xauth hasn't been installed on the ssh server,
so you may want to check that (which xauth).

Peter

William Unruh

unread,
Jul 29, 2021, 10:01:11 AM7/29/21
to
On 2021-07-29, hongy...@gmail.com <hongy...@gmail.com> wrote:
....
>
>> It's odd that in your original article your $DISPLAY was
>> "localhost:10.0" and in later followups it's ":1". I haven't followed
>> all the details.
>
> If I logged in to the ssh server from the noVNC console of vitrual machine running in pve, the $DISPLAY value will be
> "localhost:10.0"; if I locally check the variable's value on the ssh server, it will be ":1".

Not sure what you are saying but that sounds as it should be. The
display on the machine itself should be :1 (or whatever you logged in
as) while the display into the ssh from a remote machine should be :10.
Different X displays, different numbers. Imagine it is not a virtual
machine but is a different physical machine. One is "put the X stuff
onto the local screen" and the other one is "put the X stuff onto the
screen of the system which sshed into me"
That both screens are the actually the same physical piece of hardware is
irrelevant.
>
> HY

hongy...@gmail.com

unread,
Jul 29, 2021, 8:50:17 PM7/29/21
to
On Thursday, July 29, 2021 at 5:30:06 PM UTC+8, Peter van Hooft wrote:
> On 2021-07-29, Keith Thompson <Keith.S.T...@gmail.com> wrote:
> >
> > I suggest setting PS1 to some unique value so you can be sure you're
> > running all the commands from the same shell process. (Since you're
> > ssh'ing from one system to another, it's conceivable that you could
> > return to another shell without noticing it if the prompt never
> > changes.)
> *this*

What's your meaning by saying the above word?

> >
> > It's odd that in your original article your $DISPLAY was
> > "localhost:10.0" and in later followups it's ":1". I haven't followed
> > all the details.
> >
> A common pitfall is that xauth hasn't been installed on the ssh server,
> so you may want to check that (which xauth).

Yes, see below:

werner@X10DAi:~$ which xauth
/usr/bin/xauth

HY

Grant Taylor

unread,
Jul 29, 2021, 9:00:59 PM7/29/21
to
On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
> Xterm works, but Emacs still report the same problem.

I'm starting to question the "emacs" command.

Please do a "which emacs" and then "file /path/to/emacs" to see what
type of file emacs is.

I'm wondering if it's by chance a script that's artificially changing /
overriding the DISPLAY environment variable.

It might not be, but it's something simple to check and it quite likely
would keep it from working if such shenanigans were afoot.

hongy...@gmail.com

unread,
Jul 29, 2021, 9:04:09 PM7/29/21
to
Now, I've set the following on the ssh server:

$ grep -i ^x11 /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
$ sudo systemctl restart sshd

Then I ssh on to it:
$ ssh wer...@192.168.10.100
$ echo $DISPLAY

$

As you can see, the `$DISPLAY' is still empty. Why?

HY

Keith Thompson

unread,
Jul 29, 2021, 10:50:56 PM7/29/21
to
Grant Taylor <gta...@tnetconsulting.net> writes:
> On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
>> Xterm works, but Emacs still report the same problem.
>
> I'm starting to question the "emacs" command.
>
> Please do a "which emacs" and then "file /path/to/emacs" to see what
> type of file emacs is.

I suggest "type emacs" rather than "which emacs".

"which" is an external command, which means it doesn't know about shell
functions or aliases. "type" is a shell builtin that tells you what
typing "emacs" will actually do.

For bash, "help type" shows more information about the capabilities of
the "type" command.

> I'm wondering if it's by chance a script that's artificially changing
> / overriding the DISPLAY environment variable.
>
> It might not be, but it's something simple to check and it quite
> likely would keep it from working if such shenanigans were afoot.

--

Keith Thompson

unread,
Jul 29, 2021, 11:02:10 PM7/29/21
to
We can't tell whether the ssh command silently failed and left you in
the same shell, or whether it was successful and the echo command was
run on the target system. The former is unlikely, but this is why I
requested that you set the prompt to some unique value that shows where
you are. I suggest:

PS1="\u@\h pid=$$ \!\$ "

> $
>
> As you can see, the `$DISPLAY' is still empty. Why?

What is $DISPLAY on the initial system, before you run ssh?

What happens when you replace "ssh" by "ssh -X" or "ssh -Y"?

X11 forwarding has to be enabled by both the client and the server.

Is $DISPLAY unset or empty? The behavior should be similar either way,
but it could be helpful to know. Consider `set -o nounset`, at least
temporarily, so you get an error message referring to an unset variable.

$DISPLAY being either empty or unset is inconsistent with the symptom
you reported originally, emacs complaining about "localhost:10.0".
It's not at all clear what significance the information you're giving us
now has to your original problem.

hongy...@gmail.com

unread,
Jul 29, 2021, 11:45:13 PM7/29/21
to
On Friday, July 30, 2021 at 9:00:59 AM UTC+8, Grant Taylor wrote:
> On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
> > Xterm works, but Emacs still report the same problem.
> I'm starting to question the "emacs" command.
>
> Please do a "which emacs" and then "file /path/to/emacs" to see what
> type of file emacs is.
>
> I'm wondering if it's by chance a script that's artificially changing /
> overriding the DISPLAY environment variable.

I use a self-written wrapper script to start Emacs, but I really haven't overridden the DISPLAY environment variable in the script. See the following for more detailed info:

$ which emacs
/home/werner/.local/bin/emacs

$ which emacs |xargs egrep '^[^#]'| grep -v '^[ ]*#'
script_name_sh=$HOME/.local/libexec/script_name.sh
source $script_name_sh ${BASH_SOURCE[0]}

EMACS=/usr/local/bin/emacs
if [ -e $EMACS ]; then
proxychains-ng-socks5 $EMACS "$@"
fi

HY

hongy...@gmail.com

unread,
Jul 29, 2021, 11:49:43 PM7/29/21
to
On Friday, July 30, 2021 at 10:50:56 AM UTC+8, Keith Thompson wrote:
> Grant Taylor <gta...@tnetconsulting.net> writes:
> > On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
> >> Xterm works, but Emacs still report the same problem.
> >
> > I'm starting to question the "emacs" command.
> >
> > Please do a "which emacs" and then "file /path/to/emacs" to see what
> > type of file emacs is.
> I suggest "type emacs" rather than "which emacs".

$ type emacs
emacs is hashed (/home/werner/.local/bin/emacs)

$ type -a emacs
emacs is /home/werner/.local/bin/emacs
emacs is /usr/local/bin/emacs
emacs is /usr/bin/emacs
emacs is /bin/emacs

So, the first entry will be picked by shell, and see the following for more detailed info about the corresponding script:

$ egrep '^[^#]' /home/werner/.local/bin/emacs | grep -v '^[ ]*#'
script_name_sh=$HOME/.local/libexec/script_name.sh
source $script_name_sh ${BASH_SOURCE[0]}

EMACS=/usr/local/bin/emacs
if [ -e $EMACS ]; then
proxychains-ng-socks5 $EMACS "$@"
fi


Grant Taylor

unread,
Jul 30, 2021, 12:06:09 AM7/30/21
to
On 7/29/21 9:49 PM, hongy...@gmail.com wrote:
> proxychains-ng-socks5 $EMACS "$@"

Why are you running emacs via proxychains?

That's almost definitely going to mess with it's ability to connect to
an X11 server, wherever it is, unless said proxy can communicate with
said X11 server.

Try running /usr/local/bin/emacs and seeing if that works.

Grant Taylor

unread,
Jul 30, 2021, 12:07:25 AM7/30/21
to
On 7/29/21 9:45 PM, hongy...@gmail.com wrote:
> I use a self-written wrapper script to start Emacs, but I really
> haven't overridden the DISPLAY environment variable in the script. See
> the following for more detailed info:

No, you're not altering the DISPLAY environment variable. But you are
quite likely intercepting any and all network connection attempts and
routing them through the configured proxy, including attempts to connect
to the value of $DISPLAY.

Spiros Bousbouras

unread,
Jul 30, 2021, 12:15:34 AM7/30/21
to
On Thu, 29 Jul 2021 17:50:14 -0700 (PDT)
"hongy...@gmail.com" <hongy...@gmail.com> wrote:
> On Thursday, July 29, 2021 at 5:30:06 PM UTC+8, Peter van Hooft wrote:
> > On 2021-07-29, Keith Thompson <Keith.S.T...@gmail.com> wrote:
> > >
> > > I suggest setting PS1 to some unique value so you can be sure you're
> > > running all the commands from the same shell process. (Since you're
> > > ssh'ing from one system to another, it's conceivable that you could
> > > return to another shell without noticing it if the prompt never
> > > changes.)
> > *this*
>
> What's your meaning by saying the above word?

It means he emphatically agrees with Keith Thompson.

hongy...@gmail.com

unread,
Jul 30, 2021, 12:17:19 AM7/30/21
to
Now, on the ssh server, I append the following lines at the bottom of my ~/.bashrc file:

set -o nounset
export PS1="\u@\h pid=$$ \!\$ "

> > $
> >
> > As you can see, the `$DISPLAY' is still empty. Why?
> What is $DISPLAY on the initial system, before you run ssh?

werner@X10DAi pid=1948000 501$ echo $DISPLAY
:1


> What happens when you replace "ssh" by "ssh -X" or "ssh -Y"?

If I don't log in to the ssh server from the pve noVNC console:

$ ssh -X wer...@192.168.10.100
werner@X10DAi pid=2452674 501$ echo $DISPLAY

werner@X10DAi pid=2452674 495$

> X11 forwarding has to be enabled by both the client and the server.
>
> Is $DISPLAY unset or empty? The behavior should be similar either way,
> but it could be helpful to know. Consider `set -o nounset`, at least
> temporarily, so you get an error message referring to an unset variable.
>
> $DISPLAY being either empty or unset is inconsistent with the symptom
> you reported originally, emacs complaining about "localhost:10.0".

If I log in to the ssh server from the pve noVNC console:

$ ssh -X wer...@192.168.10.100
werner@X10DAi pid=1622407 501$ echo $DISPLAY
localhost:10.0
werner@X10DAi pid=1622407 496$

hongy...@gmail.com

unread,
Jul 30, 2021, 12:24:55 AM7/30/21
to
Wonderful analysis, I confirmed the above assertion, as described below:

After I logged in to the ssh server, if the `xlogo' can run correctly, the `/usr/local/bin/emacs', i.e., without using the wrapper script, hence bypassing the proxychains proxy set there, will work with X smoothly.

HY

Spiros Bousbouras

unread,
Jul 30, 2021, 12:25:34 AM7/30/21
to
Unless the comments in the script have some private information you don't want
the world to see or are very long , it would have been better to also show
the comments because they might give some valuable clue. In any case , instead
of
egrep '^[^#]' /home/werner/.local/bin/emacs | grep -v '^[ ]*#'

using
grep -v '^ *#' /home/werner/.local/bin/emacs

does the same job.

Perhaps $HOME/.local/libexec/script_name.sh does something with the DISPLAY
variable. I suggest modifying your script as follows

echo "Point A : the value of DISPLAY is =$DISPLAY="
script_name_sh=$HOME/.local/libexec/script_name.sh
source $script_name_sh ${BASH_SOURCE[0]}
echo "Point B : the value of DISPLAY is =$DISPLAY="
[ ... Rest the same ...]

I also second the advice to try running emacs directly.

Keith Thompson

unread,
Jul 30, 2021, 12:40:18 AM7/30/21
to
"hongy...@gmail.com" <hongy...@gmail.com> writes:
> On Friday, July 30, 2021 at 9:00:59 AM UTC+8, Grant Taylor wrote:
>> On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
>> > Xterm works, but Emacs still report the same problem.
>> I'm starting to question the "emacs" command.
>>
>> Please do a "which emacs" and then "file /path/to/emacs" to see what
>> type of file emacs is.
>>
>> I'm wondering if it's by chance a script that's artificially changing /
>> overriding the DISPLAY environment variable.
>
> I use a self-written wrapper script to start Emacs, but I really
> haven't overridden the DISPLAY environment variable in the script. See
> the following for more detailed info:

Then the obvious next step is to try the same thing, but running
/usr/bin/emacs directly rather than your wrapper script.

> $ which emacs
> /home/werner/.local/bin/emacs
>
> $ which emacs |xargs egrep '^[^#]'| grep -v '^[ ]*#'
> script_name_sh=$HOME/.local/libexec/script_name.sh
> source $script_name_sh ${BASH_SOURCE[0]}
>
> EMACS=/usr/local/bin/emacs
> if [ -e $EMACS ]; then
> proxychains-ng-socks5 $EMACS "$@"
> fi

Frankly, it should already have occurred to you to try invoking
the emacs executable directly. It's an added layer, and you need
to strip away any such layers while trying to figure out what's causing
the problem. Do the simplest set of steps that reproduces the problem.

Even more obvious than bypassing your wrapper script: Telling us that
you're using one. You should have mentioned that in your original post.
Don't withhold information like that, and don't make us drag it out of
you.

hongy...@gmail.com

unread,
Jul 30, 2021, 12:40:51 AM7/30/21
to
No difference, but thank you for the more concise grep command:
$ grep -v '^ *#' /home/werner/.local/bin/emacs
script_name_sh=$HOME/.local/libexec/script_name.sh
source $script_name_sh ${BASH_SOURCE[0]}

EMACS=/usr/local/bin/emacs
if [ -e $EMACS ]; then
proxychains-ng-socks5 $EMACS "$@"
fi

$

> does the same job.
>
> Perhaps $HOME/.local/libexec/script_name.sh does something with the DISPLAY
> variable. I suggest modifying your script as follows
>
> echo "Point A : the value of DISPLAY is =$DISPLAY="
> script_name_sh=$HOME/.local/libexec/script_name.sh
> source $script_name_sh ${BASH_SOURCE[0]}
> echo "Point B : the value of DISPLAY is =$DISPLAY="
> [ ... Rest the same ...]


werner@X10DAi pid=2452674 483$ emacs
Point A : the value of DISPLAY is ==
Point B : the value of DISPLAY is ==
[...]

Keith Thompson

unread,
Jul 30, 2021, 12:41:55 AM7/30/21
to
That's assuming that /usr/local/bin/emacs is an executable.

You have /usr/bin/emacs, /bin/emacs, and /usr/local/bin/emacs in your
path. I'm guessing /usr/bin/emacs and /bin/emacs are the same -- but
check that. Try all three.

hongy...@gmail.com

unread,
Jul 30, 2021, 12:49:14 AM7/30/21
to
On Friday, July 30, 2021 at 12:41:55 PM UTC+8, Keith Thompson wrote:
> Grant Taylor <gta...@tnetconsulting.net> writes:
> > On 7/29/21 9:49 PM, hongy...@gmail.com wrote:
> >> proxychains-ng-socks5 $EMACS "$@"
> >
> > Why are you running emacs via proxychains?
> >
> > That's almost definitely going to mess with it's ability to connect to
> > an X11 server, wherever it is, unless said proxy can communicate with
> > said X11 server.
> >
> > Try running /usr/local/bin/emacs and seeing if that works.
> That's assuming that /usr/local/bin/emacs is an executable.

This is the self-compiled git master version.

> You have /usr/bin/emacs, /bin/emacs, and /usr/local/bin/emacs in your
> path. I'm guessing /usr/bin/emacs and /bin/emacs are the same -- but
> check that. Try all three.

These are the system versions, they are equivalent:

$ realpath -e /usr/bin/emacs
/usr/bin/emacs-nox

$ realpath -e /bin/emacs
/usr/bin/emacs-nox

HY

hongy...@gmail.com

unread,
Jul 30, 2021, 12:52:58 AM7/30/21
to
I didn’t realize this until I got the relevant tips here.

> Don't withhold information like that, and don't make us drag it out of
> you.

TBF, I really omit the fact the X11 communication is also effected by the proxy settings by proxychains.

HY

hongy...@gmail.com

unread,
Jul 30, 2021, 1:03:07 AM7/30/21
to
On Friday, July 30, 2021 at 12:06:09 PM UTC+8, Grant Taylor wrote:
> On 7/29/21 9:49 PM, hongy...@gmail.com wrote:
> > proxychains-ng-socks5 $EMACS "$@"
>
> Why are you running emacs via proxychains?

As far as this problem is concerned, I am in a dilemma: Emacs itself don't support socks5 very well, and I want to install packages from melpa and github repos, which will need socks5 proxy for working smoothly at my location.

> That's almost definitely going to mess with it's ability to connect to
> an X11 server, wherever it is, unless said proxy can communicate with
> said X11 server.

I really have taken it for granted that X11 protocol should work seamlessly with TCP/IP stack and all standard proxy protocols built on it.

> Try running /usr/local/bin/emacs and seeing if that works.

This works, as I've tested later in another thread of this issue.

HY

William Unruh

unread,
Jul 30, 2021, 1:10:23 AM7/30/21
to
On 2021-07-30, hongy...@gmail.com <hongy...@gmail.com> wrote:
> On Friday, July 30, 2021 at 9:00:59 AM UTC+8, Grant Taylor wrote:
>> On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
>> > Xterm works, but Emacs still report the same problem.
>> I'm starting to question the "emacs" command.
>>
>> Please do a "which emacs" and then "file /path/to/emacs" to see what
>> type of file emacs is.
>>
>> I'm wondering if it's by chance a script that's artificially changing /
>> overriding the DISPLAY environment variable.
>

Why the *&^&(* don't you just run
/bin/emacs
and see if that works. Or are you afraid that it will work and you will
not have anything to complian about?


> I use a self-written wrapper script to start Emacs, but I really haven't overridden the DISPLAY environment variable in the script. See the following for more detailed info:

So find out whether you self written script is a piece of junk and run
/bin/emacs directly to see what happens.

hongy...@gmail.com

unread,
Jul 30, 2021, 1:22:17 AM7/30/21
to
On Friday, July 30, 2021 at 1:10:23 PM UTC+8, William Unruh wrote:
> On 2021-07-30, hongy...@gmail.com <hongy...@gmail.com> wrote:
> > On Friday, July 30, 2021 at 9:00:59 AM UTC+8, Grant Taylor wrote:
> >> On 7/27/21 8:07 PM, hongy...@gmail.com wrote:
> >> > Xterm works, but Emacs still report the same problem.
> >> I'm starting to question the "emacs" command.
> >>
> >> Please do a "which emacs" and then "file /path/to/emacs" to see what
> >> type of file emacs is.
> >>
> >> I'm wondering if it's by chance a script that's artificially changing /
> >> overriding the DISPLAY environment variable.
> >
> Why the *&^&(*

What's the meaning?

> don't you just run
> /bin/emacs
> and see if that works. Or are you afraid that it will work and you will
> not have anything to complian about?
> > I use a self-written wrapper script to start Emacs, but I really haven't overridden the DISPLAY environment variable in the script. See the following for more detailed info:
> So find out whether you self written script is a piece of junk and run
> /bin/emacs directly to see what happens.

It's a nox version:

Janis Papanagnou

unread,
Jul 30, 2021, 5:09:08 AM7/30/21
to
On 30.07.2021 06:41, Keith Thompson wrote:
> Grant Taylor <gta...@tnetconsulting.net> writes:
>> On 7/29/21 9:49 PM, hongy...@gmail.com wrote:
>>> proxychains-ng-socks5 $EMACS "$@"
>>
>> Why are you running emacs via proxychains?
>>
>> That's almost definitely going to mess with it's ability to connect to
>> an X11 server, wherever it is, unless said proxy can communicate with
>> said X11 server.
>>
>> Try running /usr/local/bin/emacs and seeing if that works.
>
> That's assuming that /usr/local/bin/emacs is an executable.

It was listed [as such] in the type -a output. Would it be there if
it's not executable? (Rhetorical question.)

Janis

Janis Papanagnou

unread,
Jul 30, 2021, 5:31:32 AM7/30/21
to
On 30.07.2021 07:10, William Unruh wrote:
>>
>
> Why the *&^&(* don't you just run
> /bin/emacs
> and see if that works. Or are you afraid that it will work and you will
> not have anything to complian about?

LOL. I guess it fits with another recent post where someone changed
- because of his personal mental conception how shell scripts should
work - a *running* script or command and was wondering why it doesn't
work any more in his changed form.

But it's not untypical that folks wrap commands to "get things done",
forget about that, and when the use case changes or gets extended
they are wondering about the tools not working any more as expected
or at all.


WRT H's question what "*&^&(*" means; actually the same as "!$&%/*"
(some approximate the meaning with "f***", which is considered more
offensive, though, or the less offensive "h***").

Janis

>
>
>> I use a self-written wrapper script to start Emacs, but I really haven't overridden the DISPLAY environment variable in the script. See the following for more detailed info:
>
> So find out whether you self written script is a piece of junk and run
> /bin/emacs directly to see what happens.
>
>>[...]


Dan Espen

unread,
Jul 30, 2021, 8:02:56 AM7/30/21
to
The executable "emacs-nox" is a version of Emacs without X11 support.

--
Dan Espen

Keith Thompson

unread,
Jul 30, 2021, 2:20:28 PM7/30/21
to
Janis Papanagnou <janis_pa...@hotmail.com> writes:
> On 30.07.2021 06:41, Keith Thompson wrote:
[...]
>> That's assuming that /usr/local/bin/emacs is an executable.
>
> It was listed [as such] in the type -a output. Would it be there if
> it's not executable? (Rhetorical question.)

Sorry, I meant *binary* executable.

My thought was that the word "executable" when used as a noun refers to
binary executable file, not a script, but I wasn't sufficiently clear.

Grant Taylor

unread,
Jul 31, 2021, 1:28:51 PM7/31/21
to
On 7/30/21 12:20 PM, Keith Thompson wrote:
> My thought was that the word "executable" when used as a noun refers to
> binary executable file, not a script, but I wasn't sufficiently clear.

You're entitled to your own opinion of what "executable" means.

But to me, an "executable" is something that you are able to execute.
And seeing as how you are able to execute binaries /and/ scripts, I
don't see why scripts would be excluded from "executables".

I tend to say "binary" and "script" when I want to differentiate between
the two. Possibly prefixing "executable " to each to differentiate
between a library when is a binary which tends to not directly executable.

Grant Taylor

unread,
Jul 31, 2021, 1:35:17 PM7/31/21
to
On 7/29/21 11:03 PM, hongy...@gmail.com wrote:
> As far as this problem is concerned, I am in a dilemma: Emacs itself
> don't support socks5 very well, and I want to install packages from
> melpa and github repos, which will need socks5 proxy for working
> smoothly at my location.

I read that as you need access to things in melpa / github repos that
provide SOCKS(5) interface. I also read that as emacs doesn't
(sufficiently for your needs) support SOCKS(5). Thus you need
/something/ to bridge the communications gap.

A proxifyer / socksifyer is probably the first choice. But it's not the
only choice.

Consider setting something up as a proxy (I dislike using that term when
differentiating from SOCKS) of sorts. E.g. something that has normal
communications that emacs can support and gateways through SOCKS(5) to
the target you need.

socat immediately comes to mind as providing the ability to listen on an
IP & port for local connections and translating them to the proper
SOCKS(5) call to the SOCKS(5) backend.

> I really have taken it for granted that X11 protocol should work
> seamlessly with TCP/IP stack and all standard proxy protocols built
> on it.

That's probably a safe assumption for most cases. /However/ proxifyers
/ socksifyers work by leveraging LD_PRELOAD to replace the usual
networking sys calls with version that translate to the given proxy
protocol; SOCKS(5) / HTTP / etc. Thus when you use a proxifyer /
sockisfyer for a typical X11 client, you end up altering, if not
breaking, the usual network path.

> This works, as I've tested later in another thread of this issue.

*nod*

So the problem definitely is not with your X11 configuration, but how
you're trying to use it.

Grant Taylor

unread,
Jul 31, 2021, 1:51:15 PM7/31/21
to
On 7/31/21 11:35 AM, Grant Taylor wrote:
> socat immediately comes to mind as providing the ability to listen on an
> IP & port for local connections and translating them to the proper
> SOCKS(5) call to the SOCKS(5) backend.

Another option would be to make sure that the SOCKS(5) proxy can
communicate with your local X11 server.

An external SOCKS(5) proxy will likely have quite a difficult time
communicating with your local X11 server.

You could run a local SOCKS(5) proxy which can conditionally reach your
local X11 server /and/ *chain* to the external SOCKS(5) server you need
to use to access the repos. Think of this as a SOCKS(5) level router
that can pick different routes; local vs chained external SOCKS(5)
proxy, depending on the desired destination.

This is effectively augmenting the communications path that your
existing proxychains-ng-socks5 is using. ;-)

Learn about the problem, understand the problem ~> box, and then think
outside of said box. }:-)

Aside: DANTE has been my go-to SOCKS(5) proxy server for many things.
If DANTE can't provide what I need, I usually turn to parts of BadVPN
and more trickery. Trickery like adding a normal (IP) route via a
tunnel that goes into tun2socks. Tun2socks will then socksify the
traffic it receives from the tunnel interface and send it to the
configured SOCKS server. Thus you can rely on traditional routing to
decide if traffic should go through the SOCKS server or not. }:-D

Kenny McCormack

unread,
Jul 31, 2021, 8:28:54 PM7/31/21
to
In article <se41c8$oeo$1...@tncsrv09.home.tnetconsulting.net>,
Grant Taylor <gta...@tnetconsulting.net> wrote:
>On 7/30/21 12:20 PM, Keith Thompson wrote:
>> My thought was that the word "executable" when used as a noun refers to
>> binary executable file, not a script, but I wasn't sufficiently clear.
>
>You're entitled to your own opinion of what "executable" means.

Leader Keith *is* the standard.

>But to me, an "executable" is something that you are able to execute.
>And seeing as how you are able to execute binaries /and/ scripts, I
>don't see why scripts would be excluded from "executables".

In a sense, what we call binary executables are, in fact, scripts that are
interpreted by an interpreter called "ld.so". In a sense, the only pure
executable is the kernel.

Now, the above can be seen as nitpicking, but I think what Keith was
actually going for was the idea that the emacs binary executable was
probably put together by trusted people and can be assumed to be correct,
whereas any shell scripts that exist as "wrappers" around the binary
executable were probably written by amateurs like you and me (and HY) and
are, thus, suspect.

We all know that if there are errors in the chain (and, it seems, in this
case, there are), they are more likely to be in the shell script wrappers
rather than in the emacs binary itself.

--
The last time a Republican cared about you, you were a fetus.

William Unruh

unread,
Jul 31, 2021, 9:54:30 PM7/31/21
to
On 2021-08-01, Kenny McCormack <gaz...@shell.xmission.com> wrote:
> In article <se41c8$oeo$1...@tncsrv09.home.tnetconsulting.net>,
> Grant Taylor <gta...@tnetconsulting.net> wrote:
>>On 7/30/21 12:20 PM, Keith Thompson wrote:
>>> My thought was that the word "executable" when used as a noun refers to
>>> binary executable file, not a script, but I wasn't sufficiently clear.
>>
>>You're entitled to your own opinion of what "executable" means.
>
> Leader Keith *is* the standard.
>
>>But to me, an "executable" is something that you are able to execute.
>>And seeing as how you are able to execute binaries /and/ scripts, I
>>don't see why scripts would be excluded from "executables".
>
> In a sense, what we call binary executables are, in fact, scripts that are
> interpreted by an interpreter called "ld.so". In a sense, the only pure
> executable is the kernel.

WEll, hardly. ld.so may well load the executable into memory, but then
it hands the code over to be run (directly transfered to) the cpu. It
speaks the language of the CPU, not some other language that then needs
to be interpreted. A script on the other hand, loaded directly into the
CPU would simply produce may kinds of faults. It needs a number of
layers of translation before the CPU can do anything with it.

hongy...@gmail.com

unread,
Jul 31, 2021, 10:29:44 PM7/31/21
to
On Sunday, August 1, 2021 at 1:35:17 AM UTC+8, Grant Taylor wrote:
> On 7/29/21 11:03 PM, hongy...@gmail.com wrote:
> > As far as this problem is concerned, I am in a dilemma: Emacs itself
> > don't support socks5 very well, and I want to install packages from
> > melpa and github repos, which will need socks5 proxy for working
> > smoothly at my location.
> I read that as you need access to things in melpa / github repos that
> provide SOCKS(5) interface. I also read that as emacs doesn't
> (sufficiently for your needs) support SOCKS(5). Thus you need
> /something/ to bridge the communications gap.
>
> A proxifyer / socksifyer is probably the first choice. But it's not the
> only choice.

This method is generally simple to use and has many user-friendly configuration options.

> Consider setting something up as a proxy (I dislike using that term when
> differentiating from SOCKS) of sorts. E.g. something that has normal
> communications that emacs can support and gateways through SOCKS(5) to
> the target you need.
>
> socat immediately comes to mind as providing the ability to listen on an
> IP & port for local connections and translating them to the proper
> SOCKS(5) call to the SOCKS(5) backend.

To be frank, for the problem discussed here, I still can't figure out an equivalent implementation with socat like tools.


> > I really have taken it for granted that X11 protocol should work
> > seamlessly with TCP/IP stack and all standard proxy protocols built
> > on it.
> That's probably a safe assumption for most cases. /However/ proxifyers
> / socksifyers work by leveraging LD_PRELOAD to replace the usual
> networking sys calls with version that translate to the given proxy
> protocol; SOCKS(5) / HTTP / etc. Thus when you use a proxifyer /
> sockisfyer for a typical X11 client, you end up altering, if not
> breaking, the usual network path.

Thank you for your in-depth analysis.

Grant Taylor

unread,
Aug 1, 2021, 7:53:21 PM8/1/21
to
On 7/31/21 8:29 PM, hongy...@gmail.com wrote:
> This method is generally simple to use and has many user-friendly
> configuration options.

Yep. When it works, it usually works well. When it doesn't ... well
that's a different story.

> To be frank, for the problem discussed here, I still can't figure
> out an equivalent implementation with socat like tools.

Based on a 30 second search, having done this in the past, something
like the following seems to be close to what you want.

socat TCP4-LISTEN:$LOCAL_PORT,fork
SOCKS5:$SOCKS_SERVER:$REMOTE_IP:$REMOTE_PORT,socksport=$SOCKS_PORT

It will listen on $LOCAL_PORT and send connections to it to $REMOTE_PORT
on $REMOTE_IP via $SOCKS_PORT on $SOCKS_SERVER.

The idea being have as many of these listeners as you need for your
emacs client to connect to where it needs to /without/ a proxifyer.
That way emacs can connect to the local X11 server /and/ connect to the
port / IP that socat is providing.

> Thank you for your in-depth analysis.

You're welcome.

hongy...@gmail.com

unread,
Aug 1, 2021, 9:08:20 PM8/1/21
to
On Monday, August 2, 2021 at 7:53:21 AM UTC+8, Grant Taylor wrote:
> On 7/31/21 8:29 PM, hongy...@gmail.com wrote:
> > This method is generally simple to use and has many user-friendly
> > configuration options.
> Yep. When it works, it usually works well. When it doesn't ... well
> that's a different story.
> > To be frank, for the problem discussed here, I still can't figure
> > out an equivalent implementation with socat like tools.
> Based on a 30 second search, having done this in the past, something
> like the following seems to be close to what you want.
>
> socat TCP4-LISTEN:$LOCAL_PORT,fork
> SOCKS5:$SOCKS_SERVER:$REMOTE_IP:$REMOTE_PORT,socksport=$SOCKS_PORT
>
> It will listen on $LOCAL_PORT and send connections to it to $REMOTE_PORT
> on $REMOTE_IP via $SOCKS_PORT on $SOCKS_SERVER.

Some relevant questions:

1. For my case, I don't have a specific $REMOTE_IP:$REMOTE_PORT, instead, I want to proxy most non-local Internet access.

2. How to let Emacs communicates with the $LOCAL_PORT, i.e., the socat's listening port?

Grant Taylor

unread,
Aug 2, 2021, 12:48:09 AM8/2/21
to
On 8/1/21 7:08 PM, hongy...@gmail.com wrote:
> Some relevant questions:
>
> 1. For my case, I don't have a specific $REMOTE_IP:$REMOTE_PORT,
> instead, I want to proxy most non-local Internet access.

Then you are going to need to get in and very personal with the traffic
to find out how you can route various things.

Sometimes you can use what I call SSH local port forwarding ... Anycast
Style [1] for one or more ports on one or more IPs.

Sometimes you need to configure traditional proxy support via
environment variables; e.g. http_proxy, et al.

Sometimes you need to get really creative.

You will need to really understand your desired traffic flow and combine
various techniques to do what you want.

> 2. How to let Emacs communicates with the $LOCAL_PORT, i.e., the
> socat's listening port?

Don't run it through a proxifyer. emacs should try to connect using the
non-hijacked system calls.

[1] SSH local port forwarding ... Anycast Style
-
https://dotfiles.tnetconsulting.net/articles/2014/0303/ssh-local-port-forwarding-anycast-style.html

hongy...@gmail.com

unread,
Aug 2, 2021, 10:10:18 AM8/2/21
to
On Monday, August 2, 2021 at 12:48:09 PM UTC+8, Grant Taylor wrote:
> On 8/1/21 7:08 PM, hongy...@gmail.com wrote:
> > Some relevant questions:
> >
> > 1. For my case, I don't have a specific $REMOTE_IP:$REMOTE_PORT,
> > instead, I want to proxy most non-local Internet access.
> Then you are going to need to get in and very personal with the traffic
> to find out how you can route various things.
>
> Sometimes you can use what I call SSH local port forwarding ... Anycast
> Style [1] for one or more ports on one or more IPs.
>
> Sometimes you need to configure traditional proxy support via
> environment variables; e.g. http_proxy, et al.
>
> Sometimes you need to get really creative.
>
> You will need to really understand your desired traffic flow and combine
> various techniques to do what you want.
> > 2. How to let Emacs communicates with the $LOCAL_PORT, i.e., the
> > socat's listening port?
> Don't run it through a proxifyer. emacs should try to connect using the
> non-hijacked system calls.

Why? As you can see, except the problem discussed here, I still can work with Emacs smoothly with a proxifyer like proxychins-ng. Another thing to note, for the problem disscussed here, the more elegant solution is to use the proxychins-ng's localnet directive, i.e., set the following in its conf file:

localnet 127.0.0.0/255.0.0.0
localnet 10.0.0.0/255.0.0.0
localnet 172.16.0.0/255.240.0.0
localnet 192.168.0.0/255.255.0.0

See <https://github.com/rofl0r/proxychains-ng/issues/388#issuecomment-889968946> for more detailed info.
Thank you for telling me this trick, but it looks rather cumbersome.

HY

Grant Taylor

unread,
Aug 2, 2021, 11:50:57 AM8/2/21
to
On 8/2/21 8:10 AM, hongy...@gmail.com wrote:
> Why? As you can see, except the problem discussed here, I still can
> work with Emacs smoothly with a proxifyer like proxychins-ng.
> Another thing to note, for the problem disscussed here, the more
> elegant solution is to use the proxychins-ng's localnet directive,
> i.e., set the following in its conf file:

I agree, using proxychains-ng's localnet feature is probably better in
this situation. I've never used proxychains-ng so I wasn't aware of it.

The proxifiers that I've used in the past didn't have such capability.

You need to know your tools, what they are capable of, and how to use
that capability.

> Thank you for telling me this trick, but it looks rather cumbersome.

It's non-trivial and was written for accessing things like remote iLO /
RSA / IMM / DRACs buried deep in networks that had no normal routing to
them.

Bind the target IP locally, use SSH remote port forwarding to bind the
port(s) in question, connect to the web interface via forwarded port,
let the (at the time) Java / ActiveX code connect to what it thought was
the remote IP / ports locally, ssh forward things, and profit. It is a
non-trivial solution to a complex problem. I found that many such
clients weren't conducive to changing IPs (to use localhost with
traditional port forwarding) / hostname(s) / ports. There were LOTS of
hard coded assumptions. This usually involved at least two discrete
technologies; HTTP and Java or ActiveX, and frequently involved SSL
certificates. So, making the expected IP & port available locally was
by far the easiest solution.

hongy...@gmail.com

unread,
Aug 2, 2021, 10:02:46 PM8/2/21
to
On Monday, August 2, 2021 at 11:50:57 PM UTC+8, Grant Taylor wrote:
> On 8/2/21 8:10 AM, hongy...@gmail.com wrote:
> > Why? As you can see, except the problem discussed here, I still can
> > work with Emacs smoothly with a proxifyer like proxychins-ng.
> > Another thing to note, for the problem disscussed here, the more
> > elegant solution is to use the proxychins-ng's localnet directive,
> > i.e., set the following in its conf file:
> I agree, using proxychains-ng's localnet feature is probably better in
> this situation. I've never used proxychains-ng so I wasn't aware of it.
>
> The proxifiers that I've used in the past didn't have such capability.
>
> You need to know your tools, what they are capable of, and how to use
> that capability.
> > Thank you for telling me this trick, but it looks rather cumbersome.
> It's non-trivial and was written for accessing things like remote iLO /
> RSA / IMM / DRACs buried deep in networks that had no normal routing to
> them.

What's the exact meaning of "iLO / RSA / IMM / DRACs" used above?

> Bind the target IP locally, use SSH remote port forwarding to bind the
> port(s) in question, connect to the web interface via forwarded port,
> let the (at the time) Java / ActiveX code connect to what it thought was
> the remote IP / ports locally, ssh forward things, and profit. It is a
> non-trivial solution to a complex problem. I found that many such
> clients weren't conducive to changing IPs (to use localhost with
> traditional port forwarding) / hostname(s) / ports. There were LOTS of
> hard coded assumptions. This usually involved at least two discrete
> technologies; HTTP and Java or ActiveX, and frequently involved SSL
> certificates. So, making the expected IP & port available locally was
> by far the easiest solution.

Thank you for your in-depth explanation.

HY

Grant Taylor

unread,
Aug 3, 2021, 12:44:03 AM8/3/21
to
On 8/2/21 8:02 PM, hongy...@gmail.com wrote:
> What's the exact meaning of "iLO / RSA / IMM / DRACs" used above?

Uh ... now you're testing my grey matter.

Compaq ~> HP ~> HPE: Integrated Lights Out (card / controller)

IBM: Remote Server Administrator / Integrated Management Module

Dell: Dell Remote Access Controller

While I'm at it, Sun ~> Oracle has System Console / Remote System
Console / Lights Out Manager / Integrated Lights Out Manager / Advanced
Lights Out Manager.

Something like that.

They are all vendor proprietary.

Intelligent Platform Management Interface (?) is the vendor agnostic
(subset) counterpart.

> Thank you for your in-depth explanation.

You're welcome.
0 new messages