How to fix 'sudo: unable to resolve host vm76: Name or service not known' error

The error message "sudo: unable to resolve host [hostname]: Name or service not known" typically indicates that the hostname of your virtual machine is not properly configured.

To resolve this issue, you can follow these steps:

  1. Open a terminal window on your virtual machine.
  2. Check the hostname of your virtual machine by running the command: hostname
  3. Edit the /etc/hosts file using the command: sudo nano /etc/hosts
  4. In the hosts file, add the IP address and hostname of your virtual machine in the following format: IP_address hostname, for example: 192.168.1.10 vm76
  5. Save and close the hosts file.
  6. Check that the hostname is properly configured by running the command: sudo hostnamectl set-hostname [hostname]
  7. Reboot your virtual machine for the changes to take effect by running the command: sudo reboot

After completing these steps, the "sudo: unable to resolve host [hostname]: Name or service not known" error should be resolved, and you should be able to use the sudo command without any issues.

If you need assistance with your projects feel free to email me at info@airgad.com or whatsapp Jesse stay safe!