Автор Тема: dhcpcd <defunct>  (Прочетена 4097 пъти)

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
dhcpcd <defunct>
« -: Nov 18, 2009, 13:18 »
Код:
#ps -A | grep dhcp
3344 ?        00:00:00 dhcpcd <defunct>

Какво е това <defunct> и защо не мога да го kill-на?
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

lkr

  • Напреднали
  • *****
  • Публикации: 81
    • Профил
Re: dhcpcd <defunct>
« Отговор #1 -: Nov 18, 2009, 13:34 »
Това е умрял child процес и е станал зомби, защото parent-а не е извикал wait(). Почти невредим е, тъй като всички ресурси са освободени, ползва се за да се пази ID-то
Активен

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #2 -: Nov 18, 2009, 13:41 »
А няква идея как да го махна?
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

lkr

  • Напреднали
  • *****
  • Публикации: 81
    • Профил
Re: dhcpcd <defunct>
« Отговор #3 -: Nov 18, 2009, 13:44 »
Като убиеш parent-a.
Активен

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #4 -: Nov 18, 2009, 13:49 »
Добре де. Това ми е ясно, не трябваше да задавам глупави въпроси.
Само че има нещо друго, лаптоп-а ми е изключен, пускам го, логвам се и не мога да разбера кой и от къде го създава този процес? Така де въпроса ми е от къде се появява?
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

ntrance

  • Напреднали
  • *****
  • Публикации: 696
    • Профил
Re: dhcpcd <defunct>
« Отговор #5 -: Nov 18, 2009, 14:44 »
А няква идея как да го махна?

Рестарт ..!
Активен

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #6 -: Nov 18, 2009, 14:59 »
Не става. Вечер си спирам лаптоп-а. Сутрин го пускам правя едно:
Код:
#ps -A | grep dhcp
и се появява това <defunct>
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

neter

  • Global Moderator
  • Напреднали
  • *****
  • Публикации: 3408
  • Distribution: Debian, SailfishOS, CentOS
  • Window Manager: LXDE, Lipstick
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #7 -: Nov 18, 2009, 15:53 »
Махни symlink-а от rc папката за init-а, който ползваш. Беше хубаво да кажеш за Slackware-а или за Ubuntu-то говориш (съдейки по профила ти), но щом не казваш, търси rc папката някъде из /etc ;)
Активен

"Да си добре приспособен към болно общество не е признак за добро здраве" - Джиду Кришнамурти

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #8 -: Nov 18, 2009, 16:02 »
Моя грешка, значи говоря за Slack-a. Кой файл да търся? Нещо се обърках.
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

neter

  • Global Moderator
  • Напреднали
  • *****
  • Публикации: 3408
  • Distribution: Debian, SailfishOS, CentOS
  • Window Manager: LXDE, Lipstick
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #9 -: Nov 18, 2009, 16:06 »
Предполагам, че файлът трябва да е в /etc/rc.d папката. Може би кръстен rc.dhcpd или нещо подобно. Ако не е symlink, а е самият скрипт, не го изтривай, а си го запази някъде извън /etc/rc.d.
Активен

"Да си добре приспособен към болно общество не е признак за добро здраве" - Джиду Кришнамурти

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #10 -: Nov 18, 2009, 16:09 »
Код:
# grep dhcp* *
rc.0:# In case dhcpcd might have been manually started on the command line,
rc.0:# look for the .pid file, and shut dhcpcd down if it's found:
rc.0:if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
rc.0:  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
rc.6:# In case dhcpcd might have been manually started on the command line,
rc.6:# look for the .pid file, and shut dhcpcd down if it's found:
rc.6:if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
rc.6:  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
rc.S:  /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
rc.inet1:        echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}" | $LOGGER
rc.inet1:        /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}
rc.inet1:      echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
rc.inet1:      /sbin/dhcpcd -k -d ${1} 2> /dev/null || /sbin/ifconfig ${1} down
rc.wireless:    # an IP address by manually setting the ESSID and then calling dhcpcd,

