You are not logged in.

#1 2014-02-05 16:29:41

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Beginner's Guide - "Hostname" update question

More than one person in the past year has had a problem that sounded like this: "I have a liquid cooled super computer but this one application takes, like, a minute to load. What's the big deal? Do I need more GBs??"

The solution to this problem is to add the hostname for the computer into the "/etc/hosts" file on the line that has "127.0.0.1". Here are two real world examples: Post 1, Post 2 I think the reason it's uncommon for people to make this change to the "hosts" file is because of what's in the Beginner's Guide, which states:

Beginner's Guide wrote:

Note: There is no need to edit /etc/hosts.

Way back when I installed Arch Linux, the Beginner's Guide had different advice, so my "hosts" file has the change. smile According to a post by WonderWoofy, the "hosts" file might be obsolete. But clearly, modifying the "hosts" file has a very real and important effect on some user's systems.

So, what is the actual state of the "/etc/hosts" file? Shall I go ahead and change the Beginner's Guide to say that the file does need to be changed?

...I don't mind leaving it, because every time someone comes to the forums with this problem it allows me to easily bump my post count. big_smile

Offline

#2 2014-02-05 16:33:45

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Beginner's Guide - "Hostname" update question

Well, you can add it as "Making the following change to /etc/hosts has fixed slow login (and other) issues for some people."

Offline

#3 2014-02-05 16:59:00

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

Re: Beginner's Guide - "Hostname" update question

Indeed, nss-myhostname was supposed to make modifying the hosts file unnecessary (this functionality is now provided in the systemd package).  But admittedly, I have seen a number of threads around here where adding your hostname apparently solves various issues.  For me, it has not (yet?) been necessary, but I have now become hesitant to fully stand by my previous statement that this modification is not at all necessary.

In the 'Overview' section of this page it explains why this is supposed to be the case.  I remember seeing this being discussed on a mailing list somewhere though and that is where I originally got the info.  I can't find it at the moment...

Offline

#4 2014-03-27 13:31:58

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Beginner's Guide - "Hostname" update question

I made the edit. This post was the final straw.

Offline

#5 2014-03-27 16:20:29

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: Beginner's Guide - "Hostname" update question

In my case, after laptop is woken up from sleep, Raspberry Pi fails to resolve hostname based nfs mount. It works before suspend. Editing hostname fixed it.

Offline

#6 2014-03-30 15:07:30

karkhaz
Member
Registered: 2014-01-25
Posts: 79

Re: Beginner's Guide - "Hostname" update question

For some reason, I have the following in my /etc/hosts:

127.0.0.1 my_hostname localhost
::1       my_hostname localhost

The second one is the IPv6 equivalent of 127.0.0.1 (as described e.g. here). I'm not sure why/when I added this, does anybody know if or why it is necessary?

Offline

#7 2014-03-30 15:54:40

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

Re: Beginner's Guide - "Hostname" update question

@karkhaz, I'm not sure why you would have that.  The old instructions (that are being discussed in this thread) told you to do something like:

% cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost   my_hostname
::1             localhost.localdomain   localhost   my_hostname

Offline

Board footer

Powered by FluxBB