Do you want to be a rock star in your LoCo or LUG?

Give a presentation or demonstration on Byobu!

The hard work is already done, as I have created a set of slides for you, available under the Creative Commons Attribution-Share Alike 3.0 license.

There’s also a screencast available at YouTube:

I know a couple of people have done something like this with their groups in the past few months, and I thought I’d help out by providing some screenshots and documentation.

Enjoy,
:-Dustin

Advertisements

KVM’s inside of Byobu

June 25, 2009

Here’s a neat trick that I find phenomenally useful…

I like to run KVM virtual machines inside of Byobu, using KVM’s -curses option. From QEMU’s manpage:

Normally, QEMU uses SDL to display the VGA output. With this option, QEMU can display the VGA output when in text mode using a curses/ncurses interface. Nothing is displayed in graphical mode.

So this only works with non-graphical virtual machines, such as the Ubuntu Server. But hey, that’s what I’m working on every day. Here’s a quick demo screen cast.

Commands used in this video:

  1. start byobu
  2. run kvm -curses karmic-server.img to launch one virtual machine
  3. hit F8 to rename this window karmic
  4. hit F2 to open a new window
  5. start a second virtual machine, and rename that window
  6. hit F3 or F4 to move back and forth between windows
  7. hit F6 to detach
  8. and byobu -x to re-attach

The detach/reattach is really cool, as these virtual machines will continue running in the background. Many people use this sort of method to background an irc client such as irssi, which allows it to serve as a persistently connected proxy.

Of course, virsh and virt-manager are the preferred methods to manage virtual machines in Ubuntu, but I find this useful for my development purposes.

Cheers,
:-Dustin

I minored in Mathematics in college. But as much as I have always loved math, I use it surprisingly little during my day-to-day computer programming. Perhaps this is why I’m excited about the latest Byobu releases.

Byobu-2.12 and 2.13 have introduced some tremendous performance enhancements, mostly surrounding the status gathering scripts.

I have gone over each of these with a fine-toothed comb, trying to make them as efficient as possible. I wrote a testing framework that ran these scripts millions of times to identify the most expensive operations. The improvements mostly involved reducing the number of shells and forks necessary to gather and print the information, and using files resident in memory, such as /var/run and /proc. In the long run, these scripts would probably perform better as compiled C programs. But I’m not yet willing to give up the simplicity and portability of the current shell scripts.

Aside from the scripts’ contents, I also modified the intervals in which they run.

In Ubuntu 9.04, screen-profiles-1.44 ran the status scripts at the following intervals:


SECONDS STATUS
2 cpu-freq
2 load-average
2 mem-used
2 network-down
2 network-up
2 processes
2 reboot-required
2 wifi-quality
10 updates-available
10 users
30 battery
60 uptime
600 ec2-cost
3600 hostname
3600 release
86400 arch
86400 cpu-count
86400 logo
86400 mem-available
86400 menu
86400 whoami

This means that:

  • Every 2 seconds, Byobu will run each of (cpu-freq, load-average, mem-used, network-down, network-up, processes, reboot-required, wifi-quality).
  • Every 10 seconds, Byobu will run (updates-available, users), plus all of the 2-second scripts.
  • Every 30 seconds, Byobu runs (battery), plus the 10-second scripts, plus the 2-second scripts.
  • Every 60 seconds, Byobu runs (uptime), plus the 30-second, 10-second, and 2-second scripts.
  • etc.

These particular intervals result in some unfortunate harmonics, which are not a good thing in terms of Byobu’s responsiveness. The battery script, for instance, only runs twice a minute because it’s relatively expensive. However, at that 30-second interval, the battery script must also share time with the 10- and 2-second scripts. As you can see, we’re going to have a couple of standing waves, that periodically cause some rather expensive refreshes of Byobu’s status bar.

This was reported as several bugs, noting that Byobu causes screen to “stutter” every 2 seconds or so, with an even longer “delay” at 10 seconds. In older versions of Byobu, if you toggle all status notifications “on”, and then scroll through a rather long file, you’ll see it pause or stutter every few seconds. Try, `find /lib | less`, and hold the down-arrow key.

How do we solve this problem? Prime numbers!

If we set the Byobu status updates to happen at prime intervals, rather than (2, 10, 30, 60, …), we can greatly reduce the expensive, compounded updates. We can spread the updates out more evenly over time, without stacking them up as much and creating particularly expensive intervals.

Based on the automated testing and statistical analysis of each script, Byobu is now configured to run the status scripts at the following prime numbered intervals:


SECONDS STATUS
2 cpu_freq
2 load_average
3 network
5 mail
5 reboot_required
7 processes
11 users
13 disk
13 mem_used
17 wifi_quality
19 temp_c
19 temp_f
29 uptime
61 battery
181 updates_available
599 release
601 ec2_cost
607 hostname
613 ip_address
86011 logo
86017 cpu_count
86027 mem_available
86029 whoami
86077 arch

Now, at any given time interval, we’ll only run the status updates corresponding to the prime factors of that interval. So instead of a relatively expensive set of updates running at the 60-second mark, we only run 5 scripts (cpu_freq, load_average, network, mail, reboot_required), rather than 12 scripts in the old model!

