33

I understand that there is a way of defining windows that are opened in a session by saving configuration files in $BYOBU_CONFIG_DIR. But is there a way (command or script) to save the current session (i.e. the windows and their names etc) such that it can be restored after a reboot?

4
  • possible duplicate of Is there a way to persist tmux sessions across reboots?
    – yPhil
    Sep 17, 2013 at 8:34
  • Yes Answered here superuser.com/questions/440015/…
    – xizdaqrian
    Apr 1, 2014 at 11:46
  • A lot of the scripts and suggestions linked above and below seem to work on vanilla tmux but not necessarily on byobu, which makes them hard to use if you're used to/like byobu. It would be great if this kind of feature came to byobu (and tmux without additional script & plugins) in the future. I would be happy with just window/tab names and paths restored, but history would be great too.
    – Nick
    Jan 6, 2015 at 16:29
  • Maybe this help: byobu-layout - Save and restore byobu-tmux layouts.
    – Pablo A
    Feb 4, 2018 at 17:56

2 Answers 2

2

Having interactive sessions survive reboots seems to defeat the whole purpose of reboots, which is (at least in part) to create a clean, safe slate to restart to your system.

Yet, it you are really keen on this, there will be a clumsy shortcut: use a linux container (lxc) to run your byobu section, freeze it when you are about to reboot the host system, then use lxc-restart to restart your container, and unfreeze it. This will return you your byobu session as you left it (minus the ssh-sessions, of course).

Only problem is. lxc-restart from a configuration file is announced in the sourceforge page, but is not implemented yet.

Lastly, there is another possibility, which you may find on github: I am not sure what exactly you wish from restarting byobu as it once was, so I am not sure whether this is really what you are searching for, but it does provide some functionalities which you may find useful. Cheers.

1

IMP: Please do not use this solution in your development environment. It might mess up your session.

There is a partially successful way of doing this.

Download this script here and keep it in your bin folder and make it executable. Remember to save it as tmux-session.

Now, keep on working in byobu. When you are done and about to reboot, just type:

tmux-session save

After rebooting, open byobu and then type:

tmux-session restore

Now, this works because byogu is using tmux as backend. But why did I say it works partially? Because, not all configuration is restored using the above script. Only the tabs are restored, but their location and other things are not restored.

There is another solution using : tmux-resurrect. But for now, it doesn't play cool with byobu. See the issue posted here : Doesn't play cool with byobu

CONCLUSION: So far, there is no complete solution to achieve this. But I hope one day, there will be. One day, one of us will write the solution.

2
  • Thanks for the script shivams, but it actually messed up my byobu session after restoring. I wasn't able to create/rename/tabs and my environment was messed up. Closing and restarting byobu brought it back to normal but people should definitely test this script before using. FWIW I'm using whatever version and config of byobu that is part of the Fedora 20 default repositories.
    – Nick
    Jan 6, 2015 at 15:59
  • 1
    Yes. That is why it is partial solution. Anyways, thanks for the comment. I have added a warning now.
    – shivams
    Jan 26, 2015 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .