[lkml]   [2011]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH RESEND] uts: Set default hostname to "localhost", rather than "(none)"
The "hostname" tool falls back to setting the hostname to "localhost" if
/etc/hostname does not exist. Distribution init scripts have the same
fallback. However, if userspace never calls sethostname, such as when
booting with init=/bin/sh, or otherwise booting a minimal system without
the usual init scripts, the default hostname of "(none)" remains,
unhelpfully appearing in various places such as prompts
("root@(none):~#") and logs. Furthrmore, "(none)" doesn't typically
resolve to anything useful, while "localhost" does.

Change the default hostname to "localhost". This removes the need for
the standard fallback, provides a useful default for systems that never
call sethostname, and makes minimal systems that much more useful with
less configuration.

Signed-off-by: Josh Triplett <>

Looked at "(none)" one too many times, and figured I ought to do
something about it.

Resending, and adding CCs for networking and UTS.

include/linux/uts.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/uts.h b/include/linux/uts.h
index 73eb1ed..610bec2 100644
--- a/include/linux/uts.h
+++ b/include/linux/uts.h
@@ -9,7 +9,7 @@

-#define UTS_NODENAME "(none)" /* set by sethostname() */
+#define UTS_NODENAME "localhost" /* set by sethostname() */


 \ /
  Last update: 2011-04-11 07:11    [W:0.083 / U:2.312 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site