Launch a Login Shell with Byobu's MOTD Wrapper

byobu-shell is the wrapper that prints your message of the day and then hands you a proper login shell. You will run it as a login-shell entry point, see which messages it prints, and confirm which shell it launches. Allow about ten minutes; you need the byobu package and a terminal where you can start a separate shell, and none of this needs sudo.

1. Check the installed command

byobu-shell is a small wrapper, not the Byobu multiplexer itself. Its documented job is to print a message of the day and launch a shell. The manual page does not document options or arguments. Check that the command is available and record the package version before relying on details that may differ between distributions.

$ command -v byobu-shell
/usr/bin/byobu-shell
$ dpkg-query -W -f='${Package} ${Version}\n' byobu
byobu 6.11-0ubuntu1.1

The version above is the Ubuntu package installed on the system used for this guide. On another system, use that system's package query tool, or read the package metadata supplied by its installer. The behaviour below is anchored to the local 6.11 script and its byobu-shell(1) page.

2. Start it from a terminal

Run the command without sudo. It prints the available MOTD and then replaces itself with a shell, so the command does not return to the original prompt until that new shell exits.

$ byobu-shell

On this Ubuntu installation, the wrapper checks /etc/motd, /run/motd.dynamic and /run/motd, using the first readable file. The manual describes the standard /etc/motd behaviour; the extra runtime paths are an implementation detail of the installed script. You may therefore see a distribution status block before the shell prompt, or no MOTD if none of those files is readable.

Do not edit those files just to change this command's output. They are normally maintained by the operating system's login and update tooling, and changing them requires elevated access. If you only want to test the wrapper, continue into the shell and run a harmless check:

$ printf 'shell=%s\nlogin=%s\n' "$0" "$(case $- in *l*) echo yes;; *) echo no;; esac)"
shell=/bin/bash
login=yes
$ exit

The executable name and prompt vary with your account. The useful result is that the shell is a login shell on this installed version. The wrapper invokes $SHELL with -l when that variable names an executable; if it is absent or unusable, it falls back to /bin/sh -l, as the manual promises a shell fallback.

3. Understand the one-time welcome

The local script has a second message which is separate from the MOTD. The first time it runs for a user, it prints a short Byobu welcome and creates a .welcome-displayed marker in the Byobu configuration directory. Later runs do not print that welcome again. This marker is state for your user account, not a system-wide switch.

Byobu normally uses an existing ~/.byobu directory. If that directory does not exist, the installed support files use $XDG_CONFIG_HOME/byobu, or ~/.config/byobu when XDG_CONFIG_HOME is unset. The exact location can therefore differ between accounts and versions. To inspect the likely locations without changing anything:

$ find "$HOME/.byobu" "$HOME/.config/byobu" -maxdepth 1 -name .welcome-displayed -print 2>/dev/null
/home/you/.config/byobu/.welcome-displayed

No output simply means that neither of those paths contains the marker. A custom BYOBU_CONFIG_DIR or ~/.byoburc can select another location, so check those settings before assuming the marker is missing.

4. Control MOTD output deliberately

The wrapper honours the conventional ~/.hushlogin file. When that file exists, the installed script skips both the MOTD file lookup and its normal MOTD output. This is useful for a quiet automated login, but it also hides information you may rely on, such as maintenance notices.

Check whether the file already exists before changing anything:

$ if [ -e "$HOME/.hushlogin" ]; then
>     echo 'MOTD suppressed by ~/.hushlogin'
> else
>     echo 'MOTD is not suppressed by ~/.hushlogin'
> fi

Do not create ~/.hushlogin merely to remove a welcome that appeared once. It suppresses the MOTD as well. If you intentionally create it, make the change reversible by keeping a note of the reason; removing the file later restores the wrapper's normal MOTD check:

$ touch "$HOME/.hushlogin"
$ rm "$HOME/.hushlogin"

The rm command above removes only that explicitly named per-user file. Do not use a broad wildcard in its place.

5. Select the shell without surprises

The shell choice comes from the SHELL environment variable, not from an option to byobu-shell. It must point to an executable. For a temporary test, select a known shell for this invocation only:

$ SHELL=/bin/sh byobu-shell
$ printf 'shell=%s\n' "$0"
shell=/bin/sh
$ exit

This does not change your account's login shell in /etc/passwd, and it does not alter your normal environment after the child shell exits. Do not set SHELL to an untrusted path or to a command containing spaces: the wrapper treats it as a program path and executes it. If your normal shell is not executable, the fallback is /bin/sh.

Because the wrapper invokes a login shell, shell startup files can run. A broken profile can make the new shell slow, noisy or immediately exit. Re-test with the shell selected explicitly, and inspect the relevant login configuration before changing Byobu files. If you need a shell that does not read login startup files, start it directly rather than using byobu-shell.

6. Check the common failure cases

If command -v byobu-shell prints nothing, the package is not on your PATH. Ask an administrator to install the distribution's byobu package, or correct your environment if it is installed somewhere non-standard. Do not copy a random script into ~/bin and assume it has the same support files.

If the command prints an MOTD but no Byobu welcome, that is normally expected after the marker has been created. If it prints neither, check ~/.hushlogin and the three local MOTD paths. If it exits immediately, test the chosen shell directly as a login shell and inspect its startup files:

$ "$SHELL" -l
$ printf 'login shell started\n'
$ exit

Do not run the wrapper as root to fix a user-shell problem. Root changes the account, configuration directory and marker being inspected, so it can hide the real cause and create files owned by the wrong user.

Done means