Well, I found the problem. It turns out to be a very old bug, first observed late 2009. If you look in /etc/rc.d/rc.shutdown, there is a comment dated 2009-11-17:
#091117 weird shutdown bug. would not shutdown when a partition mounted, x restarted.
Testing in Wary, with a partition mounted, the shutdown process went through, but at the point where it should power-off, it rebooted.
Back in late 2009 I seem to have put in a workaround, without understanding what caused the bug. This time, I have tracked it down.
The code 'fuser -m /dev/sda5' (for example) does not work as I expected. I wanted all of the processes that are running in /dev/sda5 when it is mounted, but this example returns a heap of processes, some of which if you kill them, upset things very much, hence the wonky shutdown.
Instead, it has to be done by the mount-point 'fuser -m /mnt/sda5'.
Here is fixed code for rc.shutdown:
#091117 110928 if partition mounted, when choose shutdown, pc rebooted. found that param given to fuser must be mount-point, not /dev/*...
STRAYPARTL="`echo "$MNTDPARTS" | grep ' /mnt/' |grep -v -E '/dev/pts|/proc|/sys|tmpfs|rootfs|on / |/dev/root|usbfs|unionfs|aufs|/initrd'`"
STRAYPARTD="`echo "$STRAYPARTL" | cut -f 1 -d ' ' | tr '\n' ' '`"
STRAYMNT="`echo "$STRAYPARTL" | cut -f 3 -d ' ' | tr '\n' ' '`"
for ONESTRAY in $STRAYMNT
echo "Unmounting $ONESTRAY..."
xFUSER="`fuser -m $ONESTRAY 2>/dev/null`"
[ "$xFUSER" != "" ] && fuser -k -m $ONESTRAY 2>/dev/null
umount -r $ONESTRAY
Comments:Posted on 28 Sep 2011, 20:52 by K Godt
Former fuser had the '-c' option for /dev/sda5
but now it seems that the '-c' option is not part of fuser anymore .
I am not at wary|racy but on an derivate which contains a 'fuser -V 22.11' and the '-m' option seems to cover there both :
-m,--mount show all processes using the named filesystems or block device
On macpup foxy 3 I changed it to
echo "Unmounting stray filesystems:"
STRAYPARTL="`echo "$MNTDPARTS" |grep -v -E "/dev/pts|/proc|/sys|tmpfs|rootfs|/dev/root|usbfs|unionfs|/initrd| on / "`"
STRAYPARTMP="`echo $STRAYPARTL | cut -f 3 -d " " | tr "\n" " "`"
for ONESTRAYP in $STRAYPARTMP
echo -e "\e[1;31mUnmounting $ONESTRAYP...\e[0;39m"
ONESTRAY=`busybox mount | grep "$ONESTRAYP" | cut -f 1 -d ' '`
fuser -v -k -c -m $ONESTRAY
and will look for the output there once again .
Nevertheless this could explain why Racy also rebooted on my side instead to poweroff .
First I had thought I had hit the wrong button in the menu or that I would have to boot the 126.96.36.199 kernel with other [acpi]parameters , or I would have to adjust the settings in the BIOS .
Posted on 18 Feb 2012, 17:05 by n89rt76
I had a similar problem with Wary 5, frugal/saved straight to fs: asking it to shutdown would reboot.
Debugging the rc.shutdown showed that just before the end it was attempting to kill all processes still using the disk. The first of those processes is invariably the shell of the rc.shutdown itself, so the script self-terminates and never gets to actually shut down.
Commenting out the kills fixed it for me.