You are not logged in.

#1 2011-11-12 16:08:32

ahronzombi
Member
From: /
Registered: 2007-05-06
Posts: 108
Website

I cant reboot. Shutdown freezes at sending SIGTERM to processes

I could use some advice. For the past 4 months or so I have not been able to do a full shutdown or reboot. When I run the shutdown -r now or reboot commands the process starts but freezes at Sending SIGTERM to processes. At this point I can switch to diffrent terminals with Ctrl+Alt+F? but I cant type.The only thing I can do is hold my power button down to shut off. I have been searching online  fore awhile and restored my rc.shutdown script to the original backup I have from months ago but I am still having the same issues. Ill attach my local and shutdown scripts

Thanks for taking a look.

rc.local

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#

#/bin/plymouth quit --retain-splash
alsactl -f /var/lib/alsa/asound.state restore
#rm /tmp/.X25-lock
mount LABEL=Backup /home/ahron/Dropbox/Backup
mount LABEL=FatBackup '/home/ahron/Backup Images'
#su ahron -c "vncserver -geometry 800x600 -alwaysshared -localhost -dpi 96 :25"

rc.shutdown

#!/bin/bash
#
# /etc/rc.shutdown
#

. /etc/rc.conf
. /etc/rc.d/functions

# avoid staircase effect
stty onlcr

echo " "
printhl "Initiating Shutdown..."
echo " "

run_hook shutdown_start

[[ -x /etc/rc.local.shutdown ]] && /etc/rc.local.shutdown

stop_all_daemons

run_hook shutdown_prekillall

kill_all

run_hook shutdown_postkillall

stat_busy "Saving Random Seed"
	RANDOM_SEED=/var/lib/misc/random-seed
	install -TDm 0600 <(:) $RANDOM_SEED
	POOL_FILE=/proc/sys/kernel/random/poolsize
	if [[ -r $POOL_FILE ]]; then
		read POOL_SIZE < $POOL_FILE
	else
		POOL_SIZE=512
	fi
	dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &>/dev/null
stat_done

[[ $TIMEZONE ]] &&
	status "Saving Time Zone" \
		cp --remove-destination "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime

# Write to wtmp file before unmounting
halt -w

status "Deactivating Swap" swapoff -a

# stop monitoring of lvm2 groups before unmounting filesystems
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
	status "Deactivating monitoring of LVM2 groups" \
		vgchange --monitor n &>/dev/null

# if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
status "Unmounting Filesystems" \
	umount -a -r -t nodevtmpfs,notmpfs,nosysfs,noproc,nodevpts -O no_netdev

run_hook shutdown_postumount

# Kill non-root encrypted partition mappings
if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
	stat_busy "Deactivating encrypted volumes:"
		# Maybe someone has LVM on an encrypted block device
		# executing an extra vgchange is errorless
		[[ $USELVM = [Yy][Ee][Ss] ]] && vgchange --sysinit -a n &>/dev/null
		do_lock() {
			stat_append "${1}.."
			if $CS remove "$1" &>/dev/null; then
				stat_append "ok "
			else
				stat_append "failed "
			fi
		}
		read_crypttab do_lock
	stat_done
fi

