Open a bash shell through nerves_pack?

I’ve got the new stack up and running and can ssh into my nerves device and get an iex shell. Is there a way to drop into a regular shell from there?

The short answer is that you can, but we’ve had such bad experiences doing this that many of us are reluctant even to help others go down this path.

I’ve also learned that it’s an impossible task to convince anyone not to try this route since it’s so familiar and doesn’t feel that bad in the beginning.

So here are some options:

  1. Update your erlinit.config to run sh on exit. Then connect to the console, exit the Erlang VM and you’ll be in Busybox ash. This works the best, but probably isn’t what you want.
  2. See This project isn’t maintained (well, not today). This is probably the closest to what you want. If you spend time getting it working, could you send a PR back to update the docs? The information about adding +Bc to vm.args is out of date and there might be more.
  3. Switch to Raspbian (I’m assuming that you’re using an RPi). Bash and Elixir work great there. You’ll miss out on some aspects of Nerves, but if your project really needs bash, I think that you’ll save time by not fighting it.

I’m realizing that after I wrote this that I didn’t ask “why” you wanted a regular shell. Could you post what is making you go down this route? Maybe it’s an easy fix.


Thanks! Great info. And great work on the transition to nerves_pack.

I really don’t have a need for this in my project, just that it would make things easier during development of my all powerful custom system, so Ash may fit my needs.
I also discovered :os.cmd/1 which is a little easier than System.cmd/3

cmd from Toolshed might be worth trying out also.

Toolshed is added by default but you’d need to run use Toolshed in the shell to use everything easily.

1 Like

I created GitHub - SteffenDE/nerves_ssh_shell to allow connecting to a shell on nerves devices using SSH. This allows to use interactive programs like vim, htop, etc. (assuming they are included in the system or downloaded as static binary). I’m currently using this to interactively attach to docker containers running on nerves and it works great so far.