In tmux session, cannot connect to X server after ssh'ing

Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
At work, I have a desktop with a monitor and a few running tmux sessions. At home, I frequently ssh into that desktop and enter my running tmux sessions. When I ssh from home, I do not want to use X11, so I do not use the -X flag. When I go back to work (after ssh'ing from home) and use those tmux sessions on desktop, I can no longer do anything that would spawn a GUI. I can't open files in evince. When I try use matplotlib, I get a : cannot connect to X server message.
After ssh'ing and opening an existing tmux session from home, how do I later reattach the ability to open up GUI stuff on the desktop?
The ssh'ing from home seems to make the tmux session forget that it can spawn GUI stuff.
EDIT:
ssh x11 tmux
add a comment |Â
up vote
8
down vote
favorite
At work, I have a desktop with a monitor and a few running tmux sessions. At home, I frequently ssh into that desktop and enter my running tmux sessions. When I ssh from home, I do not want to use X11, so I do not use the -X flag. When I go back to work (after ssh'ing from home) and use those tmux sessions on desktop, I can no longer do anything that would spawn a GUI. I can't open files in evince. When I try use matplotlib, I get a : cannot connect to X server message.
After ssh'ing and opening an existing tmux session from home, how do I later reattach the ability to open up GUI stuff on the desktop?
The ssh'ing from home seems to make the tmux session forget that it can spawn GUI stuff.
EDIT:
ssh x11 tmux
Bit confused. Are you using the-Xflag now or not? You can only do X11 stuff through SSH if that's set.
â Anko
Jul 25 '14 at 21:09
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23
add a comment |Â
up vote
8
down vote
favorite
up vote
8
down vote
favorite
At work, I have a desktop with a monitor and a few running tmux sessions. At home, I frequently ssh into that desktop and enter my running tmux sessions. When I ssh from home, I do not want to use X11, so I do not use the -X flag. When I go back to work (after ssh'ing from home) and use those tmux sessions on desktop, I can no longer do anything that would spawn a GUI. I can't open files in evince. When I try use matplotlib, I get a : cannot connect to X server message.
After ssh'ing and opening an existing tmux session from home, how do I later reattach the ability to open up GUI stuff on the desktop?
The ssh'ing from home seems to make the tmux session forget that it can spawn GUI stuff.
EDIT:
ssh x11 tmux
At work, I have a desktop with a monitor and a few running tmux sessions. At home, I frequently ssh into that desktop and enter my running tmux sessions. When I ssh from home, I do not want to use X11, so I do not use the -X flag. When I go back to work (after ssh'ing from home) and use those tmux sessions on desktop, I can no longer do anything that would spawn a GUI. I can't open files in evince. When I try use matplotlib, I get a : cannot connect to X server message.
After ssh'ing and opening an existing tmux session from home, how do I later reattach the ability to open up GUI stuff on the desktop?
The ssh'ing from home seems to make the tmux session forget that it can spawn GUI stuff.
EDIT:
ssh x11 tmux
ssh x11 tmux
edited Jul 26 '14 at 23:24
asked Jul 25 '14 at 21:02
chrisdembia
17918
17918
Bit confused. Are you using the-Xflag now or not? You can only do X11 stuff through SSH if that's set.
â Anko
Jul 25 '14 at 21:09
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23
add a comment |Â
Bit confused. Are you using the-Xflag now or not? You can only do X11 stuff through SSH if that's set.
â Anko
Jul 25 '14 at 21:09
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23
Bit confused. Are you using the
-X flag now or not? You can only do X11 stuff through SSH if that's set.â Anko
Jul 25 '14 at 21:09
Bit confused. Are you using the
-X flag now or not? You can only do X11 stuff through SSH if that's set.â Anko
Jul 25 '14 at 21:09
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
All I need to do is set the DISPLAY environment variable to :0.0. I think the issue was that I am using the fish shell, and I need to use the -x flag to set when doing this:
set -x DISPLAY :0.0
2
Note that the correct value forDISPLAYmight be different from:0.0. A quick way to find out is to create a new tmux window andecho $DISPLAYthere.
â j08lue
May 11 '15 at 8:32
1
Just extending the comment from @j08lue; in my caseecho $DISPLAYreturnedlocalhost:10.0and runningset DISPLAY localhost:0.0did the trick.
â IsaacS
May 14 '16 at 0:56
Does anyone know abashequivalent, or a cross-shell version?set -xjust increases verbosity for me inbash. @IsaacS, did you have toset DISPLAY localhost:10.0instead or didlocalhost:0.0work for you?
â icedwater
Apr 26 '17 at 9:26
1
On bash, you should be able to useexport DISPLAY=:0.0.
â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting$DISPLAY?
â nealmcb
37 mins ago
add a comment |Â
up vote
0
down vote
I had the same issue. I normally use tmux as part of a multi-monitor X11 desktop environment, and sometimes ssh in from a chromebook, which doesn't support X11 or set $DISPLAY. The answer by @chrisdembia works, but requires changing DISPLAY in each new window for the rest of the tmux session, which is a pain.
A permanent solution is to remove DISPLAY from the tmux update-environment variable in the tmux settings. You can see your current value with this command:
tmux show-options -g update-environment
To remove it, I added this line to my ~/.tmux.conf file, including everything but DISPLAY:
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
This is further explained at Reset the shell DISPLAY variable in a tmux session over ssh, which explains why DISPLAY is there by default, for a different common use case.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
All I need to do is set the DISPLAY environment variable to :0.0. I think the issue was that I am using the fish shell, and I need to use the -x flag to set when doing this:
set -x DISPLAY :0.0
2
Note that the correct value forDISPLAYmight be different from:0.0. A quick way to find out is to create a new tmux window andecho $DISPLAYthere.
â j08lue
May 11 '15 at 8:32
1
Just extending the comment from @j08lue; in my caseecho $DISPLAYreturnedlocalhost:10.0and runningset DISPLAY localhost:0.0did the trick.
â IsaacS
May 14 '16 at 0:56
Does anyone know abashequivalent, or a cross-shell version?set -xjust increases verbosity for me inbash. @IsaacS, did you have toset DISPLAY localhost:10.0instead or didlocalhost:0.0work for you?
â icedwater
Apr 26 '17 at 9:26
1
On bash, you should be able to useexport DISPLAY=:0.0.
â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting$DISPLAY?
â nealmcb
37 mins ago
add a comment |Â
up vote
3
down vote
accepted
All I need to do is set the DISPLAY environment variable to :0.0. I think the issue was that I am using the fish shell, and I need to use the -x flag to set when doing this:
set -x DISPLAY :0.0
2
Note that the correct value forDISPLAYmight be different from:0.0. A quick way to find out is to create a new tmux window andecho $DISPLAYthere.
â j08lue
May 11 '15 at 8:32
1
Just extending the comment from @j08lue; in my caseecho $DISPLAYreturnedlocalhost:10.0and runningset DISPLAY localhost:0.0did the trick.
â IsaacS
May 14 '16 at 0:56
Does anyone know abashequivalent, or a cross-shell version?set -xjust increases verbosity for me inbash. @IsaacS, did you have toset DISPLAY localhost:10.0instead or didlocalhost:0.0work for you?
â icedwater
Apr 26 '17 at 9:26
1
On bash, you should be able to useexport DISPLAY=:0.0.
â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting$DISPLAY?
â nealmcb
37 mins ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
All I need to do is set the DISPLAY environment variable to :0.0. I think the issue was that I am using the fish shell, and I need to use the -x flag to set when doing this:
set -x DISPLAY :0.0
All I need to do is set the DISPLAY environment variable to :0.0. I think the issue was that I am using the fish shell, and I need to use the -x flag to set when doing this:
set -x DISPLAY :0.0
answered Aug 1 '14 at 19:56
chrisdembia
17918
17918
2
Note that the correct value forDISPLAYmight be different from:0.0. A quick way to find out is to create a new tmux window andecho $DISPLAYthere.
â j08lue
May 11 '15 at 8:32
1
Just extending the comment from @j08lue; in my caseecho $DISPLAYreturnedlocalhost:10.0and runningset DISPLAY localhost:0.0did the trick.
â IsaacS
May 14 '16 at 0:56
Does anyone know abashequivalent, or a cross-shell version?set -xjust increases verbosity for me inbash. @IsaacS, did you have toset DISPLAY localhost:10.0instead or didlocalhost:0.0work for you?
â icedwater
Apr 26 '17 at 9:26
1
On bash, you should be able to useexport DISPLAY=:0.0.
â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting$DISPLAY?
â nealmcb
37 mins ago
add a comment |Â
2
Note that the correct value forDISPLAYmight be different from:0.0. A quick way to find out is to create a new tmux window andecho $DISPLAYthere.
â j08lue
May 11 '15 at 8:32
1
Just extending the comment from @j08lue; in my caseecho $DISPLAYreturnedlocalhost:10.0and runningset DISPLAY localhost:0.0did the trick.
â IsaacS
May 14 '16 at 0:56
Does anyone know abashequivalent, or a cross-shell version?set -xjust increases verbosity for me inbash. @IsaacS, did you have toset DISPLAY localhost:10.0instead or didlocalhost:0.0work for you?
â icedwater
Apr 26 '17 at 9:26
1
On bash, you should be able to useexport DISPLAY=:0.0.
â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting$DISPLAY?
â nealmcb
37 mins ago
2
2
Note that the correct value for
DISPLAY might be different from :0.0. A quick way to find out is to create a new tmux window and echo $DISPLAY there.â j08lue
May 11 '15 at 8:32
Note that the correct value for
DISPLAY might be different from :0.0. A quick way to find out is to create a new tmux window and echo $DISPLAY there.â j08lue
May 11 '15 at 8:32
1
1
Just extending the comment from @j08lue; in my case
echo $DISPLAY returned localhost:10.0 and running set DISPLAY localhost:0.0 did the trick.â IsaacS
May 14 '16 at 0:56
Just extending the comment from @j08lue; in my case
echo $DISPLAY returned localhost:10.0 and running set DISPLAY localhost:0.0 did the trick.â IsaacS
May 14 '16 at 0:56
Does anyone know a
bash equivalent, or a cross-shell version? set -x just increases verbosity for me in bash. @IsaacS, did you have to set DISPLAY localhost:10.0 instead or did localhost:0.0 work for you?â icedwater
Apr 26 '17 at 9:26
Does anyone know a
bash equivalent, or a cross-shell version? set -x just increases verbosity for me in bash. @IsaacS, did you have to set DISPLAY localhost:10.0 instead or did localhost:0.0 work for you?â icedwater
Apr 26 '17 at 9:26
1
1
On bash, you should be able to use
export DISPLAY=:0.0.â chrisdembia
Jun 2 '17 at 0:48
On bash, you should be able to use
export DISPLAY=:0.0.â chrisdembia
Jun 2 '17 at 0:48
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting
$DISPLAY?â nealmcb
37 mins ago
I don't like this solution, since I have to do it for every new window for the rest of the session (which lasts weeks for me). And it happens even when I'm back on my main X11 system creating new windows. How can we get tmux to stop unsetting
$DISPLAY?â nealmcb
37 mins ago
add a comment |Â
up vote
0
down vote
I had the same issue. I normally use tmux as part of a multi-monitor X11 desktop environment, and sometimes ssh in from a chromebook, which doesn't support X11 or set $DISPLAY. The answer by @chrisdembia works, but requires changing DISPLAY in each new window for the rest of the tmux session, which is a pain.
A permanent solution is to remove DISPLAY from the tmux update-environment variable in the tmux settings. You can see your current value with this command:
tmux show-options -g update-environment
To remove it, I added this line to my ~/.tmux.conf file, including everything but DISPLAY:
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
This is further explained at Reset the shell DISPLAY variable in a tmux session over ssh, which explains why DISPLAY is there by default, for a different common use case.
add a comment |Â
up vote
0
down vote
I had the same issue. I normally use tmux as part of a multi-monitor X11 desktop environment, and sometimes ssh in from a chromebook, which doesn't support X11 or set $DISPLAY. The answer by @chrisdembia works, but requires changing DISPLAY in each new window for the rest of the tmux session, which is a pain.
A permanent solution is to remove DISPLAY from the tmux update-environment variable in the tmux settings. You can see your current value with this command:
tmux show-options -g update-environment
To remove it, I added this line to my ~/.tmux.conf file, including everything but DISPLAY:
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
This is further explained at Reset the shell DISPLAY variable in a tmux session over ssh, which explains why DISPLAY is there by default, for a different common use case.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I had the same issue. I normally use tmux as part of a multi-monitor X11 desktop environment, and sometimes ssh in from a chromebook, which doesn't support X11 or set $DISPLAY. The answer by @chrisdembia works, but requires changing DISPLAY in each new window for the rest of the tmux session, which is a pain.
A permanent solution is to remove DISPLAY from the tmux update-environment variable in the tmux settings. You can see your current value with this command:
tmux show-options -g update-environment
To remove it, I added this line to my ~/.tmux.conf file, including everything but DISPLAY:
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
This is further explained at Reset the shell DISPLAY variable in a tmux session over ssh, which explains why DISPLAY is there by default, for a different common use case.
I had the same issue. I normally use tmux as part of a multi-monitor X11 desktop environment, and sometimes ssh in from a chromebook, which doesn't support X11 or set $DISPLAY. The answer by @chrisdembia works, but requires changing DISPLAY in each new window for the rest of the tmux session, which is a pain.
A permanent solution is to remove DISPLAY from the tmux update-environment variable in the tmux settings. You can see your current value with this command:
tmux show-options -g update-environment
To remove it, I added this line to my ~/.tmux.conf file, including everything but DISPLAY:
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
This is further explained at Reset the shell DISPLAY variable in a tmux session over ssh, which explains why DISPLAY is there by default, for a different common use case.
answered 8 mins ago
nealmcb
283311
283311
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f146631%2fin-tmux-session-cannot-connect-to-x-server-after-sshing%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Bit confused. Are you using the
-Xflag now or not? You can only do X11 stuff through SSH if that's set.â Anko
Jul 25 '14 at 21:09
Sorry for the confusion. I never use the -X flag, anywhere. I do not intend on doing X11 stuff through SSH. I only intend on using X11 on my desktop, where the tmux session actually lives. I'll update the original question.
â chrisdembia
Jul 26 '14 at 23:23