ubuntu server 12.04 can not remove dhcp-client

19,229

Solution 1

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.

Solution 2

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.

Solution 3

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:
19,229

Related videos on Youtube

rgc
Author by

rgc

Updated on September 18, 2022

Comments

  • rgc
    rgc almost 2 years

    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
    
    • Chida
      Chida almost 12 years
      Can you post your /etc/network/interfaces file?
    • rgc
      rgc almost 12 years
      i have post my interface file
    • Chida
      Chida almost 12 years
      See my answer below to update the interfaces file
    • Kcmamu
      Kcmamu over 11 years
      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.
  • rgc
    rgc almost 12 years
    i am sorry, i have lost #, it was commented in interface file. when copy from file, i lost it.
  • hpcodeit
    hpcodeit over 11 years
    This is ineffective in 12.04 or 12.10. As mgorven pointed out, dhclient is still running in the background.