Coder Social home page Coder Social logo

Comments (4)

ahendriksen avatar ahendriksen commented on August 26, 2024

Hi,
Thanks for reporting this issue! It sure looks complicated. I will try to look into it, but I might not be able to help you..

If I understand correctly, you can use tmux detach when you manually login to the remote and attach to the tmux session, but this fails when you execute it from an ob-tmux source block?

from ob-tmux.

aseltmann avatar aseltmann commented on August 26, 2024

tmux detach not working was just an illustration that inside the tmux session, which is created through ob-tmux, the tmux version is different than outside.

So on this remote machine I log in to there are two tmux versions: a global one under /bin/tmux with version 1.8 and a local one under /usr/local/bin/tmux with version 3.0a. I need 3.0a.

  • If I attach to a manually created session, inside this session the tmux path is still /usr/local/bin/tmux with version 3.0a
  • If I attach to a session created by ob-tmux, inside this session the tmux path is suddenly /bin/tmux with version 1.8

In my first comment I added some remarks pointing out what worked as intended and what did not work.

from ob-tmux.

ahendriksen avatar ahendriksen commented on August 26, 2024

Hi,
Thanks for the clarifying comment. I believe I understand the problem now :)

I tried to reproduce the problem for myself by first creating a socket forwarded socket:

export HOST=<remote> ;
ssh $HOST -tfN -L ~/.ssh/.tmux-$HOST:$(ssh $HOST  'tmux ls -F "#{socket_path}"' | head -1)

And by creating a new session from the socket:

tmux -S ~/.ssh/.tmux-$HOST  new-session -d -s "session-from-socket" -n "0" 

Then by creating a new session on the remote:

ssh $HOST
tmux new-session -d -s "session-from-remote" -n "0"

After attaching, If I compare

env | sort

on the two sessions, I only see minor differences (DISPLAY is defined in one of the sessions, but not on the other for instance)

I get the same result for

tmux -V

on both sessions. I have versions 2.8 locally and 2.3 remotely.

So it could be that your tmux versions are just incompatible. Have you tried comparing the socket creation with the two different tmuxes? ie:

export HOST=<remote> ;
ssh $HOST -tfN -L ~/.ssh/.tmux-$HOST:$(ssh $HOST  '/bin/tmux ls -F "#{socket_path}"' | head -1)

or

export HOST=<remote> ;
ssh $HOST -tfN -L ~/.ssh/.tmux-$HOST:$(ssh $HOST  '/usr/local/bin/tmux ls -F "#{socket_path}"' | head -1)

Perhaps this is the culprit?

from ob-tmux.

aseltmann avatar aseltmann commented on August 26, 2024

I finally found some time to try this out:

ssh $HOST; tmux new-session -d -s "session-from-remote" -n "0" tmux -S ~/.ssh/.tmux-$HOST new-session -d -s "session-from-socket" -n "0"
tmux attach -t session-from-remote tmux attach -t session-from-socket
which tmux /usr/local/bin/tmux /bin/tmux
tmux -V tmux 3.0a tmux 1.8
env | sort } }
BASH_FUNC_module()=() { eval `/usr/bin/modulecmd bash $*` BASH_FUNC_module()=() { eval `/usr/bin/modulecmd bash $*`
_=/bin/env
DISPLAY=:0
HISTCONTROL=ignoredups HISTCONTROL=ignoredups
HISTSIZE=1000 HISTSIZE=1000
HOME=/home/USER2² HOME=/home/USER2²
HOSTNAME=… HOSTNAME=…
http_proxy=… http_proxy=…
https_proxy=… https_proxy=…
LANG=en_US.UTF-8 LANG=en_US.UTF-8
LESSOPEN=
LOADEDMODULES= LOADEDMODULES=
LOGNAM=USER2² LOGNAM=USER2²
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=01;36:.au=01;36:.flac=01;36:.mid=01;36:.midi=01;36:.mka=01;36:.mp3=01;36:.mpc=01;36:.ogg=01;36:.ra=01;36:.wav=01;36:.axa=01;36:.oga=01;36:.spx=01;36:*.xspf=01;36: LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=01;36:.au=01;36:.flac=01;36:.mid=01;36:.midi=01;36:.mka=01;36:.mp3=01;36:.mpc=01;36:.ogg=01;36:.ra=01;36:.wav=01;36:.axa=01;36:.oga=01;36:.spx=01;36:*.xspf=01;36:
MAIL=… MAIL=…
MATHEMATICA_HOME=/cluster/apps/mathematica/11.3 MATHEMATICA_HOME=/cluster/apps/mathematica/11.3
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/cluster/modulefiles MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/cluster/modulefiles
MODULESHOME=/usr/share/Modules MODULESHOME=/usr/share/Modules
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/USER2²/.local/bin:/home/USER2²/bin:/home/USER2²/.local/bin:/home/USER²/bin PATH=/home/USER¹/path/to/miniconda3/bin:/home/USER¹/path/to/miniconda3/condabin:/home/USER¹/.local/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/USER¹/path/to/miniconda3/bin:/usr/sbin:/home/USER2²/.local/bin:/home/USER2²/bin
PWD=/home/USER2² PWD=/home/USER2²
QTDIR=/usr/lib64/qt-3.3 QTDIR=/usr/lib64/qt-3.3
QT_GRAPHICSSYSTEM_CHECKED=1 QT_GRAPHICSSYSTEM_CHECKED=1
QTINC=/usr/lib64/qt-3.3/include QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib QTLIB=/usr/lib64/qt-3.3/lib
SHELL=/bin/bash SHELL=/bin/bash
SHLVL=2 SHLVL=2
SSH_CLIENT=… SSH_CLIENT=…
SSH_CONNECTION=…
SSH_TTY=/dev/pts/60 SSH_TTY=/dev/pts/60
TERM=screen TERM=screen
TMUX_PANE=%9 TMUX_PANE=%8
TMUX=/tmp/tmux-67339/default,26721,6 TMUX=/tmp/tmux-67339/default,26721,5
USER=USER2² USER=USER2²
_=/usr/bin/env
WINDOWID=41943047
XAUTHORITY=/tmp/xauth-1000-_0
XDG_RUNTIME_DIR=/run/user/67339 XDG_RUNTIME_DIR=/run/user/67339
XDG_SESSION_ID=2202 XDG_SESSION_ID=2202

¹ USER: my username at the local machine
² USER2: my username at the remote machine

As you can see there are bigger differences in env | sort, I think especially PATH is relevant, but some other fields are different as well. Maybe it is important to stress, that I think the problem arises from 2 different tmux versions at the remote (which is a common thing for multi-user server setups, I think).

So it could be that your tmux versions are just incompatible. Have you tried comparing the socket creation with the two different tmuxes? ie:

  • ...ssh $HOST '/bin/tmux ls -F...: After logging into the first SSH, this fails with the following message (the second SSH is not getting prompted):
    protocol version mismatch (client 7, server 8)
    Bad local forwarding specification '/home/USER/.ssh/.tmux-HOST:'
    
  • ...ssh $HOST '/usr/local/bin/tmux ls -F...: Works. Same result (see tables above) as ssh $HOST 'tmux ls -F.

Since the socket creation is only possible with the second version, and the same problem persists, this does not seem to be the culprit.

EDIT: Today when using the output function discussed in issue #6 I experienced something new: I could send the command to the tmux remote server (verified via direct ssh control over command line), BUT after calling org-babel-open-src-block-result in the org-edit-special buffer I just got:

#+RESULTS:
: server version is too old for client

After I did (setq org-babel-tmux-location "/usr/local/bin/tmux") it worked again as before.

from ob-tmux.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.