How to install dos2unix on a Ubuntu app on a Windows-10 machine

I have a Ubuntu app, installed on my Windows-10 machine. As far as versions are concerned, this is the result of uname -a:

Linux <username> 4.4.0-17134-Microsoft #523-Microsoft Mon Dec 31 17:49:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

Using this Linux "emulator", as I call it, I regularly do grep, find, wc -l, sort, ..., for analysis purposes, but this sometimes generates output files in UNIX format (I'm talking about line endings).

In order to get Windows line endings, I decided to launch a unix2dos on the file, but this gave following error message:

The program 'unix2dos' is currently not installed. You can install it by typing:
sudo apt install dos2unix

In other words, my app knows that, in order to do unix2dos, the package dos2unix is needed. This looks like good news, except for the fact that I'm not able to install it:

sudo apt install dos2unix
[sudo] password for <username>:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dos2unix

I have already installed packages before, so it should be a problem specific for the dos2unix package.

For your information:

  • I don't have a /var/log/messages file.
  • dmesg doesn't work: dmesg: read kernel buffer failed: Function not implemented
  • I have a /var/log directory, but the latest file/directory modification is around a week ago.
  • I have a /var/log/apt directory, but the latest file/directory modification is around a week ago.
  • I tried debugging this myself, using strace, but this failed (strace: exec: Operation not permitted, +++ exited with 1 +++).

Edited after first comment

apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial-security,n=xenial,l=Ubuntu,c=restricted,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial-security,n=xenial,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial-updates,n=xenial,l=Ubuntu,c=restricted,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial-updates,n=xenial,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=restricted,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
     release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com
Pinned packages:

Does anybody have an idea?


This solved my problem:

sudo apt-get update
sudo apt-get install dos2unix

You need to ativate the "universe" repository component. See How do I enable the "Universe" repository? for how to do that.

See What's the difference between multiverse, universe, restricted and main? for more information about repository components.