Results 1 to 5 of 5

Thread: Hostname resets after rebooting

  1. #1
    Join Date
    Jan 2014
    Beans
    5

    Question Hostname resets after rebooting

    Hello Gurus,

    I have an unmanaged VPS running Ubuntu 12.04.3 LTS (precise), the default host name it came with was very long "vps-1148921-19454.manage.myhosting.com" so I wanted to change it to something shorter like "ubuntu-1". I read that I could simply edit /etc/hostname & /etc/hosts, however my changes always get reset after every reboot.

    My Changes:
    PHP Code:
    $echo "ubuntu-1" > /etc/hostname
    $hostname 
    -/etc/hostname
    $hostname
        ubuntu
    -1

    $cat 
    /etc/hosts
        127.0.0.1       localhost
        
    #my edit is below this line
        
    127.0.1.1       ubuntu-1
        
    ::1             localhost ip6-localhost ip6-loopback
        fe00
    ::0         ip6-localnet
        ff00
    ::0         ip6-mcastprefix
        ff02
    ::1         ip6-allnodes
        ff02
    ::2         ip6-allrouters
        
    # Auto-generated hostname. Please do not remove this comment.
        
    192.30.165.158 vps-1148921-19454.manage.myhosting.com vps-1148921-19454 
    The changes seems to take effect, however after Rebooting (sudo reboot) my changes are lost, it resets to the following:

    PHP Code:
    $hostname
        vps
    -1148921-19454.manage.myhosting.com

    $cat 
    /etc/hostname
        vps
    -1148921-19454.manage.myhosting.com 
    /etc/hosts keeps the same contents

    Any help would be appreciated.

  2. #2

    Re: Hostname resets after rebooting

    "Maybe", just maybe change:
    Code:
    192.30.165.158 vps-1148921-19454.manage.myhosting.com vps-1148921-19454
    to
    Code:
    192.30.165.158 ubuntu-1
    have you contacted myhosting.com support about this issue?


  3. #3
    Join Date
    Nov 2013
    Beans
    Hidden!

    Re: Hostname resets after rebooting

    Hello

    Have-you try the commands :
    sudo -i
    hostname ubuntu-1
    exit

  4. #4
    Join Date
    Jan 2014
    Beans
    5

    Re: Hostname resets after rebooting

    Thanks guy, the issue is resolved. I had to change it through my VPS console page, apparently those settings would overwrite anything I did on command line.

    My hosts entry now looks like:
    192.30.165.158 ubuntu-1.com ubuntu-1

  5. #5

    Re: Hostname resets after rebooting

    VPSs, you have to love 'em.
    Glad it worked out.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •