# Gentoo seems to be forgetting my hostname every reboot

## nileshp87

So I am taking the plunge into gentoo, and did my first somewhat successful install (i.e it boots) two days ago.

I followed this guide: http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml

The RAID\LVM2 are working.

The problem I have is that everytime I boot I get a hostname that is assigned by my dhcp server. (new-host-5 in this case). 

If I set the hostname manually, via 

```
hostname patelser
```

then running hostname returns patelser, logging and and logging out causes my bash prompt to update as well. Here are the relevant files (just after boot, not I have set dhcpcd to default run-level via rc-update add dhcpcd default):

/etc/conf.d/hostname:

```
# Set to the hostname of this machine

hostname="patelser"
```

/etc/hosts:

```
127.0.0.1 patelser.pateldom patelser localhost
```

/etc/conf.d/net:

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc*/net.example* and save your configuration

# in /etc/conf.d/net (this file :]!).

#config_eth0="192.168.1.7 netmask 255.255.255.0 brd 192.168.1.255"

```

/proc/sys/kernel/hostname:

```

new-host-5

```

I've been googling like crazy, it may be because I don't know the correct phrasing for what is happening, so I apologize if this has been answered before.

Thanks for any help.

----------

## cach0rr0

are you using dhcpcd as a client? 

if so, have a look at /etc/dhcpcd.conf

namely this bit:

```

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

```

the other interesting bits are going to be in `man dhcpcd.conf` and `man dhcpcd`

----------

## Randy Andy

Yes cach0rr0,

i have had a similar error in the past, only if i was logged into a Network of one LUG i visit regular.

Then i wasn't able to start applications when logged into my KDE.

The reason was a different hostname of my box got in this Network.

 *cach0rr0 wrote:*   

> are you using dhcpcd as a client? 
> 
> if so, have a look at /etc/dhcpcd.conf
> 
> namely this bit:
> ...

 

After commenting out only the host_name entry of the /etc/dhcpcd.conf,

the spook has gone.

So much success nileshp87 with it.

Regards, Andy.

----------

## nileshp87

if I remember correctly that line does exist in my dhcpcd.conf file, and I am using it as a client. Although, I have to wait t'ill I get home to check for sure. This is the first I've heard of the fix though so it is looking up already.

----------

