Skip to main content

Changing the host name on Ubuntu 18.04

I cloned an Ubuntu 18.04 Server instance post which I wished to change the hostname of the new instance. What was supposed to be a simple operation of updating the hostname in the /etc/hostname and running sudo hostname <new hostname> didn't work as expected. The hostname used to revert on reboot. It took me quite some time to arrive at the right solution. An Ask Ubuntu answer set me in the right direction though it did not work as-is. The reason is the shipment of cloud-init in Ubuntu 18.04. I got it to work with the following steps - 

The Procedure

Step 1

Edit the cloud.cfg file present in /etc/cloud to set preserve_hostname to true. 
sudo sed 's/preserve_hostname: false/preserve_hostname: true/' /etc/cloud/cloud.cfg

Step 2

Edit the /etc/hostname file and set the desired hostname in it.
sudo vi /etc/hostname

Step 3

Use hostnamectl to set the hostname. The new name would persist on reboots.
sudo hostnamectl set-hostname <new name>

Popular posts from this blog

Resolving INS-20802: Oracle Net Configuration Assistant failed error on Windows 10

I was all excited about the migration to Windows 10 until I had to install Oracle client 12.1.0.2 on it. The Oracle client installation used to fail miserably at the last stage with this error named INS-20802.


SSL VPN: Configuring and Using Forticlient on Ubuntu, creating a Launcher

Is your primary OS at home Linux and do you use Windows only to connect to your work PC over VPN or to attend meetings? Do you often wish to connect to your work VPN from a Linux PC?  If your answer is 'Yes' to the above questions, I have an answer if your workplace uses Fortinet SSL VPN. Note that it's possible to connect to Fortinet and other VPNs like Cisco VPN from Linux through the inbuilt network manager by installing additional tools but this post would focus on using the standard Forticlient for accessing the resources on your work network.
Obtaining Forticlient The most important thing to note w.r.t. using Forticlient for Ubuntu (or any Linux distro) is to note that the client is not publicly available for download from the official website. You will have to ask your IT department to download the client for you, in case they haven't provided it.

Troubleshooting a Constantly Freezing Windows 10 PC

On my Windows 10 Home, I was being bugged by constant freezes which forced me to hard reboot now and then. Since I use Ubuntu as my primary OS, I chose to adjust with this for long. However, this became more of a trouble in the recent times with Windows starting up at 98% CPU usage and every process actually showing 0% CPU usage. That's when I decided to get into the root of the problem and resolve it. I was confident that the hardware was fine since Ubuntu worked perfectly all the time.
It turned out that many Windows 10 users, especially those who upgraded from previous versions of Windows 7 or 8 / 8.1 faced similar freezing issues. The answers at Windows Forums by Microsoft staffers generally suggested using the command sfc /scannow to verify that system files were intact. However, most users found it unhelpful and that didn't help me either.