Титла: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 13:18
#ps -A | grep dhcp 3344 ? 00:00:00 dhcpcd <defunct>
Какво е това <defunct> и защо не мога да го kill-на?
Титла: Re: dhcpcd <defunct>
Публикувано от: lkr в Nov 18, 2009, 13:34
Това е умрял child процес и е станал зомби, защото parent-а не е извикал wait(). Почти невредим е, тъй като всички ресурси са освободени, ползва се за да се пази ID-то
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 13:41
А няква идея как да го махна?
Титла: Re: dhcpcd <defunct>
Публикувано от: lkr в Nov 18, 2009, 13:44
Като убиеш parent-a.
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 13:49
Добре де. Това ми е ясно, не трябваше да задавам глупави въпроси. Само че има нещо друго, лаптоп-а ми е изключен, пускам го, логвам се и не мога да разбера кой и от къде го създава този процес? Така де въпроса ми е от къде се появява?
Титла: Re: dhcpcd <defunct>
Публикувано от: ntrance в Nov 18, 2009, 14:44
А няква идея как да го махна?
Рестарт ..!
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 14:59
Не става. Вечер си спирам лаптоп-а. Сутрин го пускам правя едно: и се появява това <defunct>
Титла: Re: dhcpcd <defunct>
Публикувано от: neter в Nov 18, 2009, 15:53
Махни symlink-а от rc папката за init-а, който ползваш. Беше хубаво да кажеш за Slackware-а или за Ubuntu-то говориш (съдейки по профила ти), но щом не казваш, търси rc папката някъде из /etc ;)
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 16:02
Моя грешка, значи говоря за Slack-a. Кой файл да търся? Нещо се обърках.
Титла: Re: dhcpcd <defunct>
Публикувано от: neter в Nov 18, 2009, 16:06
Предполагам, че файлът трябва да е в /etc/rc.d папката. Може би кръстен rc.dhcpd или нещо подобно. Ако не е symlink, а е самият скрипт, не го изтривай, а си го запази някъде извън /etc/rc.d.
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в 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
Титла: Re: dhcpcd <defunct>
Публикувано от: neter в Nov 18, 2009, 16:30
Няма значение дали файловете в /etc/rc.d са symlink-ове или реални скриптове. Важното е присъствието им в тази папка, тъй като файловете от тази папка се изпълняват при включването на системата. Виждам, че имаш някакво изпълнение на /sbin/dhcpd в rc.0, rc.6 и rc.inet1, но давайки само изхода от grep, не може да се види какво има около тези редове, за да се разбере какво точно се случва при изпълнението на скрипта. Покажи съдържанието на тези 3 файла.
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в 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
Титла: Re: dhcpcd <defunct>
Публикувано от: neter в Nov 18, 2009, 17:00
Явно си настроил IP-то ти да се взема по DHCP. Ако не използваш или спреш да използваш DHCP, за да си вземаш IP-то, можеш да коментираш редове от 107 до 113, 133, 134, 135 и 147 от файла rc.inet1. Ще остане функцията за вдигане на интерфейсите със статично зададени IP-та и dhcpd няма да се изпълнява.
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 17:16
Сега ги погледнах, ами то хубаво, само че на мен ми трябва dhcp-то. Направими още нещо впечатление: когато търся нещо с find винаги ми изкарва един ред от рода на: find: /proc/3344/net: Invalid argument където 3344 е PID-а на dhcpcd <defunct>-a. Май за сега ще го оставя така, вярно че не ми преди, но го видях преди време, а google не ми помогна с нищо. Мерси все пак :)
Титла: Re: dhcpcd <defunct>
Публикувано от: neter в Nov 18, 2009, 20:44
Щом DHCP-то ти трябва, няма защо да се противиш на наличието на процеси, свързани с работата му. Все едно да се противиш, че в резервоарчето на колата има течност за чистачки, която седи неизползвана в момента. Някак не е удобно всеки път да наливаш, когато и колкото ти е нужно. Относно грешката, която изкарва find, струва ми се, че става дума за съвпадение на номерата. Все пак, покажи какво е съдържанието на папката, какви са правата на тази папка и файловете вътре, и с какъв потребител изпълняваш find.
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 20:58
# ls -la /proc/3344/net /bin/ls: reading directory /proc/3344/net: Invalid argument total 0
Като root си изпълнявам командите. # ls -la /proc/3344/ /bin/ls: cannot read symbolic link /proc/3344/cwd: No such file or directory /bin/ls: cannot read symbolic link /proc/3344/root: No such file or directory /bin/ls: cannot read symbolic link /proc/3344/exe: No such file or directory total 0 dr-xr-xr-x 7 root root 0 2009-11-18 13:15 ./ dr-xr-xr-x 138 root root 0 2009-11-18 10:14 ../ dr-xr-xr-x 2 root root 0 2009-11-18 16:10 attr/ -r-------- 1 root root 0 2009-11-18 16:10 auxv --w------- 1 root root 0 2009-11-18 16:10 clear_refs -r--r--r-- 1 root root 0 2009-11-18 13:15 cmdline -rw-r--r-- 1 root root 0 2009-11-18 16:10 coredump_filter lrwxrwxrwx 1 root root 0 2009-11-18 16:10 cwd -r-------- 1 root root 0 2009-11-18 16:10 environ lrwxrwxrwx 1 root root 0 2009-11-18 16:10 exe dr-x------ 2 root root 0 2009-11-18 16:10 fd/ dr-x------ 2 root root 0 2009-11-18 16:10 fdinfo/ -r-------- 1 root root 0 2009-11-18 16:10 limits -r--r--r-- 1 root root 0 2009-11-18 16:10 maps -rw------- 1 root root 0 2009-11-18 16:10 mem -r--r--r-- 1 root root 0 2009-11-18 16:10 mountinfo -r--r--r-- 1 root root 0 2009-11-18 16:10 mounts -r-------- 1 root root 0 2009-11-18 16:10 mountstats dr-xr-xr-x 2 root root 0 2009-11-18 16:10 net/ -rw-r--r-- 1 root root 0 2009-11-18 16:10 oom_adj -r--r--r-- 1 root root 0 2009-11-18 16:10 oom_score -r-------- 1 root root 0 2009-11-18 16:10 pagemap lrwxrwxrwx 1 root root 0 2009-11-18 16:10 root -r--r--r-- 1 root root 0 2009-11-18 16:10 smaps -r--r--r-- 1 root root 0 2009-11-18 13:15 stat -r--r--r-- 1 root root 0 2009-11-18 16:10 statm -r--r--r-- 1 root root 0 2009-11-18 13:15 status dr-xr-xr-x 3 root root 0 2009-11-18 16:10 task/ -r--r--r-- 1 root root 0 2009-11-18 16:10 wchan
Ако се опитам да изтрия някой от symlink-овете ми дава грешка: /proc/3344# rm -rf exe rm: cannot remove `exe': Permission denied
Титла: Re: dhcpcd <defunct>
Публикувано от: ntrance в Nov 18, 2009, 21:18
Просто мнение , това е зомби процес и най лошото е че не се килва . Оправя се след рестарт ;( аз имах поне 4 такива зомбита останаха само 2 . И след като се опитам да ги килна немога едно че са мъртви процеси 2-ро че си сменят PID постояно. За примерно може сам да се увериш ps aux | awk '{ print $8 " " $2 }' | grep -w Z
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 21:35
Само че при мен след рестарт не се оправя, просто си сменя PID-a. Сега ще рестартирам и ще ви кажа новия PID.
Титла: Re: dhcpcd <defunct>
Публикувано от: ntrance в Nov 18, 2009, 21:37
Ха май стана :Д ама ми умря сървъра.!! ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'
И килваш на ред после вдигни сървисите , ако си килнал тях. Пробвай ....
Титла: Re: dhcpcd <defunct>
Публикувано от: b2l в Nov 18, 2009, 21:44
Разбрах къде е проблема. Само да кажа, че сега го няма, но рестартирах 2 пъти. Това <defunct> се получава след login-а. При логин, аз пиша root и след това си изпълнявам един скрипт (ръчно го стартирам) който ми пусна KDE-то и също така ме connect-ва към wi-fi мрежата в къщи. Само че като го пусна този скрипт някой път (не знам защо) стига дo изпълнението на dhclient-а и не се връзва. Трябва да убия dhclient-a и да стартирам скрипта на ново. При второто стартиране се connect-вам, тръгва ми KDE-то но процеса dhcpcd става <defunct>. Сега при ps-a ми излиза това: # ps -A | grep dhcp* 3353 ? 00:00:00 dhclient А преди малко нямах процес: dhclient.
|