21

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?

Dominique
  • 427
  • Please add the output of apt-cache policy to your question. It shows the packages sources you are using. – Florian Diesch Feb 12 '19 at 15:05
  • @FlorianDiesch: I edited my question accordingly (I have no knowledge about apt-cache policy, I have no idea what this means. – Dominique Feb 12 '19 at 15:39
  • Can you sudo add-apt-repository universe and then sudo apt update && sudo apt install dos2unix – Charles Green Feb 12 '19 at 15:44
  • @CharlesGreen: thanks: the get-repository universe was obsolete, but the two second ones solved my situation. Please add it as an answer, I'll accept it. – Dominique Feb 12 '19 at 15:47
  • 1
    it ad add-repository... but I'm glad it worked for you. Basically @FlorianDiesch and I were going in exactly the same direction, and he was here 1st! Please note that the apt commands usually com in two parts apt update my list of software and apt upgrade the software in my system. – Charles Green Feb 12 '19 at 15:51

3 Answers3

42

This solved my problem:

sudo apt-get update
sudo apt-get install dos2unix
Eliah Kagan
  • 117,780
Slider
  • 536
3

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.

1

I don't know that it will help but my Eclipse build template command started working after I noticed the last line of text above the prompt after running the command "sudo apt update" in the Ubuntu command shell, the first of 4 command lines found in the "Intel FPGA Software Installation and Licensing" guide section 2.3.1.  The text referred to items that needed to be "Upgraded"  The command "sudo apt upgrade" worked for me.  I then re-ran the remaining three command lines and looked for anything else that needed to be upgraded.  There were none.  After that I was suddenly able to create Eclipse project templates, but I had tried everything else I could find before that point and the process woudl fail with the error message failed to execute dos2unix.

Hope it helps you.

RobM
  • 11
  • 1
    How is this answer any different and how is it better or more concise than the top, accepted answer? https://askubuntu.com/help/how-to-answer | https://askubuntu.com/help/formatting | https://askubuntu.com/tour – Nmath Oct 15 '20 at 20:51