The following chart shows time (in seconds) on the x-axis, and the number of scripts that need to run on the y-axis. In red, you have data from screen-profiles-1.44 (in Ubuntu 9.04), and in blue, you have current byobu-2.13 (in Karmic). We have reduced the average number of scripts that need to run per second. More importantly, we have tremendously reduced the harmonic spikes where previously we peaked running a dozen or more scripts at any one time.

In the latest Byobu release (2.13), responsiveness should be much better. The network status item is still the most expensive notification, but even it has improved. With the network item turned off, though, there should be no noticeable stutter in your Byobu sessions.

Prime numbers for the win!

:-Dustin

Howdy byobu users!

Per discussion at last week’s Ubuntu Developer Summit in Barcelona, the latest version of byobu (2.8) has dropped the “diversion” of /usr/bin/screen.

In previous versions of byobu (and screen-profiles), /usr/bin/screen was actually a wrapper script that prompted you to choose your profile, and then launched the real /usr/bin/screen.real with byobu’s configuration.

This has proven to be controversial with some traditional GNU screen users. Also, while most of screen‘s parameters can be passed directly through byobu, some of them cannot.

Thus, from byobu-2.8 onward (and in Ubuntu Karmic Koala), users will need to launch using the byobu command, rather than the screen command.

Note that if you really want to run byobu when you type screen, you can add the following to your $HOME/.screenrc file:

  • source $HOME/.byobu/profile

Also note that if you have configured your system to launch byobu automatically on login, it should continue launching byobu as expected.

Sorry about any inconveniences…

Cheers!
:-Dustin

Mathias Gug and I stumbled upon this byobu
in Barcelona during the Ubuntu Developer Summit

More positive press coverage about byobu! This one is from Enterprise Networking Planet, discussing screen-profiles in Ubuntu 9.04:

:-Dustin

Releasing 2.0

After 54 mini-releases of screen-profiles-1, I’m pleased to declare a 2.0 release! I believe that the project is more stable, more feature-filled, and better performing than ever. screen-profiles has become much more than a fun little hack… I believe that it is ready for general usage.

Changing the Name of the Project

In conjunction with the 2.0 release, I am also renaming the project. The new name of the project and packages is byobu.

Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers. I think this is a fitting description of this project–an elegant enhancement of otherwise functional, plain, practical screens.

The pronunciation, as I understand it, is something like: beeyo-boo.

Update: A reader, Fumihito YOSHIDA, has provided me with a WAV file of byobu being pronounced by his friend, Nobuto MURATA, under the Creative Commons Attribution 3.0 Unported license.

Update: Micah Cowan, a GNU Screen developer, also provided a pronunciation of byobu at Farvo.com. Thanks!

Explaining the Name Change

So why am I changing the name? I’ll enumerate a few reasons…

  1. I have never really liked the term screen-profiles as a permanent project name. It has always been sort of a “working title.” (Think Star Wars: Episode VI’s original title, Revenge of the Jedi)
  2. Like screen itself, the name screen-profiles is functional and descriptive, but perhaps a little bland.
  3. At the birth of the project, it really did provide simply a static set of profiles. But these are far more dynamic, and configurable now. The vast majority of the code is no longer in the profile itself, but in the configuration utilities and status gathering scripts that customize screen.
  4. The project is in the process of being packaged for at least Debian, Fedora, and OpenSUSE, and Ubuntu’s Karmic Koala has not yet entered Alpha1. The timing for a name change is as good as it is going to get.
  5. byobu is such an appropriate name! It expresses elegance, color, multiple panels, and function. Like Ubuntu, it’s an interesting word in a foreign tongue. It also rhymes with GNU. Try saying: Byobu is new GNU fu in Ubuntu, 10 times fast 🙂

Looking Forward

What’s next for byobu?

I believe that GNU Screen can and should be used as a window manager on Linux servers (or at least command-line-only environments) in the same way that Gnome, KDE and XFCE are used on Linux desktops. Following this analogy, you might look at Byobu as providing a functionality similar to a compositing window manager like Compiz or Beryl. Something like Compiz is certainly not for everyone, and is easy to disable. However, it is useful to some people and can certainly enhance the overall desktop experience. And that’s really my goal for byobu — to enhance the experience and usability of screen, and the command line in general.

In the byobu 2.x series, I hope to implement:

  • Additional toggle-able status items in the bottom status panel
  • Detailed callouts for each status item
  • Better interaction with various terminals
  • Additional keybinding sets
  • Configurable support for external notifiers, like notify-osd
  • Internationalization of the text

Updating Links

I’ve made most of the necessary changes in the source code, though I’m still in the process of updating the various links and documentation. The most important ones are:

Packaging

I am in touch with both Reinhard Tartler, who is handling the Debian packaging, and David Duffey who is handling the Fedora packaging. I should have the new package uploaded to Karmic later this week, and make packages available for Hardy, Intrepid, and Jaunty in the byobu PPA.

:-Dustin