sudo unable to resolve host debian Name or service not knownsudo unable to resolve host debian Name or service not known
This error message typically occurs when the hostname of your machine cannot be resolved to an IP address.
To fix this issue, you can try the following steps:
-
Open the terminal and type
sudo nano /etc/hoststo open the hosts file for editing. -
Look for a line that contains your machine's hostname and IP address. It should look something like this:
127.0.0.1 localhost 127.0.1.1 debian -
If the line with your hostname is missing or incorrect, add or edit it to match your hostname and IP address. For example:
127.0.0.1 localhost 127.0.1.1 myhostname -
Save the changes and exit the editor.
-
Run
sudo service hostname restartto restart the hostname service. -
Finally, run
sudo hostnamectl set-hostname myhostnameto set the hostname permanently.
After completing these steps, the error message should no longer appear when using sudo
原文地址: https://www.cveoy.top/t/topic/iBg8 著作权归作者所有。请勿转载和采集!