12

I encountered the following ERROR messages:

1.

byobu
ERROR: Sessions should be nested with care. Unset $TMUX to force.

some versions will show a warning instead of an error:

WARNING: Sessions should be nested with care.

2.

byobu -ls
tmux: unknown option -- s
usage: tmux [-28lquvV] [-c shell-command] [-f file] [-L socket-name]
            [-S socket-path] [command [flags]]

May I ask what you recommend?

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
  • See this `https://stackoverflow.com/questions/50047544/tmux-does-not-work/75113978#75113978` – Salio Jan 15 '23 at 13:40

2 Answers2

3

As the error suggests, nesting Byobu sessions inside of Byobu or Tmux can be complicated. If you know you want to do this, you simply need to unset the TMUX environment variable to override this protection, which you can do on one line like this:

TMUX=  byobu

To your second question, it looks like you're trying to run the GNU Screen -ls command to list sessions? If so, you're probably confusing the fact that Byobu now supports two different backends: Tmux and Screen.

The default behavior in Byobu is to use the Tmux backend. However, you can override that temporarily at any time, by calling directly the binaries byobu-tmux or byobu-screen, or you can permanently choose and configure your default backend using byobu-select-backend, and then the simple byobu command will default to that backend thereafter.

Full disclosure: I am the author and maintainer of Byobu.

Dustin Kirkland
  • 5,323
  • 3
  • 36
  • 34
  • 1
    Unfortunately this appears to be a rather faulty kind of detection. I'm not sure what it's doing to detect, but apparently it's not checking that I'm running inside either `screen` or `tmux`. `TMUX` is also not set (`env|grep -i tmux` comes up empty) and `env|grep -i screen` merely shows me the `TERM=screen-256color` entry. However, there *is* another `tmux` session running which is not maintained (or to be maintained) by Byobu. All I wanted to demonstrate is how Byobu improved the experience with GNU screen as backend. Yet `TMUX= byobu-screen` still gives this warning. Won't start. – 0xC0000022L Jun 19 '15 at 11:50
  • Aaah, I noticed that it appears to use the `TERM` variable (set to `screen-256color`) for compatibility reasons. Unfortunately overriding this value like so `TERM=xterm-256color byobu` (`screen` selected backend) and explicitly `TERM=xterm-256color byobu-screen` gets me into my running **Tmux** session. So evidently the `TERM` variable plays a role in auto-detection, but it also exposes other faulty behavior. – 0xC0000022L Jun 19 '15 at 12:02
2
  1. Maybe you didn't realize you were ALREADY in a byobu session? That's when I saw this, a little "doh" moment.
  2. Byobu, it seems, passes the arguments to the program it is using on the backend. Kudos if you realized that and passed -ls because you know that screen takes an -ls argument. But unless you specified otherwise, byobu is using TMUX, so TMUX complained about the arguments. This, I hope, more clearly explains the cryptic output.

I found that if I have multiple byobu sessions (not nested necessarily), and I call byobu from yet another terminal (not from within byobu), it will give me some choices. I'm assuming this is actually TMUX output:

byobu
Byobu sessions...

  1. tmux: 0: 1 windows (created Wed Aug 27 10:31:14 2014) [209x57] (attached)
  2. tmux: 1: 1 windows (created Wed Aug 27 10:31:23 2014) [80x23] (attached)
  3. Create a new Byobu session (tmux)
  4. Run a shell without Byobu (/bin/bash)

If there is only one session running, it doesn't give me this output.

I learned something from Dustin's answer, about the $TMUX environment variable. But that warrants a bit more explanation I think.

$TMUX will contain a path to some files that TMUX must use to juggle/keep-track-of the sessions.

(from within a byobu session)
echo $TMUX
/tmp/tmux-1000/default,2003,0

Obviously clearing this environment variable makes TMUX forget about all the sessions, and it let's you do what you want because it doesn't even realize you are nesting. This is referred to as forcing in the first error message you got.

I think a better alternative is to review all the open session and decide whether you really want to nest or not, and potentially close some stale session instead of forcing TMUX to bend to your will. But that is just IMHO.

Wilbur Whateley
  • 201
  • 1
  • 11