Solved System hangs after 'poweroff' command instead of turning off

Hi guys,
There is a script which runs on a crontab that is used to automatically shutdown my system when the utility power goes off. It uses the poweroff command

Usually it does this correctly and the system shuts down. However, I noticed that sometimes, the system just hangs without completely powering down. All the services seems to be down and it doesn't respond to network pings etc but it remains in on state instead of shutting down.

Any pointers on resolving this would be really helpful. Is there any log file that I could check etc?
 
+1

My HTPC system (AM1B-ITX board, AMD Sempron, RTL8111/8168/8411 network card) never power off from command line. The system goes into a shutdown sequence, but the computer does not shut down. The last lines from system console are like:

Code:
...
jails shutdown
services shutdown
...
uptime xxxxxx
re0 link DOWN
re0 link UP
 
There is a script which runs on a crontab that is used to automatically shutdown my system when the utility power goes off. It uses the poweroff command ... sometimes, the system just hangs without completely powering down. ...

The last action the OS does before shutting down is synchronizing the I/O buffers with the disks. On slow machines with huge file systems this may take it's time. In the past I had problems with a system which took longer for syncing disks than the configured time before the UPS powers off as well. Long (perhaps never ending) disk synchronization may indicate problems with one or some of the attached file systems.

In case of UFS, as user root you want to run fsck -fy /dev/<disk identifier> on all volumes mounted on your system. The volumes need to be read-only, though. So either start your system in single user mode, or bring the respective volumes to read-only using mount -fr. For example as superuser do:

# mount -fr /
# fsck -fy /dev/gpt/rootfs
***** FILE SYSTEM IS CLEAN *****
# mount /
 
Are you using FreeBSD 10.3? I had a similar issue with specific motherboards. The problem was that when I type "reboot" it hang at the last state before reboot. If I type "shutdown -r now" then it reboot successfully. If it's the same issue, it was fixed in 11.1 (maybe 11.0 too), but they didn't backport the fix to 10-STABLE.
 
Is there one or more external USB disks attached? I sometimes get it too, it'll hang on "All buffers synced" and refuse to shutdown or reboot. Adding this to /etc/sysctl.conf usually helps:
Code:
hw.usb.no_shutdown_wait=1
 
Back
Top