Runtime: dotnet: command not found after installing dotnet core 2 on ubuntu linux 16.04

Created on 6 Oct 2017  路  23Comments  路  Source: dotnet/runtime

@andremarcondesteixeira opened this issue here: https://github.com/dotnet/core/issues/1012

I followed the steps in https://www.microsoft.com/net/core#linuxubuntu to install dotnet core 2 (dotnet-sdk-2.0.0) in my machine, which has an Ubuntu Linux 16.04.

Tried it 3 times, and certified that I was executing the commands for my distro and that any previous version was uninstalled, but no success.

Expected Behavior:
running dotnet in the command line returns me the helper page of dotnet

Actual Behavior:
running dotnet in the command line gives an error dotnet: command not found

Also, the docker package on the official site gets me dotnet core version 1.x, and the docker package with the version 2 (sdk) does nothing when I run it.

area-Setup needs more info

Most helpful comment

You can get into this situation if you install dotnet core 2 without removing dotnet core 1 first.

Some versions of dotnet core 1 installed into /usr/local/bin/, whereas dotnet core 2 installs to /usr/share/.

You can fix this simply by adding a symlink to the new install location:

sudo ln -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet

All 23 comments

What does env | grep PATH say? What does dpkg-query -L dotnet-sdk-2.0.0 say?

output.txt
result of env | grep PATH:

andre@andre-RV411:~/projects$ env | grep PATH XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path PATH=/home/andre/bin:/home/andre/.local/bin:/home/andre/bin:/home/andre/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript COMPIZ_BIN_PATH=/usr/bin/

result of dpkg-query -L dotnet-sdk-2.0.0 follows in attached file

note: the issue with docker is solved. Currently the only issue I'm having is not being able to run dotnet on my local machine after installation

Thanks. This looks okay. What does dpkg -L dotnet-host and type dotnet say?

result of dpkg -L dotnet-host:

andre@andre-RV411:~/projects/currency$ dpkg -L dotnet-host /. /usr /usr/bin /usr/share /usr/share/man /usr/share/man/man1 /usr/share/man/man1/dotnet.1.gz /usr/share/doc /usr/share/doc/dotnet-host /usr/share/doc/dotnet-host/changelog.Debian.gz /usr/share/doc/dotnet-host/copyright /usr/share/dotnet/dotnet /usr/share/dotnet/LICENSE.txt /usr/share/dotnet/ThirdPartyNotices.txt /usr/bin/dotnet

and running type dotnet returns me bash: type: dotnet: not found

any news on this?

Hm. PATH includes /usr/bin and dpkg says there is a file /usr/bin/dotnet present. But type says it cant execute it? Can you confirm this? What does ls -l /usr/bin/dotnet say? And what happens if you run /usr/bin/dotnet --info?

Omair is pointing at questions I have as well - particularly, where is /usr/bin/dotnet pointed. There were some changes in 2.0 which make things much less forgiving.

running ls -l /usr/bin/dotnet returns me:

andre@andre-RV411:~$ ls -l /usr/bin/dotnet lrwxrwxrwx 1 root root 24 Out 4 23:42 /usr/bin/dotnet -> /usr/share/dotnet/dotnet

and running /usr/bin/dotnet --info gives me bash: /usr/bin/dotnet: No such file or directory

I need to mention that I uninstalled the previous dotnet version using sudo apt-get purge dotnet (I don't know if this matters)

additional info in attached file. Looks like there is no dotnet inside /usr/share/dotnet (so /usr/share/dotnet/dotnet does not exist)
output.txt

andre@andre-RV411:~$ /usr/share/dotnet/dotnet bash: /usr/share/dotnet/dotnet: No such file or directory

actually, it looks like that the dotnet binary is missing in my installation for some reason :(

I just tried installing the three packages listed in the dotnet core-setup github page:

Host (Checksum)
Host FX Resolver (Checksum)
Shared Framework (Checksum)

and now, the problem seems to be solved.
I wish that installing using apt-get was enough, though.

Now I'm running into folder permission issues:

`andre@andre-RV411:~/projects/health-platform/aspnet-core$ dotnet restore

Permission denied to modify the '/usr/share/dotnet/sdk/NuGetFallbackFolder' folder.

Here are some options to fix this error:

  1. Re-run this command with elevated access.
  2. Disabled the first run experience by setting the environment variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE to true.
  3. Copy the .NET Core SDK to a non-protected location and use it from there.
    `

Thats an SDK issue I believe. It needs to write something to an admin location. Can you do dotnet/core-setup#1? @livarcocc any input?

@Petermarcu I did dotnet/core-setup#1 :D
worked 馃暫

If there somebody siting on opensuse 42.3 https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.5-download.md
Installing from tar helped me.
Of course after delete previous version of dotnet.
Sorry for my english.
UPD: in Visual studio Code need to update PATH >_< I dont know why :(

You can get into this situation if you install dotnet core 2 without removing dotnet core 1 first.

Some versions of dotnet core 1 installed into /usr/local/bin/, whereas dotnet core 2 installs to /usr/share/.

You can fix this simply by adding a symlink to the new install location:

sudo ln -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet

@superted17 , Thanks for sharing the resolution.Can you please share the repro steps ? I am unable to repro the issue at my end.

@rakeshsinghranchi it's hard to say. The machine that had the problem had dotnet core 1 installed (not even sure which version). I followed the official installation steps to install dotnet core 2 and ran into this problem.

All I can do is make a suggestion:

After installation, have some script use the output of "whereis ls dotnet" to verify that the path ties up with the expected install path. If not, add a symlink.

Will add a note to known issues docs for troubleshooting this issue.

@superted17 May I ask what would be the same solution for a Windows 10 machine?

sudo ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Timovzl picture Timovzl  路  3Comments

matty-hall picture matty-hall  路  3Comments

nalywa picture nalywa  路  3Comments

omajid picture omajid  路  3Comments

aggieben picture aggieben  路  3Comments