1

I have been having some difficulty getting dotnet to run on my machine,

uname -a
Linux Olympus 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux

I have installed dotnet core through https://www.microsoft.com/net/core#linuxdebian

The commands I followed were:

sudo apt-get install curl libunwind8 gettext
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=843453
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

Then using the next step of initializing the code, I get:

dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1

Runtime Environment:
 OS Name:     kali
 OS Version:  2016.2
 OS Platform: Linux
 RID:         debian.8-x64
 Base Path:   /opt/dotnet/sdk/1.0.1

and the error I get is:

dotnet new

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.CryptoInitializer.EnsureOpenSslInitialized()
   at Interop.CryptoInitializer..cctor()
   --- End of inner exception stack trace ---
   at Interop.Crypto..cctor()
   --- End of inner exception stack trace ---
   at Interop.Crypto.GetRandomBytes(Byte* buf, Int32 num)
   at System.IO.Path.GetCryptoRandomBytesOpenSsl(Byte* bytes, Int32 byteCount)
   at System.IO.Path.GetCryptoRandomBytes(Byte* bytes, Int32 byteCount)
   at System.IO.Path.GetRandomFileName()
   at Microsoft.DotNet.InternalAbstractions.TemporaryDirectory..ctor()
   at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateTemporaryDirectory()
   at Microsoft.DotNet.Configurer.NuGetPackagesArchiver..ctor()
   at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Aborted

I have tried to research this issue, but most of the issues come from MacOSx and are Mac-related.

I have also tried to update openssl:

openssl version
OpenSSL 1.1.0e  16 Feb 2017

I'm not quite sure what to do next. Has anyone else come across this issue or have an idea where I can go from here? I have been able to successfully use dotnet on linux mint 17, but not for kali linux.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • You might be missing libcrypto.so. Try this answer here: http://unix.stackexchange.com/questions/283607/libraries-libcrypto-so-1-0-0-cannot-open-shared-object-file-no-such-file-or-d – Munir Mar 27 '17 at 17:53

1 Answers1

2

I was finally able to figure this out. (Sorry new to the site, so the question was asked by me, but I did not create an account at that time).

Whenever you install the latest Kali (This one was kali 2016.2), and then try to install the latest dotnet core from the website that I provided (which really isn't the latest) at version 1.0.1, there are many dependencies that need to downgrade to a previous version before dotnet will work.

First is downgrading libicu57 to libicu52 (which can be found on the debian packages site). This will fix the following issue:

Failed to initialize CoreCLR, HRESULT: 0x80131500

Next, you need to install the previous version of libssl (downgrade from libssl1.0.2 to libssl1.0.0). This will fix the original issue of this post.

Then, you need to downgrade libcurl3 (libcurl3 7.52 to libcurl3 7.38) to prevent the segmentation fault that occurs from calling dotnet new, dotnet restore, dotnet run.

That should be it.

  • As a side note, while this could get dotnet to work, this could potentially cause many programs to not start because they depend on that previous version of libcurl (vim and attempts to update). I am still trying to find a way to use the older version of libcurl just for dotnet. There might be a new version of dotnet that could be built or might have to use an older version of kali. – mattype4 Mar 28 '17 at 13:20