Няма такова нещо. Има само 2 symlink-a - rc.0 и rc.modules
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

neter

  • Global Moderator
  • Напреднали
  • *****
  • Публикации: 3408
  • Distribution: Debian, SailfishOS, CentOS
  • Window Manager: LXDE, Lipstick
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #11 -: Nov 18, 2009, 16:30 »
Няма значение дали файловете в /etc/rc.d са symlink-ове или реални скриптове. Важното е присъствието им в тази папка, тъй като файловете от тази папка се изпълняват при включването на системата. Виждам, че имаш някакво изпълнение на /sbin/dhcpd в rc.0, rc.6 и rc.inet1, но давайки само изхода от grep, не може да се види какво има около тези редове, за да се разбере какво точно се случва при изпълнението на скрипта. Покажи съдържанието на тези 3 файла.
Активен

"Да си добре приспособен към болно общество не е признак за добро здраве" - Джиду Кришнамурти

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #12 -: Nov 18, 2009, 16:40 »
Аз не съм ги пипал тези файлове. Вярно, че доста ровя и доста неща променям - някой без да знам защо, но не се базикам с dhcpd-то понеже ще си скапя нет-а. Както и да е, ето скриптовете:
Код:
#cat rc.0
#! /bin/sh
#
# rc.6 This file is executed by init when it goes into runlevel
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
# unmounts file systems and then either halts or reboots.
#
# Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
#

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

# Set linefeed mode to avoid staircase effect.
/bin/stty onlcr

echo "Running shutdown script $0:"

# Find out how we were called.
case "$0" in
*0)
command="halt"
;;
*6)
command=reboot
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)."
    /sbin/hwclock $CLOCK_OPT --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)."
    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
  fi
fi

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi

# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
  /etc/rc.d/rc.httpd stop
fi

# Stop the MySQL database:
if [ -r /var/run/mysql/mysql.pid ]; then
  . /etc/rc.d/rc.mysqld stop
fi

# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba stop
fi

# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd stop
fi

# Shut down the SSH server:
if [ -x /etc/rc.d/rc.sshd ]; then
  /etc/rc.d/rc.sshd stop
fi

# Shut down the SASL authentication daemon:
if [ -x /etc/rc.d/rc.saslauthd ]; then
  /etc/rc.d/rc.saslauthd stop
fi

# Shut down OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
  /etc/rc.d/rc.openldap stop
fi

# Stop D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
  sh /etc/rc.d/rc.messagebus stop
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems."
/bin/umount -v -a -r -t nfs,smbfs,cifs

# Try to shut down pppd:
PS="$(ps ax)"
if echo "$PS" | /bin/grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi

# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    . /etc/rc.d/rc.inet1 stop
  fi
fi

# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
  # A little time for /etc/resolv.conf and/or other files to
  # restore themselves.
  sleep 2
fi

# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ]; then
  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to deactivate:
  /bin/sleep 5
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  /sbin/accton off
fi

# Terminate acpid before syslog:
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
  . /etc/rc.d/rc.acpid stop
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
if [ ! "$1" = "fast" ]; then # shutdown did not already kill all processes
  /sbin/killall5 -15
  /bin/sleep 5
  /sbin/killall5 -9
fi

# Try to turn off quota.
if /bin/grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo "Turning off filesystem quotas."
    /sbin/quotaoff -a
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
/bin/chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Clear /var/lock/subsys.
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# Turn off swap:
echo "Turning off swap."
/sbin/swapoff -a
/bin/sync

# Umount any LVM volumes:
if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
  echo "Unmounting LVM volumes."
  /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
fi

echo "Unmounting local file systems."
/bin/umount -v -a -t no,proc,sysfs

echo "Remounting root filesystem read-only."
/bin/mount -v -n -o remount,ro /

# This never hurts:
/bin/sync

# Close any volumes opened by cryptsetup:
if [ -f /etc/crypttab -a -x /sbin/cryptsetup.static ]; then
  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
    # NOTE: we only support LUKS formatted volumes (except for swap)!
    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
    if /sbin/cryptsetup.static isLuks $DEV 2>/dev/null ; then
      echo "Locking LUKS crypt volume '${LUKS}':"
      /sbin/cryptsetup.static luksClose ${LUKS}
    elif echo $OPTS | grep -wq swap ; then
      # If any of the volumes was used as encrypted swap,
      # then run mkswap on the underlying device -
      # in case other Linux installations on this computer should use it:
      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
      /sbin/cryptsetup.static remove ${LUKS}
      mkswap $DEV
    fi
  done
fi

# Deactivate LVM volume groups:
if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
  echo "Deactivating LVM volume groups:"
  /sbin/vgchange -an --ignorelockingfailure
fi

# This never hurts again (especially since root-on-LVM always fails
# to deactivate the / logical volume...  but at least it was
# remounted as read-only first)
/bin/sync

# sleep 3 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
/bin/sleep 3

# This is to ensure all processes have completed on SMP machines:
wait

if [ -x /sbin/genpowerd ]; then
  # See if this is a powerfail situation:
  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
    # Signal UPS to shut off the inverter:
    /sbin/genpowerd -k
    if [ ! $? = 0 ]; then
      echo
      echo "There was an error signaling the UPS."
      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
      echo "the serial line and UPS type."
      # Wasting 15 seconds of precious power:
      /bin/sleep 15
    fi
  fi
fi

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo "Rebooting."
  /sbin/reboot
else
  /sbin/poweroff
fi

Код:
#cat rc.6

#! /bin/sh
#
# rc.6 This file is executed by init when it goes into runlevel
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
# unmounts file systems and then either halts or reboots.
#
# Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
#

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

# Set linefeed mode to avoid staircase effect.
/bin/stty onlcr

echo "Running shutdown script $0:"

# Find out how we were called.
case "$0" in
*0)
command="halt"
;;
*6)
command=reboot
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)."
    /sbin/hwclock $CLOCK_OPT --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)."
    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
  fi
fi

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi

# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
  /etc/rc.d/rc.httpd stop
fi

# Stop the MySQL database:
if [ -r /var/run/mysql/mysql.pid ]; then
  . /etc/rc.d/rc.mysqld stop
fi

# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba stop
fi

# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd stop
fi

# Shut down the SSH server:
if [ -x /etc/rc.d/rc.sshd ]; then
  /etc/rc.d/rc.sshd stop
fi

# Shut down the SASL authentication daemon:
if [ -x /etc/rc.d/rc.saslauthd ]; then
  /etc/rc.d/rc.saslauthd stop
fi

# Shut down OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
  /etc/rc.d/rc.openldap stop
fi

# Stop D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
  sh /etc/rc.d/rc.messagebus stop
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems."
/bin/umount -v -a -r -t nfs,smbfs,cifs

# Try to shut down pppd:
PS="$(ps ax)"
if echo "$PS" | /bin/grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi

# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    . /etc/rc.d/rc.inet1 stop
  fi
fi

# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
  # A little time for /etc/resolv.conf and/or other files to
  # restore themselves.
  sleep 2
fi

# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ]; then
  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to deactivate:
  /bin/sleep 5
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  /sbin/accton off
fi

# Terminate acpid before syslog:
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
  . /etc/rc.d/rc.acpid stop
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
if [ ! "$1" = "fast" ]; then # shutdown did not already kill all processes
  /sbin/killall5 -15
  /bin/sleep 5
  /sbin/killall5 -9
fi

# Try to turn off quota.
if /bin/grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo "Turning off filesystem quotas."
    /sbin/quotaoff -a
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
/bin/chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Clear /var/lock/subsys.
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# Turn off swap:
echo "Turning off swap."
/sbin/swapoff -a
/bin/sync

# Umount any LVM volumes:
if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
  echo "Unmounting LVM volumes."
  /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
fi

echo "Unmounting local file systems."
/bin/umount -v -a -t no,proc,sysfs

echo "Remounting root filesystem read-only."
/bin/mount -v -n -o remount,ro /

# This never hurts:
/bin/sync

