apt-get command does not work on Ubuntu-On-Windows / Windows Subsystem for Linux

GammaOmega picture GammaOmega · Apr 7, 2016 · Viewed 24.3k times · Source

I just installed Ubuntu-On-Windows recently added on Windows 10 for peoples on the fast ring. However, when trying to install new applications using apt-get, the command seems to fail everytime. I'm getting this error:

Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'

I know this is a beta and has just been released, but is there a fix for that out yet?

Answer

GammaOmega picture GammaOmega · Apr 7, 2016

To fix the issue, I ran the following command:

apt-get update && apt-get upgrade

And now it works fine, even if I close and re-open the terminal.