LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   opensuse 11.3 won't power off (solved) (https://www.linuxquestions.org/questions/suse-opensuse-60/opensuse-11-3-wont-power-off-solved-830802/)

avalosdanielr 09-07-2010 12:03 PM

opensuse 11.3 won't power off (solved)
 
I have just installed opensuse 11.3 on my box and it refuses to shut down. It shows a tty screen with the message "power down" but wont power off. After searching the web I found no solution until I compared the "halt" scripts of versions 11.3 and 11.2 (they are located in /etc/init.d). Both scripts differ only by a couple of lines that make reference to raid devices. As I am NOT using any RAID array in my BIOS, I copied my halt script (version 11.2) on top of the version 11.3 halt script and my box started to shut down and power off nicely!... At least for me it worked!!

EricTRA 09-08-2010 12:25 AM

Hello,

Thanks for sharing your solution. Off the Zero Reply List.

Kind regards,

Eric

charesnape 09-18-2010 03:17 PM

I have the same problem with my Toshiba Satellite L100-170 laptop. I've just been unplugging it to let the battery go flat. I know this isn't a good idea.

I'm a Linux newbie. How do I try out changing this script to see if works for me?

avalosdanielr 09-19-2010 04:50 AM

I have been using opensuse since version 9.1. I keep in my hard disk two partitions one with the last version of opensuse (11.3 at this time) and the other with a previous version (11.2). "halt" script is a very small executable program (about 6 KB) that resides in /etc/init.d directory. I can't tell you how easy is to find that script in the web or in the repositories because I have never done such a search.

At present it occurs to me two solutions:

1) Download 11.2 from the web. Burn the iso to a CD and extract the script from there. I think it is a lot o work for an uncertain solution to your problem.

2) I can send you the script "read only" (permissions 444 or r--r--r--), you can read it and compare with yours, and once you are satisfied, then (in a terminal logged as root), you make the 11.2 script executable (or rwxr-xr-x) by typing

chmod 755 halt,

change ownership to root, by typing

chown root:root halt,

rename your script to something like "halt.11.3" and copy the 11.2 script to /etc/init.d. That way if it does not work for you, you will be able to restore the original 11.3 script.

By the way, you don't need to let the battery go flat to turn your laptop off. After shuting down, press the start button for more than 4 seconds and it will turn off.

Good luck, and welcome to linux!..

charesnape 09-23-2010 04:34 PM

Hello

sorry for the delay... I've been dealing with a few other problems!

Here is the halt script from 11.3

#! /bin/sh
# Copyright (c) 1996-2008 SuSE Linux Products GmbH, Nuernberg, Germany.
# All rights reserved.
#
# Author: Florian La Roche, 1996
# Werner Fink <werner@suse.de>, 1996-2008
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/halt (and symlinked to reboot)
#

. /etc/rc.status
. /etc/sysconfig/boot
. /etc/sysconfig/shutdown

test -s /etc/sysconfig/bootsplash && . /etc/sysconfig/bootsplash
test -e /proc/splash || SPLASH="no"
test -x /sbin/splash || SPLASH="no"

#
# Avoid being interrupted by child or keyboard
#
trap "echo" SIGINT SIGSEGV SIGQUIT SIGTERM
set +e

case "${0##*/}" in
*halt)
message="The system will be halted immediately."
arch=$(/bin/uname -m)
command="halt"
mddev=""
opts=""
#
# Sysvinit's shutdown is knowning about the option -P and -H to set
# the environment variable INIT_HALT within init for the runlevel 0.
# If this variable is not set we use the system default.
#
if test -z "$INIT_HALT" ; then
case "$HALT" in
[Pp]*) INIT_HALT=POWEROFF ;;
[Hh]*) INIT_HALT=HALT ;;
*)
INIT_HALT=POWEROFF
#
# Check this if valid for AMD/Intel based systems
#
case "$arch" in
i?86|x86_64)
if test -e /proc/apm -o -e /proc/acpi -o -e /proc/sys/acpi ; then
INIT_HALT=POWEROFF
else
INIT_HALT=HALT
case "$(rc_cmdline apm)" in
apm=smp-power-off|apm=power-off) INIT_HALT=POWEROFF ;;
esac
fi
;;
esac
;;
esac
fi
#
# The manual page of shutdown utilizes POWEROFF whereas in
# the code the word POWERDOWN shows up for the option -P.
#
case "$INIT_HALT" in
POWEROFF|POWERDOWN)
opts="${opts:+$opts }-p" ;;
esac
#
# Sometimes wake-on-lan isn't wanted, if so stop network
#
if test "$HALT_NETWORK" = "yes" ; then
opts="${opts:+$opts }-i"
fi
#
# Sometimes it is wanted to stop also the disks
#
if test "$HALT_DISKS" = "yes" ; then
opts="${opts:+$opts }-h"
fi
;;
*reboot)
message="Please stand by while rebooting the system..."
command="reboot"
mddev=""
opts=""
if test "$HALT_NETWORK" = "yes" ; then
opts="${opts:+$opts }-i"
fi
;;
*)
echo "$0: call me as \"halt\" or \"reboot\" please!"
exit 1
;;
esac

