Amongst other things, I am trying to change my hostname with a script. Basically the script sed
s the values of ubuntu
from /etc/hostname
and /etc/hosts
.
I tried this on Ubuntu 16.04.4 in the past and worked well.
Now, on 16.04.6 (or just by chance), I am getting errors with the same script. Just as I change the hostname
, the change on the hosts
files takes a long time (probably because sudo
is trying to reach the new host which has not yet placed in the hosts
file but I did not know sudo
uses such information) and I get an error:
sudo: unable to resolve host xxxx
Sometimes also sudo: unable to resolve host ubuntu
. Following script commands have the same problems or fail.
But obviously it is not possible to change at once the values of both files
Why did this happen? Is it something new in that Linux distribution version? I read other people having the same problem but never happened to me before, I was always able to edit both files with sudo with no other inconveniences.