After modifying the name of the ubuntu host, when executing the sudo command, it will prompt sudo: unable to resolve host, that is, the host cannot be resolved.
Solution:
sudo gedit /etc/hosts
Find the following line:
127.0.1.1 XXX
Modify it to:
127.0.1.1 (your current hostname)
Note: You can use all replacements