Ubuntu : retain host-name change after a reboot

Problem:

The newly set hostname reverts back to older one after reboot

Reason :

Hostname is reset by cloud-init

Solution :

Inactivate cloud-init.

On terminal, key in –

[bash]
hostnamectl set-hostname YourNewHostName
sudo touch /etc/cloud/cloud-init.disabled
sudo reboot
[/bash]

Sreekumar Kj
Sreekumar (KJ) has been a hobby programmer from school days. Codemarvels is his personal blog from the year 2010, where he writes about technology, philosophy, society and a bit about physics. He now runs a conversational AI company - DheeYantra - focusing his efforts to help businesses improve operational efficiency using digital employees powered by AI.