Hostname is not changed after rebooting
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Hostname is not changed after rebooting

by
NicolasV2
Created on 2020-07-28 08:17:15 (edited on 2024-09-04 14:24:00) in Virtual Private Servers

Hi,

I'm trying to change the hostname permanently in my VPS Essential following these instructions:

1) I edited `/etc/cloud/cloud.cfg` and added:
preserve_hostname: true
manage_etc_hosts: false
2) I edited `/etc/hostname` with "mydomain"
3) I edited `/etc/hosts` and have the following:
127.0.0.1 localhost

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

127.0.1.1 mydomain.com mydomain

Then when I reboot the VPS I check again the `/etc/hosts` file and had the following:

127.0.0.1 localhost

# 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
ff02::3 ip6-allhosts


127.0.1.1 mydomain.com mydomain
127.0.1.1 vps-XXXXXXXX.vps.ovh.net.novalocal vps-XXXXXXXX

Why is always appending the `127.0.1.1 vps-XXXXXXXX.vps.ovh.net.novalocal vps-XXXXXXXX` line in every reboot if I changed the `/etc/cloud/cloud.cfg` correctly?


Replies are currently disabled for this question.