# Close any volumes opened by cryptsetup:
if [ -f /etc/crypttab -a -x /sbin/cryptsetup.static ]; then
  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
    # NOTE: we only support LUKS formatted volumes (except for swap)!
    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
    if /sbin/cryptsetup.static isLuks $DEV 2>/dev/null ; then
      echo "Locking LUKS crypt volume '${LUKS}':"
      /sbin/cryptsetup.static luksClose ${LUKS}
    elif echo $OPTS | grep -wq swap ; then
      # If any of the volumes was used as encrypted swap,
      # then run mkswap on the underlying device -
      # in case other Linux installations on this computer should use it:
      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
      /sbin/cryptsetup.static remove ${LUKS}
      mkswap $DEV
    fi
  done
fi

# Deactivate LVM volume groups:
if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
  echo "Deactivating LVM volume groups:"
  /sbin/vgchange -an --ignorelockingfailure
fi

# This never hurts again (especially since root-on-LVM always fails
# to deactivate the / logical volume...  but at least it was
# remounted as read-only first)
/bin/sync

# sleep 3 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
/bin/sleep 3

# This is to ensure all processes have completed on SMP machines:
wait

if [ -x /sbin/genpowerd ]; then
  # See if this is a powerfail situation:
  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
    # Signal UPS to shut off the inverter:
    /sbin/genpowerd -k
    if [ ! $? = 0 ]; then
      echo
      echo "There was an error signaling the UPS."
      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
      echo "the serial line and UPS type."
      # Wasting 15 seconds of precious power:
      /bin/sleep 15
    fi
  fi
fi

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo "Rebooting."
  /sbin/reboot
else
  /sbin/poweroff
fi

Код:
#cat rc.inet1
#! /bin/sh
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
# @(#)/etc/rc.d/rc.inet1 10.2  Sun Jul 24 12:45:56 PDT 2005  (pjv)

############################
# READ NETWORK CONFIG FILE #
############################

# Get the configuration information from /etc/rc.d/rc.inet1.conf:
. /etc/rc.d/rc.inet1.conf

###########
# LOGGING #
###########

# If possible, log events in /var/log/messages:
if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then
  LOGGER=/usr/bin/logger
else # output to stdout/stderr:
  LOGGER=/bin/cat
fi

############################
# DETERMINE INTERFACE LIST #
############################

# Compose a list of interfaces from /etc/rc.d/rc.inet1.conf (with a maximum
# of 6 interfaces, but you can easily enlarge the interface limit
# - send me a picture of such a box :-).
# If a value for IFNAME[n] is not set, we assume it is an eth'n' interface.
# This way, the new script is compatible with older rc.inet1.conf files.
# The IFNAME array will be used to determine which interfaces to bring up/down.
MAXNICS=${MAXNICS:-6}
i=0
while [ $i -lt $MAXNICS ];
do
  IFNAME[$i]=${IFNAME[$i]:=eth${i}}
  i=$(($i+1))
done
if [ "$DEBUG_ETH_UP" = "yes" ]; then
  echo "/etc/rc.d/rc.inet1:  List of interfaces: '${IFNAME[@]}'" | $LOGGER
fi

######################
# LOOPBACK FUNCTIONS #
######################

# Function to bring up the loopback interface.  If loopback is
# already up, do nothing.
lo_up() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    if ! /sbin/ifconfig | grep "^lo" 1> /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo 127.0.0.1" | $LOGGER
      /sbin/ifconfig lo 127.0.0.1
      echo "/etc/rc.d/rc.inet1:  /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo" | $LOGGER
      /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
    fi
  fi
}

# Function to take down the loopback interface:
lo_down() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo down" | $LOGGER
    /sbin/ifconfig lo down
  fi
}

#######################
# INTERFACE FUNCTIONS #
#######################

