You are not logged in.

#1 2012-10-20 07:05:36

agkbill
Member
Registered: 2011-06-13
Posts: 85

[SOLVED] Hostname always get set to localhost despite setting in...

Hi,

For some reason my hostname always get set to "localhost", but I want to have Arch for hostname.


My configuration:

[christer@localhost ~]$ cat /etc/hostname

#Hostname

Arch


[christer@localhost ~]$ 
[christer@localhost ~]$ cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	Arch.localhost.localdomain	localhost.localdomain	localhost	Arch
::1		Arch.localhost.localdomain	localhost.localdomain	localhost	Arch

192.168.1.101	torr
192.168.1.111	bubba
192.168.1.102	fuel

# End of file
[christer@localhost ~]$

I use static IP assigned with netcfg.

[christer@localhost ~]$ cat /etc/network.d/eth0-static 
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.1.100'
ROUTES=('192.168.0.0/24 via 192.168.1.1')
GATEWAY='192.168.1.1'
DNS=('192.168.1.1')

## For IPv6 autoconfiguration
IP6=stateless

## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'
[christer@localhost ~]$ 
[christer@localhost ~]$

In rc.conf I have.

DAEMONS=(hwclock syslog-ng net-profiles netfs crond dbus cupsd mpd mpdscribble autofs iptables munin-node)

Is it something in my /etc/hosts config thar missing so it defaults to localhost?

Any ide whay I do not ger "Arch" as hostname?

Best regards,
/Christer

Last edited by agkbill (2012-10-20 08:59:47)

Offline

#2 2012-10-20 07:29:10

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Hostname always get set to localhost despite setting in...

I think your hosts file is wrong.  This is what the archiso hosts file contains:

 cat hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain	localhost	archiso
::1		localhost.localdomain	localhost	archiso

# End of file

Offline

#3 2012-10-20 07:30:31

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 124

Re: [SOLVED] Hostname always get set to localhost despite setting in...

/etc/hostname should contain just a single line with your hostname, remove those empty lines and comments.

Offline

#4 2012-10-20 07:37:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Hostname always get set to localhost despite setting in...

@ghen, you are right about this.  But when I have seen this fudging things up, it usually ends up the hostname being the comment (in this case #hostname).  Do you think that it is actually setting it as a blank line?

Offline

#5 2012-10-20 08:59:00

agkbill
Member
Registered: 2011-06-13
Posts: 85

Re: [SOLVED] Hostname always get set to localhost despite setting in...

The problem was the empty lines and comment in /etc/hostname.

I tried it back and forth and the problem was reproducible by adding the comment and empty lines in /etc/hostname again.

Thank you for helping me with this!

All the best,
Christer


PS:

In the wiki "Editing Configuring Network" I added:

/etc/hostname should not contain comments or empty lines.

Last edited by agkbill (2012-10-20 10:51:07)

Offline

Board footer

Powered by FluxBB