I’d like to use my BBB as a king of “Network Appliance” (do secondary DNS, LDAP, RADIUS, probably CUPS, …). I don’t want it to run 24/7 but rather start it up when I power up my WLAN AP and shut it down just before I power down the AP. It won’t have kb/mouse/serial Konsole, so just pressing the Power Button should should it down cleanly.
I tried with Angstrom, updated to the latest available code (last weekend). As long as Gnome is running, pressing the Power Button on the BBB presents the Shutdown-Dialog. However, after disabling gdm the Power Button does not do anything; I tried to press short, long, longer and even much longer, but the BBB shows no signs of powering down.
My Idea is, to connect a Switch to one of the GPIO-Ports and write a short program that polls that specific port, and, when the Port becomes high, initiate a Power down. But I hate to do that, as the BBB does have a dedicated Power Button, after all. However, while searching for a solution I didn’t find anything of real help
So, is there a “clean” way to shutdown a headless BBB using the Power Button? I would not mind to use a different Linux than Angstrom…
The power button connects to the Non-Maskable Interrupt of the processor. So, unless you modify the code in a way to handle it, I doubt moving to a GPIO pin will solve your issue.
I’ve been playing with a few BBBs for embedded applications where gdm is way too much baggage. I’ve been using the console-image instead of the gnome-cloud9 image. The console image never installs gnome in the first place and the power button works normally. A side effect is that you will have a compact installation with typically more than 1.5G of free space. You would need to manually install some things (that come pre-packaged with the big image) as you need them with opkg.
If you use bonescript, this might not be the answer for you, but if you are developing with c, cpp, or python – it might be an attractive alternative.
Another way to avoid doing any hardware mods is to have a service running that just idles for say, the first 5 minutes after power-up (so that you are sure that network is up by then). Subsequently, have your service “ping” your AP gateway every few minutes. When the pings start to fail, do a shutdown. This way, when you power down the AP, the BBB will power down soon after.
(BTW ---- Gerald: Doing a Linux “shutdown -h” would do the same thing that the NMI would do, so system software already has the capability to support his GPIO polling initiated system controlled power-down, should he wish to go that route.)
Yes, that is correct. But the question was based on this function not being available due to the GDM disabling event.
was not very clear about my Idea re. the GPIO Pin; which was, as Angstrom w/o a running Gnome -at least on my BBB- simply seems to ignore the Power Button, to write a short C-Program that polls the status of a defined GPIO-Pin every ~100ms. When it detects that the Pin is high it stops cycling and issues a telinit 0. I did this for a Raspi, it does work, but found that “solution” far to kludgy to use in real-life - and bought a BBB, which offers a nice Power Button. That’s why I’d like to get the real Power Button to work in a headless System, too.
thanks, that sounds GREAT! Will give the console-Image a try! Sounds actually much better for my purpose than the “big” one
There is a chance that ‘telinit’ might not work on the BBB, since it uses systemd instead of init.d. Try it. If it does not work, “shutdown -h” should do the trick.
This statement is incorrect. BBB does not use systemd rather than init.d,
the distribution that is normally used on the BBB uses systemd rather than
init.d. In particular Ubuntu uses systemd, as it does if you run Ubuntu
on a PC.
If for instance you were running Debian, it still uses init.d. I do not
know what Angstrom uses.
Just a little off....
Angstrom = systemd
Ubuntu = upstart
Debian = sysvinit
True. The important thing is that it is not the BBB that determines what
runs, but rather the distribution that you run on the BBB (or any other
Thanks guys. It is probably good that you stepped in for those that find this thread later. Ralf and I were both talking Angstrom, and it is understood that the chaining system is really dependent on the distribution, not the HW.
It’s pretty easy to create your own image. If you look in ./sources/meta-ti/recipes-misc/images/, you’ll see the image recipes. If you make a copy of cloud9-image.bb to say “mybbb-image.bb” and edit the INSTALL_IMAGE package list accordingly, change the IMAGE_BASENAME and you can build it with:
You can also use the recipes in ./sources/meta-angstrom/recipes-images/angstrom if you want to base it off the console-image, but I found cloud9-image has all of the wifi drivers included.
NOTE: I’m sure there’s a better place to put mybbb-image.bb than in the meta-ti folder, but I don’t know where that would be!
thanks for that hint - sounds promising. Will have a look into that @weekend!
Thanks guys. It is probably good that you stepped in for those that find
this thread later. Ralf and I were both talking Angstrom, and it is
understood that the chaining system is really dependent on the
distribution, not the HW.
I suggest to change the key mapping of the power-down-button to send
ctrl-alt-del instead of power down. This makes it much easier to power
down boards with conventional init systems instead of systemd.
Below is a patch for the 3.8 kernel (pasted, so the format might be wrong)
From 29b14f2aea96f759a2be7ccbaf92d935f2e0440e Mon Sep 17 00:00:00 2001
really cool idea; I might try this shouldn’t the console-image (due to be put onto my BBB @weekend) provide me with a “working” Power Button!
sorry, took a while… I built a “console-image” that weekend, using the Docs on the Angstrom/OpenEmbedded Pages, using MACHINE=beaglebone. Now, the Image built and boot fine off SD-Card. However, while the Power-Button work better than before it still does not work as I’d like Regardless of Power Source (USB or the 5V Jack) a short Press causes no Action. A long (multiple secs) Press causes a immediate Power-Off (that’s the improvement against the default Image).
I there a a special Kernel-Module I might need to load/build? Is there a better Machine than plain “beaglebone”?
It sounds like you are, at least, experiencing the documented behavior of the pwr button now. You need to hold it down for a few seconds until the pwr LED goes out, but if you keep holding it down after that, the card will reboot.
What is the desired behavior? Is it that you want to push the button momentarily, and that would cause a controlled shutdown? If so, I think you have three options:
Find the kernal module that processes non-maskable interrupts and work on that. I personally think this is a very aggressive move, and there are easier paths.
Add a small amount of additional hardware to support this function. You would a need hardware latch (activated by your own button) that would pull the pwr button line low, but release it when the pwr LED goes out. This could be accomplished perhaps simply by powering your latch from VDD_3V3AUX. Alas, there is a simpler path in #3…
It would not be hard to write a system service that would monitor a regular GPIO pin and do a ‘shutdown -h’ when that pin was pulled low. This has been discussed previously in the thread. You would need to write just a few lines of code in whatever language you are comfortable with. You could even script it with python. There are descriptions of how to kick off your app as a systemd service around (you do not need to look very hard). It is easy. You could have this done before bed-time.
thanks a lot for the Info! My expected behaviour was a controlled shutdown upon a short press and a forced power-off upon a long press (similar to the ACPI-Power Button on PCs). So, I’ll take the short C-Program I wrote for the Raspi and make it work on the BBB instead of using the built-in Power Button…
just a short update in this: I installed Debian in my BBB and found, by a post a pal found for a Cubieboard, that installing the 'acpid' package (and of course running the acpid) made THW power button work a+ in my headless BBB. I thought ACPI was x86 only - but as it works nicely i won't complain.
Just wanted to post here for completeness.