# Function to bring up a network interface.  If the interface is
# already up or does not yet exist (perhaps because the kernel driver
# is not loaded yet), do nothing.
if_up() {
  # Determine position 'i' of this interface in the IFNAME array:
  i=0
  while [ $i -lt $MAXNICS ]; do
    [ "${IFNAME[$i]}" = "${1}" ] && break
    i=$(($i+1))
  done
  # If the interface isn't in the kernel yet (but there's an alias for it in
  # modules.conf), then it should be loaded first:
  if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet
    if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/modprobe ${1}" | $LOGGER
      /sbin/modprobe ${1}
    fi
  fi
  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists
    if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \
      ! /sbin/ifconfig ${1} | grep "inet addr" 1> /dev/null ; then # interface not up or not configured
      if [ ! "${HWADDR[$i]}" = "" ]; then # Set hardware address _before_ the interface goes up:
        echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}" | $LOGGER
        /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}
      fi
      if [ ! "${MTU[$i]}" = "" ]; then # Set MTU to something else than 1500
        echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} mtu ${MTU[$i]}" | $LOGGER
        /sbin/ifconfig ${1} mtu ${MTU[$i]}
      fi
      if [ -x /etc/rc.d/rc.wireless ]; then
        . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters
      fi
      if [ "${USE_DHCP[$i]}" = "yes" ]; then # use DHCP to bring interface up
        [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}"
        [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -R"
        [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -N"
        [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -G"
        [ ${DHCP_IPADDR[$i]} ] && DHCP_OPTIONS="$DHCP_OPTIONS -s ${DHCP_IPADDR[$i]}"
        echo "Polling for DHCP server on interface ${1}:"
        # If you set a timeout, you get one, even if the kernel doesn't think that
        # your device is connected, in case /sys isn't right (which it usually isn't
        # except right after the device is loaded, when it usually is):
        #### (start commented out)
        # This is deactivated for now since the kernel has been returning incorrect
        # results concerning whether the interface carrier is detected.
        #if [ "${DHCP_TIMEOUT[$i]}" = "" ]; then
        #  ifconfig ${1} up && sleep 1
        #  CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)"
        #  ifconfig ${1} down
        #  if [ "$CONNSTATUS" = "0" ]; then
        #    # The kernel has just told us the cable isn't even plugged in, but we will
        #    # give any DHCP server a short chance to reply anyway:
        #    echo "No carrier detected on ${1}.  Reducing DHCP timeout to 10 seconds."
        #    DHCP_TIMEOUT[$i]=10
        #  fi
        #fi
        #### (end commented out)
        # 30 seconds should be a reasonable default DHCP timeout.  60 was too much.  :-)
        echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}" | $LOGGER
        /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}
      else # bring up interface using a static IP address
        if [ ! "${IPADDR[$i]}" = "" ]; then # skip unconfigured interfaces
          # Determine broadcast address from the IP address and netmask:
          BROADCAST[$i]=`/bin/ipmask ${NETMASK[$i]} ${IPADDR[$i]}|cut -f1 -d' '`
          # Set up the network card:
          echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
          /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
      fi
    else
      if [ "$DEBUG_ETH_UP" = "yes" ]; then
        echo "/etc/rc.d/rc.inet1:  ${1} is already up, skipping" | $LOGGER
      fi
    fi
  else
    if [ "$DEBUG_ETH_UP" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  ${1} interface does not exist (yet)" | $LOGGER
    fi
  fi
}

# Function to take down a network interface:
if_down() {
  # Determine position 'i' of this interface in the IFNAME array:
  i=0
  while [ $i -lt $MAXNICS ]; do
    [ "${IFNAME[$i]}" = "${1}" ] && break
    i=$(($i+1))
  done
  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then
    if [ "${USE_DHCP[$i]}" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
      /sbin/dhcpcd -k -d ${1} 2> /dev/null || /sbin/ifconfig ${1} down
      sleep 1
    else
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} down" | $LOGGER
      /sbin/ifconfig ${1} down
    fi
    if [ -x /etc/rc.d/rc.wireless ]; then
      . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any.
    fi
  fi
}

#####################
# GATEWAY FUNCTIONS #
#####################

# Function to bring up the gateway if there is not yet a default route:
gateway_up() {
  if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    if [ ! "$GATEWAY" = "" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER
      /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER
    fi
  fi
}

# Function to take down an existing default gateway:
gateway_down() {
  if /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/route del default" | $LOGGER
    /sbin/route del default
  fi
}

# Function to start the network:
start() {
  lo_up
  for i in ${IFNAME[@]} ; do
    if_up $i
  done
  gateway_up
}

# Function to stop the network:
stop() {
  gateway_down
  for i in ${IFNAME[@]} ; do
    if_down $i
  done
  lo_down
}


############
### MAIN ###
############

case "$1" in
'start') # "start" brings up all configured interfaces:
  start
  ;;
'stop') # "stop" takes down all configured interfaces:
  stop
  ;;
