6

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}.

Pablo Bianchi
  • 15,657
Illiax
  • 113

3 Answers3

4

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
Zanna
  • 70,465
  • Nice, this was fixed over the last two years. Good update!!! The mentioned scripts is no longer needed. – Illiax May 19 '20 at 16:39
2

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.

Xkeeper
  • 206
  • 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 01 '19 at 06:49
0

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.

Pablo Bianchi
  • 15,657
dgonzalez
  • 7,010
  • 6
  • 19
  • 28
  • 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
  • Now we are getting close! I know i cant alt+up/down to navigate between my sessions. That's when the problems happens. Right there i have duplicated sessions for each one i had open before closing accidently. – Illiax Jun 30 '17 at 18:31
  • 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
  • Checked. It still happens :( – Illiax Jul 03 '17 at 15:44