[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
	status "Deactivating LVM2 groups" vgchange --sysinit -a n &>/dev/null

status "Remounting Root Filesystem Read-only" \
	lsof /
	mount -n -t ext4 --verbose -o remount,ro /dev/sda3 /
	reboot -d -f -i

run_hook shutdown_poweroff

# Power off or reboot
printsep
if [[ $RUNLEVEL = 0 ]]; then
	printhl "${C_H2}POWER OFF"
	poweroff -d -f -h -i
else
	printhl "${C_H2}REBOOTING"
	# if kexec is installed and a kernel is loaded, use it
	[[ -x $(type -P kexec) ]] && kexec -e &>/dev/null	
fi

# End of file
# vim: set ts=2 sw=2 noet:

Last edited by ahronzombi (2011-11-12 17:10:43)


Registered: 2007-05-05
Keep coming back to Arch because its hands down the most amazing distro God has given us.

Offline

#2 2011-11-12 23:56:52

RiHL
Member
Registered: 2011-11-12
Posts: 13

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

Please can you post your:
/etc/rc.local.shutdown and /etc/rc.d/functions ?


My poor English is fault of Google Translator.

Offline

#3 2011-11-13 01:47:11

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

I changed the shutdown logic quite a bit in the latest initscripts release. It should be less fragile now. Could you try the version from [testing]?

Offline

#4 2011-11-13 03:16:59

ahronzombi
Member
From: /
Registered: 2007-05-06
Posts: 108
Website

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

So installing the testing initscripts seems to fix the reboot command, but still the most commonly used command shutdown -r now still wont do a full reboot.
/etc/rc.local.shutdown

#!/bin/bash
#
# /etc/rc.local.shutdown: Local shutdown script.
#
#killall dropbox
#umount /home/ahron/Dropbox/Backup
#killall Xvnc
#fuser -vm /	

/etc/rc.d/functions

NETFS="nfs,nfs4,smbfs,cifs,codafs,ncpfs,shfs,fuse,fuseblk,glusterfs,davfs,fuse.glusterfs"

# Check local filesystems
fsck_all() {
	fsck -A -T -C"$FSCK_FD" -a -t "no${NETFS//,/,no},noopts=_netdev" $FORCEFSCK
}

# Single-user login and/or automatic reboot after fsck (if needed)
fsck_reboot() {
	# $1 = exit code returned by fsck
	# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
	(( ($1 | 33) == 33 )) && return 0
	if (( $1 & 2 )); then
		echo
		echo "********************** REBOOT REQUIRED *********************"
		echo "*                                                          *"
		echo "* The system will be rebooted automatically in 15 seconds. *"
		echo "*                                                          *"
		echo "************************************************************"
		echo
		sleep 15
	else
		echo
		echo "*****************  FILESYSTEM CHECK FAILED  ****************"
		echo "*                                                          *"
		echo "*  Please repair manually and reboot. Note that the root   *"
		echo "*  file system is currently mounted read-only. To remount  *"
		echo "*  it read-write type: mount -n -o remount,rw /            *"
		echo "*  When you exit the maintenance shell the system will     *"
		echo "*  reboot automatically.                                   *"
		echo "*                                                          *"
		echo "************************************************************"
		echo
		sulogin -p
	fi
	echo "Automatic reboot in progress..."
	umount -a
	mount -n -o remount,ro /
	reboot -f
	exit 0
}

mount_all() {
	mount -a -t "nosysfs,no${NETFS//,/,no}" -O no_netdev
}

umount_all() {
	# $1: restrict to fstype

	local mounts

	while read -r target fstype options; do

		# match only targetted fstypes
		if [[ $1 && $1 != "$fstype" ]]; then
			continue
		fi

		# don't unmount API filesystems
		if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
			continue
		fi

		# avoid networked devices
		IFS=, read -ra opts <<< "$options"
		if in_array _netdev "${opts[@]}"; then
			continue
		fi

		mounts+=("$target")
	done < <(findmnt -runRo TARGET,FSTYPE,OPTIONS / | tac)

	umount -r "${mounts[@]}"

}

remove_leftover() {
	stat_busy "Removing Leftover Files"
		# handle this separately until we declare the non-symlinks obsoleted
		[[ ! -L /var/lock ]] && rm -rf /var/lock/*
		if [[ ! -L /var/run && -d /var/run ]]; then
			find /var/run/ \! -type d -delete
			ln -s /run/daemons /var/run/daemons
		fi
		/usr/lib/initscripts/arch-tmpfiles --create --remove && stat_done || stat_fail
}

bootlogd_stop() {
	[[ -f /run/bootlogd.pid ]] || return 0
	touch /var/log/boot
	kill $(< /run/bootlogd.pid)
	rm -f /run/bootlogd.pid
	sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
		  -e 's/\^\[(\[1?[0-9][0-9]|%)G//g' -e 's/\^\[\[0;1//g'  /var/log/boot
}

###############################
# Custom hooks in initscripts #
###############################
# Hooks can be used to include custom code in various places in the rc.* scripts
#
# Define a hook function in a functions.d file using:
#  function_name() {
#    ...
#  }
#  add_hook hook_name function_name
# It is allowed to register several hook functions for the same hook
# Is is also allowed to register the same hook function for several hooks
#
# Currently, the following hooks exist:
# sysinit_start: at the beginning of rc.sysinit
# multi_start: at the beginning of rc.multi
# single_start: at the beginning of rc.single
# shutdown_start: at the beginning of rc.shutdown
# sysinit_end: at the end of rc.sysinit
# multi_end: at the end of rc.multi
# single_end: at the end of rc.single
# sysinit_udevlaunched: after udev has been launched in rc.sysinit
# single_udevlaunched: after udev has been launched in rc.single
# sysinit_udevsettled: after uevents have settled in rc.sysinit
# single_udevsettled: after uevents have settled in rc.single
# sysinit_premount: before local filesystems are mounted, but after root is mounted read-write in rc.sysinit
# sysinit_postmount: after local filesystems are mounted
# shutdown_prekillall: before all processes are being killed in rc.shutdown
# single_prekillall: before all processes are being killed in rc.single
# shutdown_postkillall: after all processes have been killed in rc.shutdown
# single_postkillall: after all processes have been killed in rc.single
# shutdown_postumount: after filesystems are unmounted
# shutdown_poweroff: directly before powering off in rc.shutdown
#
# Declare add_hook and run_hook as read-only to prevent overwriting them.
# Too bad we cannot do the same thing with hook_funcs

if (( RC_FUNCTIONS_HOOK_FUNCS_DEFINED != 1 )); then
	declare -A hook_funcs

	add_hook() {
		[[ $1 && $2 ]] || return 1
		hook_funcs[$1]+=" $2"
	}

	run_hook() {
		[[ $1 ]] || return 1
		local func
		for func in ${hook_funcs["$1"]}; do
			"${func}"
		done
	}

	declare -fr add_hook run_hook
	declare -r RC_FUNCTIONS_HOOK_FUNCS_DEFINED=1
fi

# Function for setting console font if required
set_consolefont() {
	[[ $CONSOLEFONT ]] || return 0
	stat_busy "Loading Console Font: $CONSOLEFONT"
		#CONSOLEMAP in UTF-8 shouldn't be used
		[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
		local i
		for i in /dev/tty[0-9]*; do
			setfont ${CONSOLEMAP:+-m "${CONSOLEMAP}"} \
				"$CONSOLEFONT" -C ${i} &>/dev/null
		done
	if (( $? )); then
		stat_fail
	elif [[ $CONSOLEMAP ]]; then
		cat <<"EOF" >>/etc/profile.d/locale.sh
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi
EOF
		stat_done
	else
		stat_done
	fi
}

if [[ $DAEMON_LOCALE = [yY][eE][sS] ]]; then
	LANG=${LOCALE:-C}
	if [[ -r /etc/locale.conf ]]; then
		parse_envfile /etc/locale.conf "${localevars[@]}"
	fi
else
	export LANG=C
fi

# set colors
if [[ $USECOLOR = [yY][eE][sS] ]]; then
	if tput setaf 0 &>/dev/null; then
		C_CLEAR=$(tput sgr0)                      # clear text
		C_MAIN=${C_CLEAR}$(tput bold)        # main text
		C_OTHER=${C_MAIN}$(tput setaf 4)     # prefix & brackets
		C_SEPARATOR=${C_MAIN}$(tput setaf 0) # separator
		C_BUSY=${C_CLEAR}$(tput setaf 6)     # busy
		C_FAIL=${C_MAIN}$(tput setaf 1)      # failed
		C_DONE=${C_MAIN}                          # completed
		C_BKGD=${C_MAIN}$(tput setaf 5)      # backgrounded
		C_H1=${C_MAIN}                            # highlight text 1
		C_H2=${C_MAIN}$(tput setaf 6)        # highlight text 2
	else
		C_CLEAR="\e[m"          # clear text
		C_MAIN="\e[;1m"         # main text
		C_OTHER="\e[1;34m"      # prefix & brackets
		C_SEPARATOR="\e[1;30m"  # separator
		C_BUSY="\e[;36m"        # busy
		C_FAIL="\e[1;31m"       # failed
		C_DONE=${C_MAIN}        # completed
		C_BKGD="\e[1;35m"       # backgrounded
		C_H1=${C_MAIN}          # highlight text 1
		C_H2="\e[1;36m"         # highlight text 2
	fi
fi

# prefixes:

PREFIX_REG="::"
PREFIX_HL=" >"

# Source additional functions at the end to allow overrides
for f in /etc/rc.d/functions.d/*; do
	[[ -e $f ]] && . "$f"
done

# Exit current shell if user is not root
need_root() {
	(( EUID )) && printf 'You need to be root.\n' && exit 1
}

# Quit script if it's not running by root
# This can be disabled in scripts sourcing functions by setting NEED_ROOT=0
# A local call to need_root can be done to ensure part of script need root privilege
(( ${NEED_ROOT:-0} == 1 )) && need_root

# End of file
# vim: set ts=2 sw=2 noet:

Registered: 2007-05-05
Keep coming back to Arch because its hands down the most amazing distro God has given us.

Offline

#5 2011-11-13 09:29:17

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

That's odd. I always use "reboot", but I thought "shutdown -r now" would be the same... Any more details you could give about what happens when your reboot fails?

Offline

#6 2011-11-13 10:02:45

RiHL
Member
Registered: 2011-11-12
Posts: 13

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

I think I have it!
in /etc/rc.shutdown you have:

         if [[ $RUNLEVEL = 0 ]]; then
                printhl "${C_H2}POWER OFF"
                poweroff -d -f -h -i
        else
                printhl "${C_H2}REBOOTING"
                # if kexec is installed and a kernel is loaded, use it
                [[ -x $(type -P kexec) ]] && kexec -e &>/dev/null
       fi

add the line:

                # if kexec is installed and a kernel is loaded, use it
                [[ -x $(type -P kexec) ]] && kexec -e &>/dev/null
                reboot -d -f -i
        fi

Last edited by RiHL (2011-11-13 10:54:26)


My poor English is fault of Google Translator.

Offline

#7 2011-11-13 14:42:04

ahronzombi
Member
From: /
Registered: 2007-05-06
Posts: 108
Website

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

That did not work but im getting closer. I think  this is plymouth-git related because if i remove the word splash from the end of  the kernel line everything works fine.


Registered: 2007-05-05
Keep coming back to Arch because its hands down the most amazing distro God has given us.

Offline

#8 2011-11-19 13:27:13

Citizen
Member
Registered: 2011-11-19
Posts: 3

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

I'm having the same problem, it's almost definitely related to Plymouth-git: I temporarily replaced ply_shutdown_start() with an empty function (so plymouth wouldn't be started during shutdown) in plymouth.functions, and my machine shutdown with no issues.

The odd thing is that when I reverted plymouth.functions it now shuts down fine, albeit without showing the graphical shutdown...

ETA:
Scratch that, I left a debugging echo line I added uncommented, which was obviously stopping plymouth from showing it's graphics. Commenting it out causes the shutdown to hang again.

Last edited by Citizen (2011-11-19 13:32:51)

Offline

#9 2011-11-19 15:58:38

Citizen
Member
Registered: 2011-11-19
Posts: 3

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

Quick update: I replaced the plymouth.functions file with a slightly older version. It's a little less elegant but my machine does shutdown with this one. Plymouth still doesn't show on boot though...

Given that it doesn't hang with this version, I'd hazard a guess that it's a problem with the shutdown_poweroff hook not running or not killing plymouth. I'll keep playing at it, in the meantime replacing your plymouth,functions code with this may help you:

ply_client() {
	[ -x /bin/plymouth ] && /bin/plymouth "$@"
}

ply_daemon() {
	[ -x /sbin/plymouthd ] && /sbin/plymouthd "$@"
}

stat_busy() {
	case "$1" in
		"Mounting Local Filesystems")
			ply_client --newroot=/
		;;
		"Activating Swap")
			ply_client --sysinit
		;;
	esac
	
	ply_client --update="$1"
	ply_client message --text="$1"
	
	printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
	printf "${SAVE_POSITION}"
	deltext
	printf "   ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
}

stat_fail() {
	ply_client --quit
	
	deltext
	printf "   ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
}

ply_end(){
if [ "$0" == "/etc/rc.shutdown" ]; then
	XPID=`pidof X`
	if [ "$XPID" ]; then
		RUNLEVEL=`runlevel`
			if [ "${RUNLEVEL:2:4}" != '5' ]; then
				[ -e /var/run/daemons/slim ] && /etc/rc.d/slim stop
				[ -e /var/run/daemons/gdm ] && /etc/rc.d/gdm stop
				[ -e /var/run/daemons/kdm ] && /etc/rc.d/kdm stop
				[ -e /var/run/daemons/xdm ] && /etc/rc.d/xdm stop
				[ -e /var/run/daemons/entrance ] && /etc/rc.d/entrance stop
			fi
		kill -9 $XPID &> /dev/null
	fi

	ply_daemon --mode=shutdown --pid-file=/tmp/plymouthd
	ply_client --show-splash

	while [[ ( $(ps h $(cat /tmp/plymouthd)) ) && ( $ply_wait -lt 5 ) ]]; do
		ply_wait=$(( $ply_wait + 1 ))
		sleep 1
	done

	[[ $(ps h $(cat /tmp/plymouthd)) ]] && kill -9 $(cat /tmp/plymouthd)

fi 

	ply_client quit --retain-splash

}
add_hook multi_end ply_end

Offline

#10 2011-11-19 16:08:08

ahronzombi
Member
From: /
Registered: 2007-05-06
Posts: 108
Website

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

Id like a nice graphical boot that never goes away unless I tell it to but I guess that's just not an option sad o well


Registered: 2007-05-05
Keep coming back to Arch because its hands down the most amazing distro God has given us.

Offline

#11 2011-11-19 16:24:17

Citizen
Member
Registered: 2011-11-19
Posts: 3

Re: I cant reboot. Shutdown freezes at sending SIGTERM to processes

With the above I still get graphical boot, but no graphical shutdown. If the above works for you it's a reasonable work around to allow the machine to reboot/shutdown before a real fix can be found smile

Offline

Board footer

Powered by FluxBB