You are not logged in.

#1 2010-05-24 16:42:08

sant527
Member
Registered: 2009-06-21
Posts: 273

Unable to change hostname

I am trying to change my hostname

my /etc/rc.conf file

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="gauranga"

my /etc/hosts file

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    localhost.localdomain    localhost    gauranga

# End of file

my /etc/NetworkManager/nm-system-settings.conf file

[main]
plugins=keyfile

[keyfile]
hostname=gauranga

But after rebooting the computer the following thing happens

my /etc/hosts file : Notice that gauranga was removed automatically after reboot

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

# End of file

And after I connect my vodafone net connect the following happens

my /etc/hosts file : Notice that  112-79-209-128.live.vodafone.in was added automatically after reboot.

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    112-79-209-128.live.vodafone.in       localhost.localdomain    localhost

# End of file

and as per the thread http://bbs.archlinux.org/viewtopic.php?id=59575, this is causing my programs not to open in KDE or any Desktop environment.
As it gives the error:

No Protocol specified
Error cannot open display :0.0

I have tried ten times changing the /etc/hosts. But nothing happens. So how can I set my hostname to gauranga only.

Offline

#2 2010-05-25 02:27:45

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Unable to change hostname

I'm not sure _where_ it is being put, but the hostname command should do it

bash$ sudo hostname gauranga

On my puter - the only places in /etc where the hostname is found is /etc/hosts and /etc/rc.conf (plus the wireless and wired .conf-files, but they (in turn) are taken from the current hostname.

Offline

#3 2010-05-25 03:58:22

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Unable to change hostname

What are you using to connect to your network/ISP? Whatever it is, it's changing your settings kind of like dhcpcd does.


neutral

Offline

#4 2010-05-25 04:22:58

SiegeMachine
Member
Registered: 2009-03-26
Posts: 157

Re: Unable to change hostname

You want to change "localhost" in the hosts file to your one, not put it afterwards, and yes, make sure you have root permissions to edit those files and make sure they save correctly.

Offline

#5 2010-05-25 06:33:13

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: Unable to change hostname

SiegeMachine wrote:

You want to change "localhost" in the hosts file to your one, not put it afterwards, and yes, make sure you have root permissions to edit those files and make sure they save correctly.

I have 'localhost paradox' and 'localhost hysteric' in my computers and work fine. According to the wiki, you shouldn't remove localhost from the hosts file.


Sorry for my English. Feel free to point out my errors.

Offline

#6 2010-05-25 11:08:45

sant527
Member
Registered: 2009-06-21
Posts: 273

Re: Unable to change hostname

I am also having localhost gauranga
but unfortunately its not working

Offline

#7 2010-05-25 11:36:02

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: Unable to change hostname

Whatever is touching your hosts file, as a temporary workaround you can protect it from being written with "chattr +i". Then look into the program you use to connect to the internet, as sand_name suggested, or try an alternative one.

Offline

#8 2010-05-25 12:32:16

Busata
Member
From: Belgium
Registered: 2010-04-04
Posts: 30
Website

Re: Unable to change hostname

Seeing he posted a network manager file it is probably that, I think it's known to sometimes do w/e it wants with your network settings...

Offline

#9 2010-05-25 12:43:06

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: Unable to change hostname

http://bugs.archlinux.org/task/17742

bug report wrote:

Additional comments about closing:  0.7.999-2 should fix this issue. This version has been patched to do hostname setting only in case it's configured from the keyfile settings plugin, all automatic lookups are disabled.

Not sure if I am interpreting this right, does it mean you should explicitly omit the "plugins=keyfile" etc part in nm-settings? If so, the wiki needs an update. Can you check this, sant527?

Last edited by hokasch (2010-05-25 13:00:17)

Offline

Board footer

Powered by FluxBB