# hostname always 'livecd' at boot

## jeffbuttars

After I finish booting my hostname is always 'livecd'. If I run /etc/init.d/hostname then the correct hostname will be set.

I've set the hostname in /etc/conf.d/hostname and I run the hostname init.d script at boot.

Any ideas?

I've greped /etc/ for the 'livecd' string but didn't find anything that looked a cause to the problem.

When I installed I tried to use the GUI installer but it didn't work so I ended up finishing the install manually at the command line. Not sure if that has something to do with it.

----------

## alex.blackbit

you said you grepped for the string in the whole /etc.

are you sure there is nothing wrong in /etc/hosts?

----------

## jeffbuttars

I've checked /etc/hosts and no mention of the string 'livecd'.

Could be in the kernel somehow?

----------

## eulogious

I would try running "hostname -f", "hostname -s", and "hostname -d" and see what the output of that is.  If you FQDN is correct (host file), then you should get the name of your computer according to your hosts file.  This way you can tell if you set up your hosts file correctly.  If you are curious to what the options are on the command hostname, just man it  :Wink: 

----------

## tgR10

/etc/conf.d/hostname

----------

## jeffbuttars

/etc/conf.d/hostname is set correctly.

It has one line, HOSTNAME="myhostname"

As a stated before, when I run /etc/init.d/hostname after boot it will set the hostname to the value in /etc/conf.d/hostname.

The weird thing is I can watch it boot and it tells me that /etc/init.d/hostname is being ran at boot.

But upon a fresh boot a console will read username@livecd and kdm will say 'Welcome blah blah livecd'.

I can then manually run /etc/init.d/hostname and all consolse/terminals and kdm(after a restart) will use the hostname from /etc/conf.d/hostname.

If hostname was not being set at all it would default to localhost right?

So what is causing it to be set to livecd during boot? There must be an artifact from the install some were.

After runing /etc/init.d/hostname manually after boot.

hostname -v gives:

gethostname()=`myname'

myname

hostname -d prints nothing

hostname -s prints:

localhost

hostname -f prints:

localhost

So here is a question, in my /etc/hosts the first name for the 127.0.0.1 line is localhost  followed by myname and myname.mydomain.something .

Should myname come before localhost on that line?

Ahh, just tried changing the order of the name list in hosts and it made a difference. 

now hostname -s, -f  return myname instead of localhost. So that answers my question.

I'll try a reboot and see what happens.

----------

## magic919

Hopefully you've cracked it, but for reference http://gentoo-wiki.com/TIP_Setup_Your_FQDN

----------

## jeffbuttars

After a reboot it still sets the hostname to livecd   :Sad: 

----------

## magic919

Oh what fun.  What about something else.  Are you on a network?  Is DHCP server giving it that hostname?  Maybe unplug and boot.

----------

## jeffbuttars

I wish it was the lease but it's not. 

It happens every boot no matter what.

FYI: I have my .bashrc checking the hostname and running /etc/init.d/hostname if the hostname is livecd. So at the first login the situation is corrected. But this does not work with kdm. So kdm starts an xsession with the hostname as livecd then the first time I open a terminal the hostname is set correctly. This seems to message up various sockets used by KDE and whatever else and can create some undesirable results.

Also, I need to stress how bad the install went. After the GUI installer failed I did a manual install. I tried to use genkernel during the manual install and that created all sorts of problems. I ended up fixing a very botched install and got a working system. This was a few months ago. I've never been able get the hostname name to work correctly. But everything else has been OK so far. 

I keep thinking maybe there is a binary some were, an artifact from the install, that is causing the issue. 

I'll re-emerge net-tools, it can't hurt.

----------

## Sadako

I have a slightly related issue, but I've just being ignoring it.

My hostname works fine, however my crappy adsl router always seems to identify my box as "livecd".

In the past it just didn't recognize any hostname for the machine (just a '-').

I'm not using dhcp at all.

The only thing that I can think of that might be behind it is that I'm using baselayout 2, and I was just wondering if the same might be true of the OP?

It's not a problem for me, but I would like to know where the hell that "livecd" was coming from...

----------

## jeffbuttars

My baselayout version is  1.12.10-r5. 

Hopeless, 

would you happen to be running NetworkManager? It's next on my list of suspicious software regarding the issue.

----------

## Sadako

 *jeffbuttars wrote:*   

> would you happen to be running NetworkManager? It's next on my list of suspicious software regarding the issue.

 Nope, no wireless so I just set everything in the /etc/conf.d/net config file.

----------

## jeffbuttars

So I tried a couple reboots with and without NetworkManager and everything worked as desired. So it's not NetworkManager.

It seems fixed.

A recap:

I had re-emerged net-tools, I think that was the fix, and also set up my hosts just as recommended in:

http://gentoo-wiki.com/TIP_Setup_Your_FQDN

I checked on the package and it's last update was 11/07. Which for me means I could have installed it at the initial system install and never had an update for it since. 

my original net-tools may have been a livecd specific package that got onto my system? who knows.

Hopeless, 

I'm curious if a re-emerge of net-tools would help your hostname issue as well.

----------

## Sadako

 *jeffbuttars wrote:*   

> Hopeless, 
> 
> I'm curious if a re-emerge of net-tools would help your hostname issue as well.

 I'll try that, however I won't know whether it has any affect or not till I either reboot my desktop or my router, neither of which I'll be doing for a while...

Anyway, according to genlop I've emerged net-tools 7 times on this box already, the last time being 20th november.

----------

## jeffbuttars

 :Smile: 

Thank you everyone for your help. Discussing it seemed to have lead me in the right direction. 

Unfortunately I don't know what the exact fix was, but it does appear to be fixed.

----------

