Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ufed caused a hang up during shutdown.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
v3trae
n00b
n00b


Joined: 14 Aug 2006
Posts: 58

PostPosted: Sun Sep 03, 2006 9:57 pm    Post subject: Ufed caused a hang up during shutdown. Reply with quote

Went through ufed to setup my make.conf and now my machine wont shutdown. Here is the hang up.


Code:

*Unloading ALSA ...
*Unloading ALSA modules ...
/etc/init.d/half.sh line 16: stop_addon: command not found
/etc/init.d/half.sh line 17: stop_addon: command not found
/etc/init.d/half.sh line 24: ebegin: command not found
/etc/init.d/half.sh line 26: eend: command not found
/etc/init.d/half.sh line 78: ebegin: command not found
/etc/init.d/half.sh line 102: eend: command not found
/etc/init.d/half.sh line 105: stop_addon: command not found
/etc/init.d/half.sh line 108: stop_volumes: command not found
/etc/init.d/half.sh line 157: ebegin: command not found
/etc/init.d/half.sh line 168: eend: command not found
INIT: no more processes left in this runlevel.



Here is a copy of my halt.sh

Code:

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# Check to see if this is a livecd, if it is read the commandline
# this mainly makes sure $CDBOOT is defined if it's a livecd
[[ -f /sbin/livecd-functions.sh ]] && \
   source /sbin/livecd-functions.sh && \
   livecd_read_commandline

# Reset pam_console permissions if we are actually using it
if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \
      -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]]; then
   /sbin/pam_console_apply -r
fi

stop_addon devfs
stop_addon udev

# Try to unmount all tmpfs filesystems not in use, else a deadlock may
# occure, bug #13599.
umount -at tmpfs &>/dev/null

if [[ -n $(swapon -s 2>/dev/null) ]]; then
   ebegin "Deactivating swap"
   swapoff -a
   eend $?
fi

# Write a reboot record to /var/log/wtmp before unmounting

halt -w &>/dev/null

# Unmounting should use /proc/mounts and work with/without devfsd running

# Credits for next function to unmount loop devices, goes to:
#
#   Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#   Modified for RHS Linux by Damien Neil
#
#
# Unmount file systems, killing processes if we have to.
# Unmount loopback stuff first
# Use `umount -d` to detach the loopback device

# Remove loopback devices started by dm-crypt

remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \
            sort -r | grep -v '/newroot' | grep -v '/mnt/livecd')
[[ -n ${remaining} ]] && {
   sig=
   retry=3

   while [[ -n ${remaining} && ${retry} -gt 0 ]]; do
      if [[ ${retry} -lt 3 ]]; then
         ebegin "Unmounting loopback filesystems (retry)"
         umount -d ${remaining} &>/dev/null
         eend $? "Failed to unmount filesystems this retry"
      else
         ebegin "Unmounting loopback filesystems"
         umount -d ${remaining} &>/dev/null
         eend $? "Failed to unmount filesystems"
      fi

      remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \
                  sort -r | grep -v '/newroot' | grep -v '/mnt/livecd')
      [[ -z ${remaining} ]] && break
      
      /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
      sleep 5
      retry=$((${retry} - 1))
      sig=-9
   done
}

# Try to unmount all filesystems (no /proc,tmpfs,devfs,etc).
# This is needed to make sure we dont have a mounted filesystem
# on a LVM volume when shutting LVM down ...
ebegin "Unmounting filesystems"
unmounts=$( \
   awk '{ \
       if (($3 !~ /^(proc|devpts|sysfs|devfs|tmpfs|usb(dev)?fs)$/) && \
           ($1 != "none") && \
           ($1 !~ /^(rootfs|\/dev\/root)$/) && \
           ($2 != "/")) \
         print $2 }' /proc/mounts | sort -ur)
for x in ${unmounts}; do
   # Do not umount these if we are booting off a livecd
   if [[ -n ${CDBOOT} ]] && \
      [[ ${x} == "/mnt/cdrom" || ${x} == "/mnt/livecd" ]] ; then
      continue
   fi

   x=${x//\\040/ }
   if ! umount "${x}" &>/dev/null; then
      # Kill processes still using this mount
      /bin/fuser -k -m -9 "${x}" &>/dev/null
      sleep 2
      # Now try to unmount it again ...
      umount -f -r "${x}" &>/dev/null
   fi
done
eend 0

# Try to remove any dm-crypt mappings
stop_addon dm-crypt

# Stop LVM, etc
stop_volumes

# This is a function because its used twice below
ups_kill_power() {
   local UPS_CTL UPS_POWERDOWN
   if [[ -f /etc/killpower ]] ; then
      UPS_CTL=/sbin/upsdrvctl
      UPS_POWERDOWN="${UPS_CTL} shutdown"
   elif [[ -f /etc/apcupsd/powerfail ]] ; then
      UPS_CTL=/etc/apcupsd/apccontrol
      UPS_POWERDOWN="${UPS_CTL} killpower"
   else
      return 0
   fi
   if [[ -x ${UPS_CTL} ]] ; then
      ewarn "Signalling ups driver(s) to kill the load!"
      ${UPS_POWERDOWN}
      ewarn "Halt system and wait for the UPS to kill our power"
      /sbin/halt -id
      while [ 1 ]; do sleep 60; done
   fi
}

mount_readonly() {
   local x=
   local retval=0
   local cmd=$1

   # Get better results with a sync and sleep
   sync; sync
   sleep 1

   for x in $(awk '$1 != "none" { print $2 }' /proc/mounts | sort -ur) ; do
      x=${x//\\040/ }
      if [[ ${cmd} == "u" ]]; then
         umount -n -r "${x}"
      else
         mount -n -o remount,ro "${x}" &>/dev/null
      fi
      retval=$((${retval} + $?))
   done
   [[ ${retval} -ne 0 ]] && killall5 -9 &>/dev/null

   return ${retval}
}

# Since we use `mount` in mount_readonly(), but we parse /proc/mounts, we
# have to make sure our /etc/mtab and /proc/mounts agree
cp /proc/mounts /etc/mtab &>/dev/null
ebegin "Remounting remaining filesystems readonly"
mount_worked=0
if ! mount_readonly ; then
   if ! mount_readonly ; then
      # If these things really don't want to remount ro, then
      # let's try to force them to unmount
      if ! mount_readonly u ; then
         mount_worked=1
      fi
   fi
fi
eend ${mount_worked}
if [[ ${mount_worked} -eq 1 ]]; then
   ups_kill_power
   /sbin/sulogin -t 10 /dev/console
fi

# Inform if there is a forced or skipped fsck
if [[ -f /fastboot ]]; then
   echo
   ewarn "Fsck will be skipped on next startup"
elif [[ -f /forcefsck ]]; then
   echo
   ewarn "A full fsck will be forced on next startup"
fi

ups_kill_power


# vim:ts=4


Any help would be appriciated. Thank you.
Back to top
View user's profile Send private message
blu3bird
Retired Dev
Retired Dev


Joined: 04 Oct 2003
Posts: 614
Location: Munich, Germany

PostPosted: Sun Sep 03, 2006 10:46 pm    Post subject: Reply with quote

this isn't caused by ufed...

your /etc/init.d/halt.sh should start with
Code:
#!/bin/bash
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh

# Check to see if this is a livecd, if it is read the commandline
# this mainly makes sure $CDBOOT is defined if it's a livecd
[[ -f /sbin/livecd-functions.sh ]] && \
    source /sbin/livecd-functions.sh && \
    livecd_read_commandline


(note the source /sbin/functions.sh)

forgot to etc-update?
_________________
Black Holes are created when God divides by zero!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum