reboot after power failure for Mac mini running Ubuntu

Solution 1:

On some Mac Minis (I tested on one circa 2014) it still seems to be:

sudo setpci -s 00:1f.0 0xa4.b=0

I verified this after some research. The steps I took to find out, which theoretically can be done for future iterations of these machines too, were:

  1. Look for the LPC device:

    $ lspci | grep LPC
    00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04)
    

    In this case, it's 00:1f.0.

  2. Find a datasheet for the device. E.g. Googling for "intel hm77 lpc controller datasheet" yielded this datasheet.

  3. Now you just have to find the right register, which could be a challenge depending on the data sheet. Here I found "5.13.7.5 Sx-G3-Sx, Handling Power Failures, p. 180" in the table of contents, which describes the control bit AFTERG3_EN.

  4. Searching through the document for that, we find it in section 13.8.1.3 (general PM config register 3) at the bottom of the table on page 530. From this we see it is bit 0 of the 16-bit register at 0xA4.

Then that can be used to construct the relevant setpci command.

So if this changes again in the future, find the device, find the datasheet, construct the command, test, and raise your fist in victory.

But basically the device and register address may differ on different machines, it's specific to the LPC controller; so that's the piece of hardware you have to check first before determining which command to use.

Solution 2:

I found the answered buried in this post. The new setpci command is

sudo setpci -s 00:03.0 0x7b.b=19

btw, this setting isn't "sticky" and won't persist across reboots-- it has to be set upon each boot.

You can put this command in a bash script and run it on startup. See here for details on start-up scripts.