# Shutdown results in reboot



## jbo (Nov 24, 2021)

I just got my hands on a fresh Lenovo ThinkPad X1 Carbon Gen 9. I installed FreeBSD 13.0-RELEASE on it. When I execute `poweroff`, the system does shut down but it immediately boots again afterwards.

TPM and most other stuff is disabled.

Any ideas?


----------



## eternal_noob (Nov 24, 2021)

Does it do the same with 14.0-CURRENT?


----------



## T-Daemon (Nov 24, 2021)

Have a look at the sysctl(8) `hw.efi.poweroff` oid.


----------



## jbo (Nov 24, 2021)

T-Daemon said:


> Have a look at the sysctl(8) `hw.efi.poweroff` uid.


Setting that to false did the trick.
While looking at this option I came across this relevant thread (for reference): https://forums.freebsd.org/threads/mainboard-restarts-by-itself-after-freebsd-shutdown.79614/
Given that this is enabled by default; what are the downsides/disadvantages of going through good old ACPI instead of using EFI for poweroff?



eternal_noob said:


> Does it do the same with 14.0-CURRENT?


I don't know


----------



## Minbari (Nov 24, 2021)

Did you try `shutdown -p now`?


----------



## GogoFC (Nov 30, 2021)

Same thing on my Elitebook 840. 

init 0 doesn't restart unless I close the lid, then it boots again , i have to wait a bit and then close it.

Isn't power off just init 0?


----------



## SirDice (Nov 30, 2021)

GogoFC said:


> Isn't power off just init 0?


No, `init 0` halts the system. `shutdown -p now` powers down the system:

```
-p      The system is halted and the power is turned off (hardware
             support required, otherwise the system is halted) at the
             specified time.
```


----------



## jbo (Nov 30, 2021)

Minbari said:


> Did you try `shutdown -p now`?


Yes, that resulted in the same behavior (booting again after shutdown) unless `hw.efi.poweroff` is set to `0`.


----------



## SirDice (Nov 30, 2021)

```
Calling “poweroff” is equivalent to running:

           shutdown -p now
```
poweroff(8)



jbodenmann said:


> Yes, that resulted in the same behavior (booting again after shutdown) unless `hw.efi.poweroff` is set to `0`.


Need to try this on a one test machine I have. It has the uncanny habit of turning itself back on after a `shutdown -p now` too.


----------



## yjqg6666 (Nov 30, 2021)

*@*jbodenmann *   "shutdown -p now"* works on my X1 carbon Gen 9 machine.


----------



## jbo (Nov 30, 2021)

yjqg6666 said:


> *@*jbodenmann *   "shutdown -p now"* works on my X1 carbon Gen 9 machine.


Well, not to be nit-picky but it also works on my machine - it just boots again after successfully shutting down 

I do however assume that in your case the machine does not boot up again?
What's the value of `hw.efi.poweroff` on your machine?


----------



## Tieks (Nov 30, 2021)

jbodenmann said:


> it just boots again after successfully shutting down


Mine shows that same behaviour depending on a BIOS setting. It's a setting named 'AC back' under the power managemant options. It determines what happens when power comes back after a power loss. It has three options. The first is 'memory, the system returns to its last known awake state' (according to the booklet). This option gives the behaviour that you describe. The other options are 'always on' (switches on when power returns) and 'always off' (stay off when power returns). The latter is the default. You may have some similar options in your BIOS.


----------



## grahamperrin@ (Dec 2, 2021)

Tieks said:


> … when power comes back after a power loss. … 'memory, the system returns to its last known awake state' (according to the booklet). This option gives the behaviour that you describe. …



_Is_ there loss of power in this case?


----------



## Tieks (Dec 2, 2021)

grahamperrin said:


> _Is_ there loss of power in this case?


No. Command `shutdown -p now` will indeed switch off, and then back on again after 1-2 seconds. It seems to do what the manual says, return to its last known awake state. The other options work as expected.


----------

