Every time I quit Byobu accidentally, on the next start I find an extra session tab for each session called _{sessionname}-{id}:

screenshot screenshot

I find this really annoying since this was not happening in my previous machine with an old Ubuntu 14. I'm on Ubuntu 17.04 now.

Also, i cant find a way to close these extra sessions windows without closing the original.

Pressing F6 (Detach session and then logout) only regenerate the extra/duplicated session with a different {id}.

  • 1
    Seems this bug. Please set there if the bug also affects you. As stated on official site the place to report bugs is in this Launchpad, not that one (I don't know why that even exist). – Pablo Bianchi Mar 11 '19 at 23:52
  • @PabloBianchi exactly this – Illiax Mar 13 '19 at 21:32
  • 1
    Possible workaround: Move to "original" session and run: tmux kill-session -t "$(tmux ls | grep _ | tail -1 | cut -f1 -d:)". – Pablo Bianchi Mar 14 '19 at 2:00
  • @PabloBianchi man, that worked really great. Thank you. – Illiax Apr 9 '19 at 14:00

This appears to be a bug in later versions of byobu, caused when detaching or switching sessions. The bug has not been fixed yet...

Here is a workaround*. This command will get rid of the extra sessions. It was tested on Ubuntu 18.04.

# Get list of active sessions that start with an underscore, and kill them
tmux ls | grep ^_ | cut -f1 "-d:" | xargs -r tmux kill-session -t

This will get a list of byobu/tmux sessions, check for ones that start with an underscore, and then tell tmux to kill them. If there are no duplicate sessions, it won't do anything, so it's safe to run.

* Pablo Bianchi posted a workaround as well, though the command they provided does not check that any duplicate session exists, so it can end up calling "tmux kill-session" without a target and end up killing your active session... It will also kill sessions that happen to have an underscore anywhere within the session name.

| improve this answer | |
  • i didnt know about the cut command; i get it somehow selects the entries that after removing something match hyphen followed by any number of digits ? – Illiax Aug 1 '19 at 6:49

I had exactly the same problem and solved it by updating byobu from PPA.

byobu 5.125 tmux 2.6 Ubuntu 18.04

I spent a few weeks using workaround (killing the process with tmux ls|grep ^_|...); then I fixed this issue completely by just updating byobu to 5.133:

sudo add-apt-repository ppa:byobu/ppa
sudo apt update
sudo apt install byobu
| improve this answer | |
  • Nice, this was fixed over the last two years. Good update!!! The mentioned scripts is no longer needed. – Illiax May 19 at 16:39

Seems you are starting it and then exiting it, but keeping the session alive.

You can exit byobu closing the session (logout) at the same time using Shift+F6.

Also, you can switch between sessions using Alt+up andAlt+down, and then close that session panes/windows using Ctrl+D, exit or your preferred method.

You can check byoby's built in help using Shift+F1.

As a brute force approach, you can terminate all byobu's running sessions running byobu kill-server on your terminal before re-running byobu.

Note: Dustin Kirkland, the creator of byobu, has a PPA where you can get newer versions before being released on primary channels.

| improve this answer | |
  • 1
    nope. I open any terminal and then type byobu. Than start using it. if i close accidently the terminal and open a new one and then type byobu again : now i have two sessions. But both sessions share the same windows so if i close one window on one sessions, it closes in the other session two. It's like a duplicated session. The problem is if I have 4 sessions and quit, now i have 8 sessions. – Illiax Jun 28 '17 at 20:31
  • how do you "accidentally" close byobu? Do you have byobu enabled at login (F9)? Also, when you said windows, did you refer to byobu-windows created with F2 or window manager windows? – dgonzalez Jun 28 '17 at 22:48
  • by accidentally i mean : alt f4 terminal or ctrl+shift+w on terminal (the terminal tab wich holds byobu) . I don't have byobu enabled at login. Yes, windows means f2 windows. – Illiax Jun 29 '17 at 15:35
  • Ok, I think that's the intended behaviour (if I don't close my shells, keep my session and all processes running). You can always navigate through open sessions with Alt+Up/Down. Also observed (at least on my machines) gnome-terminal asks to confirm closing a terminal with a running process. Anyway you are always able to terminate all byobu's running sessions running byobu kill-server on your terminal prior to re-running byobu. – dgonzalez Jun 29 '17 at 18:18
  • 1
    Ok, seems I'm not able to reproduce your issue. You can also try with last version from Dustin Kirkland's own ppa to see if it's a fixed bug in newer releases. – dgonzalez Jun 30 '17 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.