I have been struggling with the similar issue on Macbook Late 2007 (white). Tried with Lubuntu, Fedora and Ubuntu 22.0.4. All these os has the similar issues of Hanging/Freezing during Shutdown. It's been frustrating to turn off by removing the battery every time. I am using this Laptop in an unattended mode (remote turn and turn off). I suspect there are some services which are blocking the shutdown and the machines freezes with the spinning of the fan in full blast. Eventually it will end up draining the battery to 0.
I wrote a script which will help to do a clean shutdown.The trick is to reboot the system and inject a script to properly shutdown.
Steps :
- Created a cronjob with the following
@reboot /home/nirmal/shut.sh
- Used the following script to check for the flag
#!/bin/bash
#Ignore this line as this is for turning on remotely via AC adapter
#sudo /usr/bin/setpci -s 0:1f.0 0xa4.b=0:1
flagValue="`cat /home/nirmal/shutflag.txt`"
if [ "$flagValue" -eq "1" ]; then
echo 2 > /home/nirmal/shutflag.txt
else
echo 1 > /home/nirmal/shutflag.txt
echo "Shutting down"
shutdown now
fi
- Whenever I want to shutdown, i will issue a reboot command remotely via ssh.
This way problem solved of hanging issue during shutdown.