Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I change network from dhcp to static, it will periodically change IP to the dhcp configuration and ignore the configuration of /etc/network/interface.

So I want to remove the dhcp-client, however when I remove it in Ubuntu, I encounter this problem. Can you give me some help ?

$ sudo apt-get remove dhcp-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
**Virtual packages like 'dhcp-client' can't be removed**
0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.

this is my interface file content:

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.7
netmask 255.255.255.0
gateway 10.0.0.1
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto
share|improve this question
    
Can you post your /etc/network/interfaces file? –  Chida Aug 14 '12 at 5:03
    
i have post my interface file –  rgc Aug 14 '12 at 7:07
    
See my answer below to update the interfaces file –  Chida Aug 14 '12 at 7:14
    
I've seen this on a bunch of systems I was in the process of setting up recently after manually editing /etc/network/interfaces and restarting networking, I kept seeing hosts disappear. As I hadn't commissioned the systems, I was able to reboot them, which solved the problem. –  Bryan Nov 19 '12 at 9:04

5 Answers 5

up vote 1 down vote accepted

I never had Ubuntu behave like this, so this is just a wild guess: It could have something to do with 'network-manager'.

As to the removal of dhcp-client:

You are trying to remove a virtual package. Virtual packages don't really exist they are just provided by some packages to declare they provide a similar service/function (see also Debian Policy Manual). IIRC the default dhcp-client package installed by ubuntu is 'isc-dhcp-client', but no mater which one is installed on your system you probably will have a rather hard time removing it cleanly as quite some other packages depend on it being installed.

share|improve this answer
    
actually, what you have said is right, i can remove isc-dhcp-client from my ubuntu, and i learn about what is virtual package, thank you! I will see whether if dhcp-client cause this problem. –  rgc Aug 14 '12 at 7:16

You probably didn't take the interface down before reconfiguring it, and so there is still a DHCP client running in the background trying to maintain the DHCP IP. Check for this with ps -eF | grep dhclient and kill the process.

If you really want to uninstall the DHCP client (which you shouldn't need to), you need to remove the dhcp3-client package.

share|improve this answer
    
when i type this in terminal : ps -eF | grep dhclient. it shows nothing, and i also sudo apt-get remove dhcp3-client, it shows that i did not install it any more. –  rgc Aug 14 '12 at 7:11

This is the problem line,

iface eth0 inet dhcp

Remove it and restart your networking.

$ sudo service networking restart
share|improve this answer
    
i am sorry, i have lost #, it was commented in interface file. when copy from file, i lost it. –  rgc Aug 14 '12 at 7:20
    
This is ineffective in 12.04 or 12.10. As mgorven pointed out, dhclient is still running in the background. –  brianbaligad Nov 19 '12 at 8:07

I've got the same problem. My not so scientific test found this solution. Put network and broadcast in interace config too. Like this:

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.7
network 10.0.0.0
broadcast 10.0.0.255
netmask 255.255.255.0
gateway 10.0.0.1
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto
share|improve this answer

You need to remove the isc-dhcp-client completely. If DNS-server addresses are configured both in the isc-dhcp-client and in /etc/network/interfaces file the addresses in the client configuration always take precedence and will be the ones that are written to /etc/resolv.conf. If you want the dns-servers setting in /etc/network/interfaces to be written to /etc/resolv.conf you will have to remove the isc-dhcp-client completely.

The apt-get --purge remove isc-dhcp-client isc-dhcp-common command will do just that. If that does not do the trick find and remove these two files:

/run/resolvconf/interface/eth0.dhclient and /run/resolvconf/interface/original.resolvconf

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.