all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problems with X11 forwarding inside frame
@ 2013-05-14 15:20 Joseph Mingrone
  2013-05-14 16:30 ` Bob Proulx
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph Mingrone @ 2013-05-14 15:20 UTC (permalink / raw)
  To: help-gnu-emacs

phe is the local host, gly is the remote host.

From inside a term buffer: 

jrm@phe ~ % ssh -f gly 'env | grep -i display; emacsclient -nc'
0;jrm@phe|~DISPLAY=localhost:10.0
emacsclient: can't find socket; have you started the server?
...
Starting Emacs daemon.

So far so good.  The new frame from gly opens.

From inside a term buffer in the new frame from gly:
jrm@gly ~ % xcalc
Error: Can't open display: localhost:10.0

------

This is isolated to emacs because I can open a remote terminal and X11
forwarding works.
jrm@phe ~ % ssh -f gly 'env | grep -i display; xterm'
0;jrm@phe|~DISPLAY=localhost:10.0

jrm@gly ~ % xcalc # xcalc opens

If I open a local terminal, ssh to gly, then start an emacsclient
everything works fine.  Is there a way to avoid having a local terminal
open for each remote emacs frame and have X11 forwarding work?

Joseph




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-14 15:20 problems with X11 forwarding inside frame Joseph Mingrone
@ 2013-05-14 16:30 ` Bob Proulx
  2013-05-14 18:21   ` Joseph Mingrone
  0 siblings, 1 reply; 8+ messages in thread
From: Bob Proulx @ 2013-05-14 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

Joseph Mingrone wrote:
> phe is the local host, gly is the remote host.
> 
> From inside a term buffer: 
> 
> jrm@phe ~ % ssh -f gly 'env | grep -i display; emacsclient -nc'
> 0;jrm@phe|~DISPLAY=localhost:10.0
> emacsclient: can't find socket; have you started the server?
> ...
> Starting Emacs daemon.
> 
> So far so good.  The new frame from gly opens.

There are details missing.  The emacsclient -nc is reporting first
that it can't open the socket and probably included the next line
suggesting to use server-start to start a server.  But then something
else is "Starting Emacs daemon."  That isn't explained.

Something is setting your DISPLAY variable.  Did you configure your
ssh to ForwardX11 on every connection?  It isn't explained how DISPLAY
is getting set in the above.

> From inside a term buffer in the new frame from gly:
> jrm@gly ~ % xcalc
> Error: Can't open display: localhost:10.0

In order for X programs to connect to your display they will also look
at $XAUTHORITY or $HOME/.Xauthority to obtain the magic cookie
credentials to be able to connect.  This is in addition to $DISPLAY to
locate the communication socket.  If you just setting DISPLAY such as
in a .bashrc file then that will probably not be sufficient.

> This is isolated to emacs because I can open a remote terminal and X11
> forwarding works.
> jrm@phe ~ % ssh -f gly 'env | grep -i display; xterm'
> 0;jrm@phe|~DISPLAY=localhost:10.0

That opens an interactive shell.  There is a large opportunity for
differences there from the other non-interactive shell.

> jrm@gly ~ % xcalc # xcalc opens

First, I don't know.  I don't see enough information in the above to
diagnose it yet.  But I am guessing that in your .bashrc or .profile
that you are setting variables.  When you open a full terminal then
bash will run through all of the startup files which will be different
for an interactive shell than for a non-interactive shell.

> If I open a local terminal, ssh to gly, then start an emacsclient
> everything works fine.  Is there a way to avoid having a local terminal
> open for each remote emacs frame and have X11 forwarding work?

Normally I would open exactly one ssh connection with X11 forwarding.
Then I would start all of the X clients that I intend to start using
that one single connection.

Bob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-14 16:30 ` Bob Proulx
@ 2013-05-14 18:21   ` Joseph Mingrone
  2013-05-14 19:52     ` Joseph Mingrone
  2013-05-17 23:31     ` Bob Proulx
  0 siblings, 2 replies; 8+ messages in thread
From: Joseph Mingrone @ 2013-05-14 18:21 UTC (permalink / raw)
  To: help-gnu-emacs

Bob Proulx <bob@proulx.com> writes:
> There are details missing.  The emacsclient -nc is reporting first
> that it can't open the socket and probably included the next line
> suggesting to use server-start to start a server.  But then something
> else is "Starting Emacs daemon."  That isn't explained.

Here is the full output:

jrm@phe ~ % ssh -f gly 'emacsclient -nc'
0;jrm@phe|~emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
jrm@phe ~ % ("emacs")
Loading autorevert...
Loading autorevert...done
Loading paren...
Loading paren...done
Starting Emacs daemon.
Emacs daemon should have started, trying to connect again

Another prompt shows up, but I'm not doing anything after
ssh -f gly 'emacsclient -nc'.

>
> Something is setting your DISPLAY variable.  Did you configure your
> ssh to ForwardX11 on every connection?  It isn't explained how DISPLAY
> is getting set in the above.

In my ~/.ssh/config for the host gly I have:
ForwardX11 yes
ForwardX11Trusted yes

> In order for X programs to connect to your display they will also look
> at $XAUTHORITY or $HOME/.Xauthority to obtain the magic cookie
> credentials to be able to connect.  This is in addition to $DISPLAY to
> locate the communication socket.  If you just setting DISPLAY such as
> in a .bashrc file then that will probably not be sufficient.

I'm not manually setting DISPLAY.

I've pasted the environments for each setting below.

jrm@phe ~ % ssh -f gly 'emacsclient -nc' start a term buffer jrm@gly ~ %
env OLDPWD=/home/jrm/.ssh PWD=/home/jrm VISUAL=emacsclient
TEXEDIT=emacsclient +%d %s TEXDOCVIEW_pdf=xpdf %s
TEXDOCVIEW_html=firefox %s PAGER=less LESS=-i -X -P%f (%lt-%lb/%L
%pb\%)$ -x4 GTK_IM_MODULE=xim CLICOLOR=1 EDITOR=emacsclient
BROWSER=firefox SSH_CLIENT=129.173.32.xxx 12409 44422 LOGNAME=jrm
LANG=en_CA.UTF-8
TERMCAP=eterm-color:li#54:co#211:cl=\E[H\E[J...
MAIL=/var/mail/jrm
PATH=.:/home/jrm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin
EMACS=24.3.1 (term:0.96) DISPLAY=localhost:10.0
TERMINFO=/usr/local/share/emacs/24.3/etc/ COLUMNS=211 _=/usr/bin/env
TERM=eterm-color USER=jrm HOME=/home/jrm ALTERNATE_EDITOR=
SSH_CONNECTION=129.173.32.xxx 12409 129.173.34.xxx 44422
SHELL=/usr/local/bin/zsh MM_CHARSET=utf-8 LINES=54 BLOCKSIZE=K
INSIDE_EMACS=24.3.1,term:0.96 SHLVL=1

jrm@phe ~ % ssh -f gly 'xterm'
jrm@gly ~ % env 
VISUAL=emacsclient
TEXEDIT=emacsclient +%d %s
TEXDOCVIEW_pdf=xpdf %s
TEXDOCVIEW_html=firefox %s
PAGER=less
LESS=-i -X -P%f (%lt-%lb/%L %pb\%)$ -x4
GTK_IM_MODULE=xim
CLICOLOR=1
EDITOR=emacsclient
BROWSER=firefox
XTERM_SHELL=/usr/local/bin/zsh
LOGNAME=jrm
XTERM_LOCALE=en_CA.UTF-8
XTERM_VERSION=XTerm(292)
DISPLAY=localhost:10.0
WINDOWID=23068685
TERM=xterm
_=/usr/bin/env
OLDPWD=/home/jrm
PWD=/home/jrm
SHLVL=1
TERMCAP=eterm-color:li#36:co#149:cl=\E[H\E[J:...
USER=jrm
HOME=/home/jrm
MAIL=/var/mail/jrm
PATH=.:/home/jrm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin
MM_CHARSET=utf-8
LANG=en_CA.UTF-8
BLOCKSIZE=K
SHELL=/usr/local/bin/zsh
SSH_CLIENT=129.173.32.xxx 25693 44422
SSH_CONNECTION=129.173.32.xxx 25693 129.173.34.xxx 44422
ALTERNATE_EDITOR=

Thanks,

Joseph




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-14 18:21   ` Joseph Mingrone
@ 2013-05-14 19:52     ` Joseph Mingrone
  2013-05-16  5:17       ` W. Greenhouse
  2013-05-17 23:31     ` Bob Proulx
  1 sibling, 1 reply; 8+ messages in thread
From: Joseph Mingrone @ 2013-05-14 19:52 UTC (permalink / raw)
  To: help-gnu-emacs

> Bob Proulx <bob@proulx.com> writes:
>> In order for X programs to connect to your display they will also look
>> at $XAUTHORITY or $HOME/.Xauthority to obtain the magic cookie
>> credentials to be able to connect.

This seems to be on the right track.  When I open a frame with % ssh -f
gly 'emacsclient -nc', I get the DISPLAY error.  However, if I leave the
emacs frame and open a local terminal and ssh to gly, then go back to
the emacs frame, X11 forwarding works.  I've checked the environment
before and after the second ssh and there are no changes.  On the other
hand, ~/.Xauthority on gly does change.

If think I have to get % ssh -f gly 'emacsclient -nc' to exchange a
magic cookie.  I'm guessing the answer is in the xauth man page.

Joseph




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-14 19:52     ` Joseph Mingrone
@ 2013-05-16  5:17       ` W. Greenhouse
  2013-05-19  1:46         ` Joseph Mingrone
  0 siblings, 1 reply; 8+ messages in thread
