How can I reattach to my byobu/tmux session?

Gertlex picture Gertlex · Jun 15, 2017 · Viewed 8.5k times · Source

I'm using byobu with a tmux backend in Ubuntu 14.04. The standard methods for selecting/viewing sessions such as byobu-select-session and tmux ls do not find the session.

I created a session via incorrect syntax byobu -S wiki and later detached. (I should have done byobu new -s wiki)

The session still exists, according to

$ ps aux | grep byobu
gert   4032  0.1  0.0  29988  8912 ?        Ss   Jun13   1:46 tmux -f /usr/share/byobu/profiles/tmuxrc -S wiki

I can also see a reference to the session in /tmp

$ ls /tmp/tmux-1001/ -l
total 0
srwxrwx--- 1 gert gert 0 May 30 17:06 default=
srw-rw---- 1 gert gert 0 Jun 14 15:07 wiki=

Answer

slowkoni picture slowkoni · Mar 6, 2018

Try

byobu -S wiki ls

to see if the tmux session is still there. It probably is given your ps output, and will be listed as session 1. Then try

byobu -S wiki attach-session -t 1

Maybe specify the full path to where you can see the "wiki" unix socket that was created when you did byobu -S wiki, which will be in whatever directory you executed that command in originally. Other behavior may occur if byobu or tmux was customized, but basically after you specify byobu -S <path-to-put-socket|path-to-existing-socket-including-socket-name> everything following is going to get passed to tmux. tmux just needs byobu to tell it where to look for its sockets, otherwise it will look in TMPDIR or something by default.

Hope this helps. This is my first ever stackoverflow question that (1) wasn't already answered many different ways, and (2) I knew a possible answer or at least a pointer in the right direction. :)