# shutdown cause system reboot



## razor (Aug 10, 2022)

Hello everyone, I just installed FreeBSD-13.1-release on my Lenovo m93p desktop computer.




I found shutdown -p now  cause system to reboot.

I have refer to these threads:


> Solved - poweroff reboots computer (usually)
> 
> 
> Linux and Windows both power off my desktop consistently, but FreeBSD 10.2-RELEASE does so only once in a dozen tries or so. The rest of the time it reboots. I've had this problem since the install was fresh. I've used poweroff and shutdown -p now. I assume this is some ACPI bug in my BIOS, but...
> ...





> Solved - Mainboard restarts by itself after FreeBSD shutdown
> 
> 
> I'm setting up a Shuttle SX79R5 Mini-PC as a FreeBSD server. I observe the following irritating behavior with FreeBSD 12.x and 13.0-RCx: After a shutdown of FreeBSD (ACPI-triggered, or by running shutdown -p now), the motherboard turns off for about 3 to 5 seconds, and then boots up again.  I've...
> ...





> Handbook: 12.13.2.5. System Powers Up After Suspend or Shutdown


and set:


> hw.efi.poweroff=0 in /etc/sysctl.conf





> hw.acpi.disable_on_poweroff="0"(also test "1") in /boot/loader.conf


but not work.

Today I found that turning off the Wake-on-LAN in bios can shut down normally.

If do not turn off the Wake-on-LAN , system can also shut down normally by inserting a USB flash drive.

I need the Wake-on-LAN function, how can I troubleshoot the problem?


----------



## richardtoohey2 (Aug 10, 2022)

Might not help but have you checked for BIOS updates from Lenovo?


----------



## drhowarddrfine (Aug 10, 2022)

If you need wake on lan then wake on lan is doing what it's supposed to do.


----------



## mer (Aug 10, 2022)

drhowarddrfine said:


> If you need wake on lan then wake on lan is doing what it's supposed to do.


I think one should also figure out why it's waking on lan too.  Does the BIOS allow you to specify a specific pattern for WoL?  If not, then any simple traffic will wake the pc up.


----------



## Erichans (Aug 10, 2022)

drhowarddrfine said:


> If you need wake on lan then wake on lan is doing what it's supposed to do.


I'm unclear as to what you are referring, could you please elaborate?

Normally Wake-on-LAN or wol(1) is technology based on a low-level network packet known as the _magic packet_ that is being broadcast from a source with a specific MAC address as target. That MAC address is the unique MAC address of the NIC of the target device. When that device is capable and has its Wake-on-LAN property enabled accordingly for that NIC, it will then "awake" the device in response to that broadcast. Just being on a local network where there is traffic should not awake such a device.


----------



## mer (Aug 10, 2022)

Erichans said:


> Just being on a local network where there is traffic should not awake such a device.


That's kind of what I was getting at, but perhaps the BIOS implementation is broken and any packet is causing the wakeup.


----------



## Denis Shaposhnikov (Aug 10, 2022)

Hi,


razor said:


> I found shutdown -p now cause system to reboot.



I got the same problem after upgrade to 13.1. Looks like today I fixed it by disabling all weakup events in the BIOS, especially weakup by USB.


----------



## drhowarddrfine (Aug 10, 2022)

Erichans  What I was getting at is wake on lan is a setting in the bios. Did he turn that off?


----------



## Phishfry (Aug 10, 2022)

Also check BIOS for Watchdog Timer. Disable if found.

What you need to be doing is finding the WOL server sending these magic packets.
Why is it constantly sending magic packets.
This is the root problem. A WOL server you need to reconfigure or control.
I am slighly doubtful WOL is the culprit. Especially when you mention USB stick solves it.


----------



## razor (Aug 11, 2022)

Thank you for all kind reply.
Today, when I unplug the network cable, set WOL to "primary" or "automatic", and it will restart automatically. Only when WOL is set to "disable", can be shut down normally, which eliminates the possibility of the host being woken up by magic packets from the intranet.
I will try to upgrade the bios, if the problem still occurs, it may only be a system problem.


----------



## Erichans (Aug 11, 2022)

"Today, when I unplug the network cable, [...]"
That is a good test, however, be sure that wifi is also disabled/disconnected. Do you know the exact type of your Lenovo? Try to search for the official User Guide if you don't have one; it may have some useful information about WOL settings (it is at least covered in a laptop P50 User Guide).

I don't know if you've dedicated your PC to FreeBSD or still have a Windows or other OS available; I'm curious what behaviour your system will show when another OS shuts down. I'm also somewhat doubtful, as Phishfry, that the WOL setting is the culprit, we'll see.


----------



## razor (Aug 12, 2022)

Hello everyone.
I upgraded the bios from 2013 to 2021 today and the problem was solved.
Maybe the original bios version is too old.

Turn on WOL and connect cable, use `shutdown -p now` can shut down host without rebooting.


----------

