Double-exit counterintuitive when running byobu at login

Bug #568306 reported by Thierry Carrez on 2010-04-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu (Ubuntu)
Dustin Kirkland 
Dustin Kirkland 

Bug Description

Binary package hint: byobu

When using byobu automatically at login, it nicely autolaunches and reattaches to your detached session, if any. In essence, it /becomes/ the remote environment, with the possibility to change colors to distinguish between remote hosts, etc.

The issue is, when you want to detach (F6) or exit (type exit in all tabs) from the remote session, you end up on the underlying remote shell. From there you need to exit again to actually exit from the remote session. I find it counterintuitive : if byobu is your remote environment, it needs to run from the point you login to the point you logout. It's even dangerous: once users are used to recognize the "remote" system by looking at byobu colors, being stuck in the limbo underlying remote shell without that branding, some people will definitely think they are back on the local shell (I did, once).

The behavior should be:
local shell -> ssh remote -> (byobu experience) -> exit or detach -> back to local shell

local shell -> ssh remote -> (shell exp.) -> byobu -> (byobu exp.) -> exit or detach -> (shell exp.) -> exit ->back to local shell

But not:
local shell -> ssh remote -> (byobu experience) -> exit or detach -> (shell experience) -> exit -> back to local shell

 * IMPACT: the "double exit" is really annoying to some byobu users, and many people have complained about this over time
 * HOW FIXED: this is trivially fixed on the auto launch line, with "&& exit 0"; note that if byobu/screen crashes or exits non-zero, then the && will not be satisfied, and it won't exit 0
 * TEST CASE: install byobu; configure to launch by default (sudo dpkg-reconfigure byobu); ssh in; type "exit" or press F6 to detach; note that you have to "exit" from the launching shell therafter; install the new package; try "exit" or F6; should exit/detach, and quit the launching session; if a user just wants a shell without byobu, do "ssh -t remotehost bash"
 * REGRESSION POTENTIAL: none really; perhaps some education on the slightly new behavior (which I can do on the Byobu blog), but it's *so* preferential, I think it's extremely well justified

Thierry Carrez (ttx) on 2010-04-22
Changed in byobu (Ubuntu):
importance: Undecided → Wishlist
Dustin Kirkland  (kirkland) wrote :

Hi Thierry-

So we've toyed with this in Byobu in a few releases in the past. Basically, the line written to $HOME/.profile by byobu-launcher-install was changed to:

-`echo $- | grep -qs i` && byobu-launcher
+`echo $- | grep -qs i` && exec byobu-launcher

