0

I'm running ubuntu 18.04.1 LTS on an embedded "automotive" computer that's powered with 12VDC (no AC!). It has 3 power inputs: Power (12V), Ground and something labeled "ignition." When "ignition" goes low, I need the computer to immediately (within 10 seconds) start its shutdown because the 12V will go away shortly (after 30 seconds or so). I assume "ignition" is like a soft power button or maybe laptop closed or something similar.

I used to run Fedora Core 20 and the computer DID automagically shutdown when ignition went low exactly like I needed it to.

With ubuntu 18.04.01, this generally doesn't work in that the shutdown process doesn't happen either at all or at least not until the 12V goes away and the computer shuts off ungracefully without getting to shutdown first.

There are 3 cases with ubuntu 18.04.1 on my computer: 1. Monitor attached, logged in: a dialog with the message "The system will power off automatically in 60 seconds" pops up and starts counting down the 60 seconds. Unfortunately, there's only power for about 30, so it powers off ungracefully without shutting down. 2. Monitor attached, not logged in: computer starts shutdown and shuts down after a few seconds as desired when ignition goes low. 3. Monitor not attached: shutdown doesn't happen (prior to 12VDC going away).

I specifically need to get it to work for case (3.) (Monitor not attached) since there can't be a monitor in the actual embedded application.

Because it works for case (2.), it must be possible but I have no idea what config files to look at or what to change.

  • I don't have an Ubuntu to check, but you might find something to configure in /etc/systemd/logind.conf which is part of systemd. See man logind.conf and try setting PowerKeyIgnoreInhibited=yes for case 1. – meuh Nov 13 '18 at 17:18
1

The following ended up working.

I created the file /etc/acpi/events/PBTN with the following contents:

event=button/power PBTN 00000080 00000000
action=/etc/acpi/actions/power-button.sh %e

I created the file /etc/acpi/actions/power-button.sh (with execute permission) with the following contents:

halt -p
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.