Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9529 - /etc/init.d/net.eth? stops dhcpcd incorrectly
Summary: /etc/init.d/net.eth? stops dhcpcd incorrectly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Low minor (vote)
Assignee: Martin Schlemmer (RETIRED)
URL: http://forums.gentoo.org/viewtopic.ph...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-22 23:50 UTC by Matt Boehlig
Modified: 2003-12-06 03:34 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Boehlig 2002-10-22 23:50:37 UTC
dhcpcd should not be stopped with /sbin/dhcpcd -k ${IFACE}.         
During normal shutdown of the system, dhcpcd should be killed with SIGTERM not                
SIGHUP, as the -k option does.              
                
This is described in man dhcpcd:                
                   
-k     Sends SIGHUP signal to the dhcpcd process  that  is                   
       currently  running.  If  dhcpcd  receives SIGHUP it                   
       will send DCHP_RELEASE message to  the  server  and                   
       destroy  dhcpcd  cache.  In  a case dhcpcd receives                   
       SIGTERM which is normally used by shutdown(8)  when                   
       rebooting   the   system   dhcpcd   will  not  send                   
       DHCP_RELEASE and will not destroy cache. When  sys-                   
       tem boots dhcpcd will use cache to request the same                   
       IP address from  DHCP  server  which  was  assigned                   
       before the system went down.                
                
and also in this <a href="http://forums.gentoo.org/viewtopic.php?t=17056">post              
</a>.              
          
/sbin/dhcpcd -k ${IFACE} &>/dev/null          
            
should be changed to            
           
kill -SIGTERM `cat /var/run/dhcpcd-${IFACE}.pid` &>/dev/null           
          
The post recommended kill `pidof dhcpcd`.  I'm not sure if this whould work         
right with multiple network cards. Does a single dhcpcd process handle all         
devices or one process per device?   
   
I see processes named:         
dhcpcd   (/var/run/dhcpcd-eth1.pid)     
eth0     (static ip)     
eth1     (dhcp ip)     
      
Can someone test out my proposal that has dhcp control 2 or more cards?  
  
By the way, which component does this belong in: core system, applications, 
....  There should be a startup scripts component.
Comment 1 SpanKY gentoo-dev 2002-10-23 11:32:59 UTC
see Bug 2175 for the reason
Comment 2 SpanKY gentoo-dev 2002-10-23 11:33:27 UTC
err, ill let azarah decide ;)
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-27 10:43:54 UTC
I dont have a problem changing it.  Problem though is that I do not use
dhcp ... so cannot test this ....
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-11-07 01:31:50 UTC
Anybody with dhcp experience willing to vouch on this ?

Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-25 21:01:11 UTC
Ok, what about if we are shutting down the machine (no reboot), we send
a SIGHUP, but if we are rebooting, we send a TERM ?
Comment 6 Wout Mertens (RETIRED) gentoo-dev 2003-03-19 08:43:11 UTC
Let's do what you propose in comment #5, if it is easy to detect that. 
The kill -TERM `cat /var/run/dhcpcd-${IFACE}.pid` should indeed work. 
Alternative is to not do anything, and let init send the SIGTERM :) 
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-21 02:09:31 UTC
It will need some magic in /sbin/rc, but not too much ;)  Ill have a look
and attach a patch.  Everybody ok if we use 1.8.6.4 as testing ground ?
Comment 8 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-06 13:21:12 UTC
baselayout-1.8.6.5 should have:

HALT=reboot

or

HALT=shutdown

depending on what it is doing.

net.eth0 have changed a bit though, so I did not do any changes to it.
Comment 9 Alwyn Schoeman 2003-05-29 21:22:53 UTC
Am I correct that the approach proposed is different between whether you shut down or reboot?

This is wrong.  Whether I reboot or shutdown I always want to request the same IP address.

I see only 2 options:

1) Always SIGTERM, so you always keep the same address.  If the address you want is not available anymore then you just get a new one anyway.

2) Have a configuration option somewhere where the use indicates his preference e.g.  KeepAddress = Yes/No.
Comment 10 Daniel Robbins (RETIRED) gentoo-dev 2003-09-06 16:47:32 UTC
dhcpcd-1.3.22_p4-r1 now has a -z option which will allow shutdown of dhcpcd *but* will keep the cache file. So if baselayout starts using -z and depending on the new dhcpcd in some way, this problem should be resolved.
Comment 11 Andrew Cooks (RETIRED) gentoo-dev 2003-12-06 03:34:43 UTC
Baselayout now uses -z. Resolving as fixed, as per comment #10