#
# first do local stuff
#
rc_reset
if test -e /etc/init.d/halt.local ; then
echo Running /etc/init.d/halt.local
/bin/sh /etc/init.d/halt.local
rc_status -v1 -r
fi

# write to wtmp file before unmounting /var
$command -w

# set a flag that we had success upto this point
test -w / && > /success

# give processes in front a chance to quit
vhangup ${REDIRECT} /dev/tty1 /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6 /dev/ttyS0 /dev/ttyS1

test -s /etc/init.d/.depend.halt || RUN_PARALLEL="no"
type -p startpar &> /dev/null || RUN_PARALLEL="no"
startpar -v &> /dev/null || RUN_PARALLEL="no"

if test -z "$COLD_BOOT" ; then
#
# set back system boot configuration
#
if test "$RUN_PARALLEL" = "yes" ; then

startopt="-p4 -t 30 -T 3"
eval $(startpar $startopt -M halt)
unset failed_service skipped_service

elif test -d /etc/init.d/boot.d/ ; then
#
# call modules in boot.d via K* symlinks
#
for link in /etc/init.d/boot.d/K[0-9][0-9]*; do
test -x $link || continue
$link stop
done
unset link
fi
fi

# check out if a software raid is active
if test -e /proc/mdstat -a -x /sbin/mdadm ; then
while read line ; do
case "$line" in
md*:*active*) mddev=--scan; break ;;
esac
done < /proc/mdstat
unset line
if test -n "$mddev" -a -e /etc/mdadm.conf ; then
mddev=""
while read type dev rest; do
case "$dev" in
/dev/md*) mddev="${mddev:+$mddev }$dev" ;;
esac
done < /etc/mdadm.conf
unset type dev rest
fi
fi

# kill splash animation
test "$SPLASH" = yes && /sbin/splash -q

echo "Sending all processes the TERM signal..."
killall5 -15
echo -e "$rc_done_up"

# wait between last SIGTERM and the next SIGKILL
rc_wait /sbin/blogd /sbin/splash

echo "Sending all processes the KILL signal..."
killall5 -9
echo -e "$rc_done_up"

if test -n "$REDIRECT" && /sbin/checkproc /sbin/blogd ; then
# redirect our famous last messages to default console
exec 0<> $REDIRECT 1>&0 2>&0
fi

# on umsdos fs this would lead to an error message, so direct errors to
# /dev/null
mount -no remount,ro / 2> /dev/null
sync

# wait for md arrays to become clean
if test -x /sbin/mdadm; then
/sbin/mdadm --wait-clean --scan
fi
# stop any inactive software raid
if test -n "$mddev" ; then
/sbin/mdadm --quiet --stop $mddev
# redirect shell errors to /dev/null
exec 3>&2 2>/dev/null
# cause the md arrays to be marked clean immediately
for proc in /proc/[0-9]* ; do
test ! -e $proc/exe || continue
read -t 1 tag name rest < $proc/status || continue
case "$name" in
md*_raid*) killproc -n -SIGKILL "$name" ;;
esac
done
unset tag name rest
# get shell errors back
exec 2>&3-
fi

# show "the system is down" message
test "$SPLASH" = yes && /sbin/splash -q -p 65535 -t "isdown"