However, if byobu-launcher (or byobu, or screen) crashes entirely, you're basically locked out interactive shells on your system. It doesn't happen very often, but every once in a while it does. Screen has an occasional segfault. Or byobu does something silly. This situation can be fixed by either logging in as root and fixing the situation (which isn't always possible in Ubuntu systems), or launching a non-interactive shell (also non-trivial).

However, I just tested the following by linking /bin/false to /usr/bin/byobu:

-`echo $- | grep -qs i` && byobu-launcher
+`echo $- | grep -qs i` && byobu-launcher && exit

This actually works really well. If byobu exit (or detach) succeeds, you log all the way out on detach. But if byobu (or screen) crashes, then you still get your shell.

Thanks for bringing this up, Thierry, I'll get a fix committed!


Changed in byobu (Ubuntu):
status: New → In Progress
assignee: nobody → Dustin Kirkland (kirkland)
Dustin Kirkland  (kirkland) wrote :

Fixed in upstream release 2.71.

The patch is small enough that this could probably be SRU'd to Lucid, after a few weeks of testing. Might batch it up with a couple of minor byobu fixes in a couple of weeks after release.

Thanks for reminding me to solve this problem.

Changed in byobu (Ubuntu):
status: In Progress → Fix Committed
Dustin Kirkland  (kirkland) wrote :

Otherwise, this will be fix-released once Maverick opens.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package byobu - 2.74-0ubuntu1

byobu (2.74-0ubuntu1) maverick; urgency=low

  * usr/lib/byobu/disk_io: fix regex to support RAID devices, LP: #572855
  * debian/postinst: make debconf question failsafe, LP: #569041
  * usr/bin/byobu, usr/share/byobu/profiles/byoburc: add support for
    different window sets, LP: #517796
  * usr/bin/byobu-select-session: use screen -ls, less overhead
  * usr/share/man/man1/byobu.1: document the different window sets

byobu (2.73-0ubuntu1) maverick; urgency=low

  [ Dustin Kirkland ]
  * usr/bin/byobu-reconnect-sockets: look for gpg sessions quietly
  * usr/bin/byobu-launcher: ensure that if user does not want a nested
    session, they still get a local shell

  [ Jon Bernard ]
  * etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/rcs_cost,
    usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1:
    - Rackspace cost estimation (based on the ec2 one)

byobu (2.72-0ubuntu1) maverick; urgency=low

  * usr/bin/byobu: support nethack screen mode, LP: #568751
  * usr/share/man/man1/byobu.1: document a sample custom script using
    custom colors, LP: #568967
  * usr/bin/byobu: LANG=C before grepping for text
  * usr/bin/byobu: handle unset term in tput 256 color check
  * bin/byobu-config, lib/byobu/disk_io, share/byobu/profiles/common,
    share/man/man1/byobu.1: added a disk throughput notification
  * usr/bin/byobu-janitor: add hyphenation to the regex to allow for
  * usr/lib/byobu/disk_io: improve MONITORED_DISK overriding
  * usr/lib/byobu/disk: minor simplification

byobu (2.71-0ubuntu1) maverick; urgency=low

  * usr/bin/byobu-launch, usr/bin/byobu-launcher-install,
    usr/bin/byobu-janitor: exit 0 after launching byobu; this is superior
    to previously reverted implementations where we exec'd byobu, since
    we'll only exit 0 if the byobu/screen session exits cleanly; this will
    keep the user from having to do the double-exit when detaching,
    LP: #568306

byobu (2.70-0ubuntu1) maverick; urgency=low

  * usr/bin/byobu-launcher: fix regression in last upload

byobu (2.69-0ubuntu1) lucid; urgency=low

  * usr/bin/byobu-launcher: prompt on nested screen connection, LP: #565398
  * debian/po/, debian/po/de.po, debian/po/en_GB.po,
    debian/po/es.po, debian/po/pt.po, debian/po/ru.po,
    debian/po/templates.pot, po/bg.po, po/cs.po, po/de.po, po/es.po,
    po/fr.po, po/hu.po, po/is.po, po/it.po, po/la.po, po/lt.po, po/nl.po,
    po/pt.po, po/pt_BR.po, po/ru.po, po/sv.po, po/tr.po, po/uk.po:
    - translations merged, LP: #567309
  * bin/byobu-janitor, share/byobu/keybindings/f-keys,
    share/byobu/profiles/common, share/man/man1/byobu.1: add a keybinding,
    ctrl-a ~ to write the current window's buffer to a file, LP: #565399
  * debian/control, debian/screen-profiles.postinst, debian/preinst,
    debian/prerm, debian/rules, usr/bin/byobu-janitor:
    - remove more remnants of screen-profiles
  * debian/rules: drop color symlinks, no longer necessary, should be
    cleaned up by byobu-janitor now
 -- Dustin Kirkland <email address hidden> Wed, 28 Apr 2010 23:11:14 -0500

Changed in byobu (Ubuntu):
status: Fix Committed → Fix Released
Changed in byobu (Ubuntu Lucid):
status: New → In Progress
importance: Undecided → Low
assignee: nobody → Dustin Kirkland (kirkland)
Changed in byobu (Ubuntu):
importance: Wishlist → Low
Changed in byobu (Ubuntu Lucid):
milestone: none → lucid-updates
Dustin Kirkland  (kirkland) wrote :

SRU patch attached.

description: updated
Changed in byobu (Ubuntu Lucid):
status: In Progress → Fix Committed

Accepted into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Alon Swartz (alonswartz) wrote :

Fix confirmed to work (from lucid-proposed).
Tested on: turnkey-core-beta (based on Lucid Lynx).

TurnKey appliances are in the process of being upgraded to be based on Lucid Lynx. Byobu is being included by default and configured to auto-launch (at least during the beta, awaiting user feedback). During testing, this bug was really annoying, and after talking to Dustin and heard he had fixed this, I was relieved.

The bug is minor, but can become a major annoyance.
+1 to be included in 10.04.1

Martin Pitt (pitti) on 2010-06-16
tags: added: verification-done
removed: verification-needed
Kamilion (kamilion) wrote :

Just a quick note; how does one explicitly exit to the remote shell from byobu now?

Perhaps an "Exit to to this machine's console" option would be good in the F9 menu? Then it's out of the way but accessible; having it below the profile-autolaunch would be the correct place in my opinion.

Just a non-zero exit, I guess?

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package byobu - 2.68-0ubuntu1.1

byobu (2.68-0ubuntu1.1) lucid-proposed; urgency=low

  * usr/bin/byobu-launch, usr/bin/byobu-launcher-install: exit 0 after
    launching byobu to prevent the user from having to do the double-exit
    when exiting or detaching, LP: #568306
  * byobu-launcher-uninstall: create the directory, in case this script is
    executed before byobu actually runs, LP: #580384
 -- Dustin Kirkland <email address hidden> Sun, 13 Jun 2010 11:59:44 -0500

Changed in byobu (Ubuntu Lucid):
status: Fix Committed → Fix Released
Malcolm Scott (malcscott) wrote :

I agree with Kamilion (comment 8); as far as I am concerned the fix for this bug has introduced a major regression. Some things -- ssh X tunnelling for example -- do not work from inside a reattached screen session (as the environment variables set by ssh are not and cannot be carried into existing shells inside screen) and before this fix I frequently needed to detach the screen session in order to use the underlying remote shell.

You can SSH into a system and *not* launch byobu with:

  ssh -t <remote_host> bash

You can also modify this behavior on your hosts by making a minor
change to one line in your ~/.profile:

-`echo $- | grep -qs i` && byobu-launcher && exit 0
+`echo $- | grep -qs i` && byobu-launcher

I can perhaps make this behavior a configurable option in the F9 menu
(ie, how would you like your detach to behave?)

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

Other bug subscribers