apt-get install is not working in WSL

Executed below 2 commands and then I was able to install the packages.

sudo apt update

sudo apt install python3-pip

Source - https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/


System: Windows 10 Enterprise, Ubuntu Windows Subsystem for Linux.

I ran this command:

sudo apt-get install dos2unix

I had this error:

E: Unable to locate package dos2unix

I then ran:

sudo apt-get update

and then:

sudo apt-get install dos2unix

and it installed properly.