For Christmas (or just after), I got a BeagleBone to try out some of the many input options that board has. I have done programming from the web and server perspective (a little GUI work), but I have not tried programming something that can interact with the physical environment. Initially, I just planned to get up to speed some with electrical circuits and gain a better understanding of some things that I took in college (Electrical Engineering I and II). Basically, I’ll make some LEDs light based on a program I write. I will probably start with Nodejs since the Bonescript is a pretty nice library.
By default, the BeagleBone comes with the Angstrom distribution installed on the MicroSD. I wanted to get some applications installed on it that I was familiar with on other Linux distributions. This includes:
- mg – micro emacs
- nginx – web server
- tmux – terminal multiplexer
- mosh – mosh shell for roaming and reconnecting
For the most part, these all installed fairly easily with the standard “configure, make and make install”. There was one of caveat to that.
After that, mosh compiled without a problem.
After getting tmux installed, I thought I would give it a try. I created a session and then detached the window. I then re-attached without a problem. Things seemed to be working fine. I then deattached and closed my ssh session. I then tried reconnecting and re-attached my tmux session (tmux attach). This did not work. I then hunted around and found other discussions on this but any of the recommendations people had did not work for me. After much searching and looking around, I ran across this discussion.
An the Angstrom distribution uses the systemd system and service manager. The configs for setting up systemd services are in /lib/systemd/system/. Angstrom being an embedded system appears to favor lighter weight libraries. For ssh, it uses dropbear and the file we are interested in is:
In this file, we need to tell the systemd to not kill process on ssh exec. To do this, we need to edit (or add) the KillMode line. It should look like this:
The value of “process” tells systemd to only kill the main process. In this case, it will only kill the dropbear process and not other processes like tmux. After making this change, I rebooted to make sure it was in effect. I was then able to start a tmux session, deattach, end my ssh session, reconnect via ssh and attach to the tmux process.
Along the same lines, mosh requires a background process to remain running after connection via ssh to start it. Needless to say, mosh wasn’t working originally, but after this change, it works like a charm. Now that I have my BeagleBone setup, I’m readdy to start figuring out my first simple circuit to build.