Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Can't Change Hostname in 18.04 Server

  1. #11
    Join Date
    Apr 2018
    Beans
    8

    Re: Can't Change Hostname in 18.04 Server

    Yes. It's a VM.

  2. #12
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    6,879
    Distro
    Xubuntu 19.10 Eoan Ermine

    Re: Can't Change Hostname in 18.04 Server

    Re post #9:
    I think the second line is supposed to be 127.0.1.1 not 127.0.0.1. Here is my hosts file, as created by the installer.
    Code:
    steve@Steves-PC:~$ cat /etc/hosts
    127.0.0.1	localhost
    127.0.1.1	Steves-PC
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    I wonder if your machine is picking up an old hostname from a DHCP server that has learned it from you. I have seen that before, and even reinstalling didn't help because the DHCP server still remembered and told me my hostname again.

  3. #13
    Join Date
    Apr 2018
    Beans
    8

    Re: Can't Change Hostname in 18.04 Server

    I gave it a try with 127.0.1.1 and it didn't work either. The server has a static IP address so I doubt the DHCP has much to do with it.

  4. #14
    Join Date
    Apr 2018
    Beans
    1

    Re: Can't Change Hostname in 18.04 Server

    Quote Originally Posted by chuckhenry.nnyln View Post
    I gave it a try with 127.0.1.1 and it didn't work either. The server has a static IP address so I doubt the DHCP has much to do with it.
    Hi,

    I had the same problem. You can try to remove ubuntu cloud packages:
    apt remove cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf

    Then you can try to change hostname with hostnamectl.

  5. #15
    Join Date
    Apr 2018
    Beans
    8

    Re: Can't Change Hostname in 18.04 Server

    Winner winner chicken dinner!

    Yes! Removing cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf and then running sudo hostnamectl set-hostname nyshn2 worked!

    Thanks everyone for your help!

  6. #16
    Join Date
    Apr 2018
    Beans
    1

    Re: Can't Change Hostname in 18.04 Server

    Quote Originally Posted by faromano View Post
    Hi,

    I had the same problem. You can try to remove ubuntu cloud packages:
    apt remove cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf

    Then you can try to change hostname with hostnamectl.
    As the only post in existence that explained the remedy to this issue, I thank you very much.

    Guess that's yet ANOTHER annoyance from the Canonical Factory alongside NetPlan / YAML nonsense and MySQL not asking for a password during installation with this Bionic release...

  7. #17
    Join Date
    Aug 2009
    Beans
    1,211
    Distro
    Ubuntu Development Release

    Re: Can't Change Hostname in 18.04 Server

    Specifically, it's cloud-init. Try changing /etc/cloud/cloud.cfg's preserve_hostname line to true

  8. #18
    Join Date
    Apr 2006
    Beans
    115

    Re: Can't Change Hostname in 18.04 Server

    On 18.04 I just edited /etc/hosts and /etc/hostname, then rebooted. I didn't bother with hostnamectl. Seemed to work.

  9. #19
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,178
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Can't Change Hostname in 18.04 Server

    Quote Originally Posted by dankegel View Post
    On 18.04 I just edited /etc/hosts and /etc/hostname, then rebooted. I didn't bother with hostnamectl. Seemed to work.
    In the finial release, this is the difference between the "live" ISO and the "alternative"

    The "live" ISO image has the cloud-init package and thus you need to edit preserve_hostname in /etc/cloud/cloud.cfg

    We are trying to document such differences in the final product between the "live" and "alternative" ISO images here: https://ubuntuforums.org/showthread.php?t=2390785

    LHammonds

  10. #20
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Can't Change Hostname in 18.04 Server

    Thread Closed, as Bionic has been released.

Page 2 of 2 FirstFirst 12

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
  •