From: W. Greenhouse @ 2013-05-16  5:17 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Joseph Mingrone <jrm-Hfylf0g1ZvA@public.gmane.org> writes:

>> Bob Proulx <bob-5cAygf9QrE/QT0dZR+AlfA@public.gmane.org> writes:
>>> In order for X programs to connect to your display they will also look
>>> at $XAUTHORITY or $HOME/.Xauthority to obtain the magic cookie
>>> credentials to be able to connect.
>
> This seems to be on the right track.  When I open a frame with % ssh -f
> gly 'emacsclient -nc', I get the DISPLAY error.  However, if I leave the
> emacs frame and open a local terminal and ssh to gly, then go back to
> the emacs frame, X11 forwarding works.  I've checked the environment
> before and after the second ssh and there are no changes.  On the other
> hand, ~/.Xauthority on gly does change.
>
> If think I have to get % ssh -f gly 'emacsclient -nc' to exchange a
> magic cookie.  I'm guessing the answer is in the xauth man page.
>
> Joseph

Maybe somehow it is the backgrounding behavior of ssh -f that causes the
trouble.  I use "ssh -Xt host emacsclient -c" often, and it can run
other X applications from its shells no problem.

-- 
Regards,
WGG




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-14 18:21   ` Joseph Mingrone
  2013-05-14 19:52     ` Joseph Mingrone
@ 2013-05-17 23:31     ` Bob Proulx
  1 sibling, 0 replies; 8+ messages in thread
From: Bob Proulx @ 2013-05-17 23:31 UTC (permalink / raw)
  To: help-gnu-emacs

Joseph Mingrone wrote:
> jrm@phe ~ % ssh -f gly 'emacsclient -nc'
> 0;jrm@phe|~emacsclient: can't find socket; have you started the server?
> To start the server in Emacs, type "M-x server-start".
> jrm@phe ~ % ("emacs")
> Loading autorevert...
> Loading autorevert...done
> Loading paren...
> Loading paren...done
> Starting Emacs daemon.
> Emacs daemon should have started, trying to connect again
> 
> Another prompt shows up, but I'm not doing anything after
> ssh -f gly 'emacsclient -nc'.

I would start the emacs server first so that emacsclient has something
to connect.  This above appears out of order to me.  That may be some
of the problem.  Start the server first.

I can't figure out what you are trying to do here.  It doesn't make
any sense to me.  You have emacs running.  But you haven't started a
server.  You are ssh'ing over to a remote system and running
emacsclient there but without a file.  If that can connect to the
running emacs server then it would simply raise that frame.  But you
started it from emacs already.  So none of the above makes any sense
to me.

Perhaps you could start again from the beginning.  Take it step by
step.  First explain what you are trying to accomplish.  Then explain
what you have done step by step.

Bob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
  2013-05-16  5:17       ` W. Greenhouse
@ 2013-05-19  1:46         ` Joseph Mingrone
  0 siblings, 0 replies; 8+ messages in thread
From: Joseph Mingrone @ 2013-05-19  1:46 UTC (permalink / raw)
  To: help-gnu-emacs

wgreenhouse@riseup.net (W. Greenhouse)
writes:

> Joseph Mingrone <jrm@ftfl.ca> writes:
>> If think I have to get % ssh -f gly 'emacsclient -nc' to exchange a
>> magic cookie.  I'm guessing the answer is in the xauth man page.

> Maybe somehow it is the backgrounding behavior of ssh -f that causes the
> trouble.  I use "ssh -Xt host emacsclient -c" often, and it can run
> other X applications from its shells no problem.

I think you're right.  Unfortunately , with "ssh -X host emacsclient
-c", you have to have a terminal open for each remote emacsclient.  I
was thinking/hoping it would be possible to do something like this.  In
stumpwm, you can do C-t !, to bring up a little dialog box to run
commands.  So, running C-t ! ssh -f remote-host emacsclient -nc results
in one windows opening, the remote emacsclient frame.  Anyway, I think I'll
stop obsessing now and just accept that it doesn't seem to work.

Thanks for all your input,

Joseph




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with X11 forwarding inside frame
       [not found] <mailman.25746.1368546463.855.help-gnu-emacs@gnu.org>
@ 2013-05-19  8:38 ` J G Miller
  0 siblings, 0 replies; 8+ messages in thread
From: J G Miller @ 2013-05-19  8:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, May 14th, 2013, at 12:20:42h -0300, Joseph Mingrone asked:

> Is there a way to avoid having a local terminal
> open for each remote emacs frame and have X11 forwarding work?

An alternative approach would be use VNC (tight VNC + sshvnc startup
probably being the best choice) and then run eamcs remotely in the big
VNC window.

Then there is no need for any local terminals at all, and also
an easy way to overcome the problem of starting dbus on the
remote machine if the emacs version on the remote machine
is built for GNOME thus needs dbus running on its own host.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-19  8:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14 15:20 problems with X11 forwarding inside frame Joseph Mingrone
2013-05-14 16:30 ` Bob Proulx
2013-05-14 18:21   ` Joseph Mingrone
2013-05-14 19:52     ` Joseph Mingrone
2013-05-16  5:17       ` W. Greenhouse
2013-05-19  1:46         ` Joseph Mingrone
2013-05-17 23:31     ` Bob Proulx
     [not found] <mailman.25746.1368546463.855.help-gnu-emacs@gnu.org>
2013-05-19  8:38 ` J G Miller

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.