# Suddenly NetworkManager resets hostname

## el3ktro

I recently updated to dbus-1.0.1, which caused a revdep-rebuild of almost all Gnome-related packages. Since then, whenever NetworkManager starts, it resets the hostname to "dhcppc1" - which causes problems. Why does NetworkManager suddenly do this and how can I stop it from doing this!?

Tom

----------

## kill

Network manager uses the dhclient daemon to for dhcp.  The config file for it is located at /etc/dhcp/dhclient.conf.

You need something like this in your config file.

```
interface "ep0" {

           send host-name "andare.fugue.com";

}
```

----------

## BigBaaadBob

 *kill wrote:*   

> Network manager uses the dhclient daemon to for dhcp.  The config file for it is located at /etc/dhcp/dhclient.conf.
> 
> You need something like this in your config file.
> 
> ```
> ...

 

Can this be done such that the configured hostname (in /etc/conf.d/hostname) gets sent?  I notice this email that implies maybe some gentoo-specific code should "just doo it!"

----------

## UberLord

We patch dhclient to accept configuration via stdin (really easy patch too). So you can do this

```
echo "interface eth0 { send host-name \"$(hostname)\"; }" | dhclient eth0
```

No idea how to tell NetworkManager how to do that though.

----------

## el3ktro

 *BigBaaadBob wrote:*   

>  *kill wrote:*   Network manager uses the dhclient daemon to for dhcp.  The config file for it is located at /etc/dhcp/dhclient.conf.
> 
> You need something like this in your config file.
> 
> ```
> ...

 

Hi, sorry for my late answer. I tried your solution, but it doesn't work. I tried putting "ep0", "ep1" and "eth1" into the config file - but it does not work. Instead of dhcppc1 I now get the hostname dhcppc3. Hmm. Any other solutions around?

Tom

----------

## Simom

I had the same problem too. I found out that downgrading from networkmanager-0.6.4_pre20061028-r1 to 0.6.4_pre20061028 fixed this in my case.

----------

## cato`

I have this problem too, are there any real fixes for this except downgrading it to the previous version?

----------

## dony

Hi ALL,

set hostname in /etc/dhcp/dhclient.conf:

send host-name "<your_hostname>";

supersede host-name "<your_hostname>";

regards 

dony

----------

## BigBaaadBob

 *dony wrote:*   

> 
> 
> set hostname in /etc/dhcp/dhclient.conf:
> 
> send host-name "<your_hostname>";
> ...

 

Did that.  Doesn't seem to have any effect.  What version of NetworkManager are you using?

----------

## gour

 *Simom wrote:*   

> I had the same problem too. I found out that downgrading from networkmanager-0.6.4_pre20061028-r1 to 0.6.4_pre20061028 fixed this in my case.

 

Thanks.   :Cool: 

The above 'workaround' solves the problem here as well (I had to apply dbus-1.patch too), but the 'new' NM behaviour is irritating at least - by changing  hostname when connected to wifi network in the local library, I was not able to execute any gui program,   :Mad:   getting famous 

```
Xlib: connection to ":0.0" refused by server
```

Will try today on #gentoo-desktop to get more info about the problem and some workaround for the latest NM   :Rolling Eyes: 

Sincerely,

Gour

----------

## Simom

I was later forced to update networkmanager (don't remember the reason, might have been the new dbus), and that dony's config in /etc/dhcp/dhclient.conf corrected the problem for me. Now my networkmanager version is 0.6.4_pre20061028-r1.

----------

## dony

 *BigBaaadBob wrote:*   

>  *dony wrote:*   
> 
> set hostname in /etc/dhcp/dhclient.conf:
> 
> send host-name "<your_hostname>";
> ...

 

0.6.4_pre20061028-r1

----------

## gour

 *Simom wrote:*   

> I was later forced to update networkmanager (don't remember the reason, might have been the new dbus), and that dony's config in /etc/dhcp/dhclient.conf corrected the problem for me. 

 

The dony's workaround helps with keeping the hostname, but I still cannot launch gui apps after the connection is established, so i had to downgrade to networkmanager-0.6.4_pre20061028 with dbus-1.patch.

It looks like updatedbackend.patch does something more under the hood   :Confused: 

Sincerely,

Gour

----------

## dony

 *gour wrote:*   

>  *Simom wrote:*   I was later forced to update networkmanager (don't remember the reason, might have been the new dbus), and that dony's config in /etc/dhcp/dhclient.conf corrected the problem for me.  
> 
> The dony's workaround helps with keeping the hostname, but I still cannot launch gui apps after the connection is established, so i had to downgrade to networkmanager-0.6.4_pre20061028 with dbus-1.patch.
> 
> It looks like updatedbackend.patch does something more under the hood  
> ...

 

Hi gour,

was your hostname configured in /etc/conf.d/hostname - I had trouble with this after "blind" etc-update  :Wink: 

I have no trouble with GUI's ...

Dony

----------

## gour

 *dony wrote:*   

> 
> 
> Hi gour,
> 
> was your hostname configured in /etc/conf.d/hostname - I had trouble with this after "blind" etc-update 
> ...

 

Yes, it is. 

For the moment I'm happy with downgraded NM   :Very Happy: 

Sincerely,

Gour

----------