'restart') # "restart" restarts the network:
  stop
  start
  ;;
*_start) # Example: "eth1_start" will start the specified interface 'eth1'
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_up $INTERFACE
  gateway_up
  ;;
*_stop) # Example: "eth0_stop" will stop the specified interface 'eth0'
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  ;;
*_restart) # Example: "wlan0_restart" will take 'wlan0' down and up again
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  sleep 1
  if_up $INTERFACE
  gateway_up
  ;;
'up') # "up" does the same thing as "start"
  start
  ;;
'down') # "down" does the same thing as "stop"
  stop
  ;;
*_up) # "*_up" does the same thing as "*_start"
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_up $INTERFACE
  gateway_up
  ;;
*_down) # "*_down" does the same thing as "*_stop"
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  ;;
*) # The default is to bring up all configured interfaces:
  start
esac

# End of /etc/rc.d/rc.inet1
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

neter

  • Global Moderator
  • Напреднали
  • *****
  • Публикации: 3408
  • Distribution: Debian, SailfishOS, CentOS
  • Window Manager: LXDE, Lipstick
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #13 -: Nov 18, 2009, 17:00 »
Явно си настроил IP-то ти да се взема по DHCP. Ако не използваш или спреш да използваш DHCP, за да си вземаш IP-то, можеш да коментираш редове от 107 до 113, 133, 134, 135 и 147 от файла rc.inet1. Ще остане функцията за вдигане на интерфейсите със статично зададени IP-та и dhcpd няма да се изпълнява.
Активен

"Да си добре приспособен към болно общество не е признак за добро здраве" - Джиду Кришнамурти

b2l

  • Напреднали
  • *****
  • Публикации: 4786
  • Distribution: MCC Interim
  • Window Manager: - // - // -
  • ...sometimes I feel like screaming... || RTFM!
    • Профил
    • WWW
Re: dhcpcd <defunct>
« Отговор #14 -: Nov 18, 2009, 17:16 »
Сега ги погледнах, ами то хубаво, само че на мен ми трябва dhcp-то.
Направими още нещо впечатление: когато търся нещо с find винаги ми изкарва един ред от рода на:
Код:
find: /proc/3344/net: Invalid argument
където 3344 е PID-а на dhcpcd <defunct>-a.
Май за сега ще го оставя така, вярно че не ми преди, но го видях преди време, а google не ми помогна с нищо. Мерси все пак :)
Активен

"Човекът е въже, опънато между звяра и свръхчовека, въже над пропаст. Човекът е нещо, което трябва да бъде превъзмогнато." - Фр. Ницше

Подобни теми
Заглавие Започната от Отговора Прегледи Последна публикация
За dhcpcd в Slackware9.1
Настройка на програми
R4 2 2262 Последна публикация Jun 23, 2004, 22:21
от R4
dhcpcd problem
Настройка на програми
509 2 1850 Последна публикация Sep 26, 2004, 12:52
от 509
IPW2200 и проблеми с dhcpcd
Настройка на хардуер
blazarov 2 1819 Последна публикация Oct 07, 2005, 12:24
от blazarov
Dhcpcd -dn wlan0 -> timed out waiting ...
Хардуерни и софтуерни проблеми
botzko 0 4530 Последна публикация Oct 28, 2008, 08:27
от botzko