![]() ![]()
If the above steps do not solve the problem, you may need to restart the networking service to apply the changes. Make sure that the file contains a valid hostname for your machine. The /etc/hostname file should contain your machine’s hostname. The first line is for the localhost, and the second line should contain your machine’s hostname (in this case, “my-machine”) and the IP address of your machine. ![]() The entry should look something like this: Make sure that the file contains a valid entry for your machine’s hostname. The /etc/hosts file is used to resolve hostnames on your system. You may need to troubleshoot any issues with your network connection or check with your network administrator for assistance. ![]() Verify "hosts" entry is also working correctly.: Make sure that you are connected to the network and that your network connection is stable. PS C:\Users\Abhijit\Desktop> wsl -list -running Or PS C:\Users\Abhijit\Desktop> wsl -t Ubuntu PS C:\Users\Abhijit\Desktop> wsl -shutdown Windows Subsystem for Linux Distributions: "Ubuntu") using wsl -t Ubuntu and relaunch it.Ĭheck what all are running. If you don't want to wait, then open Windows Terminal or Windows PowerShell run wsl -shutdown to shut down the WSL 2 VM or terminate a specific distribution (e.g. ![]() If no distributions are running, you will receive the response: "There are no running distributions." You can now restart the distribution to see your wsl.conf updates applied. You can check to see whether your Linux distribution (shell) is still running after closing it by using PowerShell with the command: wsl -list -running. You must wait ~8 seconds for the subsystem to stop before relaunching in order to give enough time for your changes to be picked up. This is not currently the case as the subsystem could still be running. You might assume that your changes to the wsl.conf file have immediately gone into effect. Ubuntu), modify the wsl.conf file, close the distribution, and then re-launch it. You must wait ~8 seconds as mentioned below in the document. Close Ubuntu and re-launch.Ĭhange will not reflect immediately. "DESKTOP-ABC222") and replace with new one (e.g. # The following lines are desirable for IPv6 capable hostsįind all occurences of hostname (e.g. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:ġ27.0.1.1 DESKTOP-ABC222.localdomain DESKTOP-ABC222Ĥ4.99.0.122 You will see some entries similar to below # This file was automatically generated by WSL. #SUDO UNABLE TO RESOLVE HOST LOCALHOST UPDATE#Open /etc/hosts and update :~$ sudo nano /etc/hosts The hosts file contains a static map of hostnames corresponding IP address. Sudo: unable to resolve host SrcCodes: Name or service not known Otherwise, hosts file change will be overwritten during re-launch of Ubuntu and we'll get " unable to resolve host : Name or service not known" :~$ sudo apt update GenerateHosts = false will prevent WSL from automatic generation of /etc/hosts file. Hostname = SrcCodes will update the hostname in /etc/hostname. Open /etc/wsl.conf or create the same if it does not exist. #SUDO UNABLE TO RESOLVE HOST LOCALHOST WINDOWS 10#Here, DESKTOP-ABC222 is hostname of Ubuntu running in my Windows 10 ( OS Build 19043.1083) WSL. Once hostname is changed, if you get " unable to resolve host : Name or service not known" then follow the step #4 for the fix. #SUDO UNABLE TO RESOLVE HOST LOCALHOST HOW TO#If you are running Ubuntu on Windows WSL ( Windows Subsystem for Linux) and wondering how to change hostname permanently then follow all steps mentioned below. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |