"shutdown -p now" reboots the system

Hi all,

I'm running FreeBSD 9.1-RELEASE (amd64) and I'm encountering the following situation, when I'm trying to shutdown the PC with the command shutdown -p now instead of switch off the computer it reboots it. After the restart the command works without problems and I can shutdown normally. The same issue with normal user and root. It's strange that it does not happen every time.

Here is the output from uname:

Code:
FreeBSD beastie.local.lan 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #7: Mon May 13 22:39:35 EEST 2013     [email]root@beastie.local.lan[/email]:/usr/obj/usr/src/sys/BEASTIE  amd64

Any ideas will be welcome.
Thanks in advance.
 
hiv_ said:
Hi all,

I'm running FreeBSD 9.1-RELEASE (amd64) and I'm encountering the following situation, when I'm trying to shutdown the PC with the command shutdown -p now instead of switch off the computer it reboots it. After the restart the command works without problems and I can shutdown normally. The same issue with normal user and root. It's strange that it does not happen every time.

Here is the output from uname:

Code:
FreeBSD beastie.local.lan 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #7: Mon May 13 22:39:35 EEST 2013     [email]root@beastie.local.lan[/email]:/usr/obj/usr/src/sys/BEASTIE  amd64

Any ideas will be welcome.
Thanks in advance.

Did you try -P? I mean #shutdown -P now
 
hiv_ said:
I'm running FreeBSD 9.1-RELEASE (amd64) and I'm encountering the following situation, when I'm trying to shutdown the PC with the command shutdown -p now instead of switch off the computer it reboots it. After the restart the command works without problems and I can shutdown normally. The same issue with normal user and root. It's strange that it does not happen every time.
Powering off is a cooperative effort between the PC's BIOS and FreeBSD. In a normal shutdown -p, at the end of shutdown FreeBSD tells the BIOS "I'm done, please turn off". Similarly, a brief tap of the physical power button normally causes the BIOS to tell FreeBSD "user wants to shut down", causing an orderly shutdown. That power button function can sometimes be redefined in the BIOS.

As I've mentioned BIOS a number of times, you can probably see where this is going - check with your system / motherboard manufacturer to make sure you're running the latest BIOS version, and if not, update.

If it still doesn't work properly, try changing the hw.acpi.disable_on_reboot and/or hw.acpi.handle_reboot tunables with sysctl. Refer to the acpi(4) documentation for details. If it still doesn't work, try booting with acpi disabled (boot menu option) as an experiment. That will likely have other unacceptable-for-normal-use interactions, but can be used for testing to see if there's anything FreeBSD can do to get your system power-off to work reliably. If that fixes it, further experimentation can narrow down where the issue is in acpi(4).
 
Thanks guys for your support.

Well, the motherboard is AsRock Z77 Pro3 and it has the latest BIOS version, and no OC options.

Terry, do you think that changing the hw.acpi.disable_on_reboot and/or hw.acpi.handle_reboot could help when I'm trying to shutdown the computer?
 
hiv_ said:
Terry, do you think that changing the hw.acpi.disable_on_reboot and/or hw.acpi.handle_reboot could help when I'm trying to shutdown the computer?
I don't know. I suggested those based on a reading of the code and the manpage. I'm not an ACPI expert by any means. You can probably find more knowledgable people at freebsd-acpi@.
 
That's the same as running
Code:
shutdown -p now
. FreeBSD's init(8) does not actually have run levels like the SYS V init in many Linux distributions, they are emulated and the same effects can be achieved by sending various signals to process number 1 as described in the manual page.
 
Usually the "shutdown -p now" works very well, and only sometimes the problem occurs that's confusing me.
I'm going to read about ACPI maybe I can find something.
 
@kpa, oh, OK. I come from Linux background, and I thought it's actually two different commands.

My friend was using Arch Linux for a while, and his shutdown broke, so I told him to use # telinit 0 && sleep ... for a while, until the smoke cleared.

@hiv_, you could have a hardware problem. When was the last time you cleaned your computer? If the problem isn't regular, it could be due to computer power supply failing. If you have dual boot option, does this problem occur on other operating systems as well?
 
Last edited by a moderator:
@jozze, yes, I have a dual OS system, but the second OS (Win7) I use very rarely, I like too much the FreeBSD, so didn't notice any problems with it.

The power supply is an old (5 years) Seasonic S12 430W, any suggestions how to test it?
 
Last edited by a moderator:
Sorry, I don't really know how to test it, but you can try to compare with Windows. Boot "Windoze", open like 10 videos on youtube, let them play for a few minutes, and try to shutdown. Repeat ~10 times and see if you have the same problem there.

I'd recommend cleaning your computer thoroughly. When is the last time you did that?

Some instructions on how to do it can be found here, but some of them are a little over the top :D (e.g. alcohol, water, ether ...); if you stick to brushes and vacuum/compressor you're going to be fine. Just make sure the ventilators won't spin when you use the compressor on them -- if they spin too fast, the motors can break.
 
There is another possibility of being a FreeBSD problem. When you order a shutdown in FreeBSD, and it has this anomalous behavior, does the kernel send you some weird messages? They are saved in files /var/log/messages*. If there is something wrong, like your shutdown caused a kernel panic, then the FreeBSD default is to reboot (and not to shutdown). Some interesting data should also be in /var/log/dmesg*.

This could happen if you plugged in some USB device and then removed it, when the computer was in fact still using it. Somewhere on this forums I read, that the computer was running without a problem, until shutdown was invoked, which later caused a kernel panic, and consequently a system reboot.
 
hiv_ said:
@jozze, yes, I have a dual OS system, but the second OS (Win7) I use very rarely, I like too much the FreeBSD, so didn't notice any problems with it.
I agree with @jozze here that booting Windows 7 might actually help determine if something is wrong with the computer; Windows is quite picky when it comes to hardware. Some (brief) things you could do when you booted Windows 7 to look for "signs of oddities".

Heavily offtopic, so I'll keep it brief. I'm also not going to dive into this in here, if you do need more information about this stuff then feel free to send a private message.

The easiest way is using Win-R (if you have a keyboard with a Windows button), enter compmgmt.msc and hit enter. Here you'll have everything you may need in one place. You can use the event log viewer to check if something odd was detected on your system ("Windows Logs -> System"). The device manager will mark any hardware component which it couldn't properly access (either because it has no available driver or something is wrong).

You can also move over to disk management to check if everything looks normal there as well; all partitions on your disk will be normally marked as "Healthy". Although this doesn't tell you too much it sometimes can provide a good hint if your HD's are causing issues.

If you don't have a "Windows keyboard" then the easiest way is to open a DOS or console prompt and then simply enter compmgmt.msc there to start it.

Hope this can help too.
 
Last edited by a moderator:
Thank you all,

I'm a little busy with exams now, but in the next days I'm going to check/test with Win7 maybe I'll find something helpful.

Regards,
 
Hi all,

Let's keep you informed.

Well, I didn't have time to test with Windows OS, but I've looked into System logs and Device Manager and it seems to be quite normal, nothing to be suspected. Meanwhile, I did notice that the issue appears when the system with FreeBSD is used more that 9-10 hours continuously. The most applications used: Deluge, Firefox, VLC, Pidgin, DeadBeef...

Below I've attached the output from /var/log/messages, after the system started the shutdown:
http://pastebin.com/ic9sXGji

and dmesg:
http://pastebin.com/WRBGfA6L
 
Everything seems ok, but these lines in your [cmd=""]dmesg[/cmd] report seem suspicious
Code:
osscore: Overflow 1196032+65536, 1193984
osscore: Overflow 2807808+65536, 2805760
osscore: Overflow 194560+65536, 192512
osscore: Overflow 1468416+65536, 1466368
osscore: Overflow 1548288+65536, 1546240
but may not be the problem, since your /var/log/messages indicates your system shut down cleanly (I hope this report comes from a dirty shut down). Still, next time, try closing all your programs before initiating a call to shut down, and let us know if it helps. If it does, it could indicate there are some problems with your sound modules.

In any case, study hard, so you'll be able to relax later, and follow or make research on the existing suggestions. Have fun and all the best!

Cheers,
Jože
 
Back
Top