Attaching to existing tmux sessions always creates a new session (named e.g. _session-18419)

Bug #1750430 reported by Sami Kankaristo on 2018-02-19
This bug affects 6 people
Affects Status Importance Assigned to Milestone

Bug Description

Related Stack Exchange question (I'm glad I found this, I thought my Byobu config was broken somehow):


When using the `tmux` backend for Byobu, attaching to an existing session (by running `byobu`) asks you to select one of the sessions (via `byobu-select-session`):

Byobu sessions...

  1. tmux: foo: 3 windows (created Sun Jan 28 10:23:59 2018) [204x53] (group foo)
  2. tmux: ba: 1 windows (created Sun Jan 28 10:24:16 2018) [204x53]
  3. Create a new Byobu session (tmux)
  4. Run a shell without Byobu (/bin/bash)

Selecting one the sessions creates a new session named e.g. "_foo-20462", which is a "copy" of the existing session (same windows).

Reverting the `os.execvp()` line in the `attach_session()` function of `` fixes the issue:

...but I assume that also removes support for "tmux grouped sessions". I can live without those (I don't really even know what they are), but Byobu creating a new session every time I attach to a session is a bit annoying.

What exactly are "grouped sessions" (I didn't quite get the idea from `man tmux`)?

Could this be a configurable option in Byobu? Creating a new session every time I attach seems like odd default behavior.

Related branches

Mark Grandi (markgrandi) wrote :

I am having this bug, but do you think this is also the cause of the sessions being wiped after disconnecting / reconnecting ? (using f6)

i am having situations like this:

mark@kramidnarg:~⟫ tmux list-sessions
1: 1 windows (created Tue Apr 24 14:12:50 2018) [195x32] (attached)

***create 3 tabs***

mark@kramidnarg:~⟫ tmux list-sessions
1: 3 windows (created Tue Apr 24 14:12:50 2018) [195x32] (attached)


mark@kramidnarg:~⟫ tmux list-sessions
1: 1 windows (created Tue Apr 24 14:13:21 2018) [195x32] (attached)


***type command, open 3 tabs***

mark@kramidnarg:~⟫ tmux list-sessions
1: 3 windows (created Tue Apr 24 14:13:37 2018) [195x32] (attached)


mark@kramidnarg:~⟫ tmux list-sessions
1: 3 windows (created Tue Apr 24 14:13:37 2018) [195x32] (group 1)
_1-27493: 3 windows (created Tue Apr 24 14:14:02 2018) [195x32] (group 1) (attached)


mark@kramidnarg:~⟫ tmux list-sessions
1: 1 windows (created Tue Apr 24 14:14:17 2018) [195x32] (attached)

Adrianna Pińska (confluence) wrote :

I am experiencing an issue which I think may be related ever since I updated to Bionic (byobu version: 5.125-0ubuntu1, tmux version: 2.6-3) -- it seems to be correlated with the introduction of the grouped window view (or possibly having it turned on by default).

On my desktop machine I normally have only one byobu session active. Whenever I log back into my X session and need to resume my byobu session (which I do by running byobu with no parameters, which previously worked), I am not asked to choose a session, but I do see this duplicate session behaviour. The duplicate is clearly a duplicate view of the same session, because any change I make in one group is reflected in the other group.

I haven't been able to do anything to eliminate the duplicate view other than killing the session entirely and starting over (which is not what I want).

Adrianna Pińska (confluence) wrote :

I have also reproduced the issue in Byobu 5.126, installed from the PPA.

Some more information I have been able to determine through experimentation:

* I can get rid of the duplicate session by using byobu kill-session on the session called 1 (i.e. the first session in the view). I think that I need to be inside a window in the second session, otherwise a new empty session is created.

* Using byobu kill-session on the second session detaches me from the session. The duplicates are still there when I run byobu again, recreated in a new group with a new pid. I experienced identical behaviour when I killed the tmux process with the pid shown in the session name.

* I can only reproduce this by logging out of my X session and logging back in. Just closing the graphical terminal in which byobu is running does not seem to produce the same effect. When I start byobu in a new terminal after that, I get a new *empty* session in addition to the existing session, not a duplicate view.

Changed in byobu:
importance: Undecided → Low
status: New → Confirmed
Adrianna Pińska (confluence) wrote :

Today I reproduced the same issue by closing the GUI terminal window in which Byobu was running, and reattaching the session from a new terminal window. I can confirm that `byobu kill-session -t 1` executed from the other session successfully gets rid of one of the duplicate sessions.

Stephan Wijman (swijman) wrote :

I was wondering if there is any progress on this. I prefer using tmux and due to this issue I can't.

Sonny (aadityabhatia) on 2020-06-13
Changed in byobu:
status: Confirmed → Fix Released
Sonny (aadityabhatia) wrote :

This was addressed in byobu 5.124

My use case is to have multiple users connect to an SSH server independently and work in separate tabs. Having a separate session for each client is a desirable feature, not a bug. To spawn a new session for each client,

touch ~/.byobu/.reuse-session

relevant changelog-


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers