Dotnet Core on Windows 10 Subsystem for Linux ERROR – sudo: unable to resolve host

Started playing with some of the .NET Core source code this week and decided to try it on the Windows 10 Subsystem for Linux.  I found the install page and ran some commands in the console to find out what version of Linux was running:

$ uname -a
Linux DESKTOP-12345 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

So I followed the instructions for Ubuntu 14.o4 but immediately received an error on the first script

$ sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotne$ sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main” > /etc/apt/sources.list.d/dotnetdev.list’
sudo: unable to resolve host DESKTOP-12345

So I dug around on this error to find that I needed to add a host entry for my computer name.  You can edit the etc/hosts file using VIM if you dare:

$ sudo vim /etc/hosts

Its really not that bad. 

  1. Press “i” to enter insert mode
  2. Add you host entry “127.0.0.1 [computername]”
  3. Hit escape to exit insert mode
  4. Type “:wq!” to save and quit

image

After that the install scripts worked like a champ. 

Please let me know in the comments below if this post was helpful or you have further questions.

1 thought on “Dotnet Core on Windows 10 Subsystem for Linux ERROR – sudo: unable to resolve host”

  1. Pingback: Debugging .NET Core From VS2017 on Windows Subsystem for Linux – dotnet catch

Leave a Reply