Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Feb 2006
    Posts
    14

    Default Why does my hostname revert to "localhost" everytime I restart?

    The first time I restarted my server, all of the cPanel/WHM stuff stopped working. Turned out it was a matter of the hostname having reverted back to localhost from my usual "server.mydomain.com".

    I've edited the /etc/hosts file but when I restart, something messes up the /etc/hosts file and the hostname goes back to "localhost"

    Any ideas on how I can make my changes stick?
    Steve!

  2. #2
    Member
    Join Date
    Feb 2006
    Posts
    14

    Default

    An update:

    Try as I might, setting the hostname in /etc/sysconfig/network doesn't help. The hostname in /etc/sysconfig/network itself reverts back to localhost.localdomain on reboot! What's editing this file at startup?

  3. #3
    Member
    Join Date
    Jan 2005
    Location
    Earth
    Posts
    1,050

    Default

    Are you on a VPS server or do you have a dedicated server ?
    If you are on VPS then you cannot change the Hostname from your end. You will have to contact the Hosting company as its is changed from the main VPS server. If its a Dedicated server you should re-check entires in
    /etc/hosts
    /etc/sysconfig/network
    Last edited by madaboutlinux; 02-12-2006 at 11:12 PM.

  4. #4
    Member
    Join Date
    Feb 2006
    Posts
    14

    Default

    Quote Originally Posted by Shekhar
    Are you on a VPS server or do you have a dedicated server ?
    Thank you for the reply! You are right... I found this in our knowledgebase, finally:

    ...The same is true for VPS systems, however, there is one additional step. Open a ticket with technical support requesting that the hostname be set statically in Virtuozzo. If this is not done, a reboot will set the hostname back to "localhost.localdomain".

  5. #5
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    I have the exact same problem with one of our server accounts that is a VPS system
    and after a better part of a year getting no answers and the provider being no help,
    I just wrote my own script that executes at boot and immediately resets the hostname,
    /etc/hosts, and resolv.conf ....

    A similiar script also runs hourly via cron and check to make sure nobody has screwed
    around with the hostname while the server has been up and online and changes
    all information back to my settings if any changes have been detected.

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge rking's Avatar
    Join Date
    Aug 2005
    Posts
    192

    Default

    If you are the server's administrator and have access to VZMC or VZCP, try setting the hostname directly within your panel. This should keep the hostname from changing on boots.

Similar Threads & Tags
Similar threads

  1. after doing "service network restart" all add-on ip's disappear
    By cam94z28 in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 04-30-2011, 07:42 PM
  2. Replies: 8
    Last Post: 02-11-2011, 01:39 PM
  3. "connect to server at 'localhost' failed" during logrotate
    By Vatoloco in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-26-2005, 03:35 AM
  4. hostname set to "-s" after easyapache/upcp updates??
    By fsrjs4 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 10-28-2004, 12:33 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube