Hostname error

when i use apt update, i read it

sudo: unable to resolve host zpay-hplaptop15dw1xxx: Name or service not known

How to fix?

This relates to your hostname/sudo. You can change your hostname using:

sudo hostnamectl set-hostname localhost

This is a recognized hostname preventing this error in sudo, and also one that is common helping protect your privacy as well when using a shared network. Personal preference, but thought Iā€™d share it.

1 Like

/etc/hosts file is empty.
It should contain the following content:

127.0.0.1 localhost
127.0.1.1 zpay-hplaptop

# 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

You can do this as follows:

Launch the terminal and enter the commands:
sudo su
enter your user password
nano /etc/hosts
enter the content above and save the changes
restart the computer

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.