# we do not really unmount /proc any more since halt(8) might need it
#umount -anvt proc

# Make reboot noise and wait a few seconds to give harddisks the chance
# to really flush their buffers before power goes down.
if test -n "$REDIRECT" ; then
case "$HALT_SOUND" in
"yes"|"quint")
echo -en "\033[10;393]\a\033[10;262]"
;;
"octave")
for tone in 524 491 440 393 349 328 295 262; do
echo -en "\033[10;${tone}]\a"
usleep 125000
done
echo -en "\033[10;262]"
;;
"no")
;;
*)
echo -en "\033[10;440]\a"
usleep 250000
;;
esac
else
test "$HALT_SOUND" = "no" || echo -en "\a"
fi
echo $message
test "$HALT_SOUND" = "no" || echo -en "\a"

test -n "$HALT_POWERDOWN_INSERT" && $HALT_POWERDOWN_INSERT

# Set system console back to intial value
test -n "$REDIRECT" -a -n "$CONSOLE" && setconsole $REDIRECT < $CONSOLE

# Test if we should boot into the new kernel
if test "$command" = "reboot" -a -x /sbin/kexec -a -f /sys/kernel/kexec_loaded ; then
read -t 2 loaded < /sys/kernel/kexec_loaded
if test "$loaded" = "1" ; then
echo -n "Loaded kernel image found, executing ... "
/sbin/kexec --exec
echo "${warn}failed, doing normal reboot${norm}"
fi
fi

# Now talk to kernel
exec $command -d -f -n $opts




Does this look like yours?


If I click on the script in dolphin, it immediately logs me out but I can enter my password and log on again...

I also hold the power for four seconds to 'electrocute' the computer, but letting the battery run flat is also fun.

If I log out, is it safe to electrocute from there?

charesnape 09-23-2010 04:51 PM

Now, if I try to log out from the red icon on the right or from the menu on the left (kde), nothing happens! I've only seen it do it a few times.

However, clicking on halt from dolphin takes you straight out. If I then choose switch off from the log in screen, all the clicky text scrolls up the screen and it switches off nicely.

So, for now, until I know what's going wrong from the icon end, I'll just put a shortcut to halt on my desktop or make a buttom or something...

My laptop is a good five years old. Is this RAID thing (no idea what that is) something to do with it (see above).

Cheers

avalosdanielr 09-24-2010 06:50 PM

Yes!, that's exactly my own script on 11.3. The only difference between halt scripts is that halt script in 11.2 lacks these lines:

187 # wait for md arrays to become clean
188 if test -x /sbin/mdadm; then
189 /sbin/mdadm --wait-clean --scan
190 fi

which are present in 11.3.

Unfortunately I use gnome desktop, but I will try to reproduce the behaviour you have observed (by using halt from 11.3).

I wouldn't recomend to "electrocute" after login off, because the daemons (services in Windows) keep working, although your personal files of course are closed when you logoff.

Finally, to your last post, to my best knowledge, RAID has nothing to do with your last notes. RAID is about using serveral at least 2 hard disks to write redundantly on both disks, so if there is a failure of one of the disks, data can be reconstructed from the surviving hd.

Regards,

robert_marma 09-18-2012 07:58 AM

machine won't shut down on reboot
 
Hi, all,

Not wanting to bother any of you unnecessarily, I've tried to avoid posting anything on this site, but I was hoping that I could prevail upon you yet again, and I DO appreciate the advice I received from my last post.

This time, my problem is similar to those of "avalosdanielr", except that my system shuts down properly when the "shut down" button is pressed, but fails to shut down when the "restart" button is pressed at the Gnome desktop. Using the terminal as Superuser, I've already made a copy of halt, calling it "halt.org", but I'm not sure exactly what to look for in the code to force the system to shut down before restarting.

In case it matters, I'm running an ancient Compaq Presarion 3000 laptop with 512 MB RAM, 3 GHz processor, 60-gig hard drive using openSUSE 11.3 "Teal" Kernel 2.6.34-12 (\r (\l) with GNOME 2.26.0 Display Manager.

Any suggestions would be greatly appreciated, and thanks again to all of you.

robert_marma, STILL a Linux Newbie


All times are GMT -5. The time now is 06:20 PM.