DEV Community

Cover image for SOLVED: "No usable version of the libssl was found"
Davide 'CoderDave' Benvegnù
Davide 'CoderDave' Benvegnù

Posted on • Updated on

SOLVED: "No usable version of the libssl was found"

Have you ever encountered this error when trying to build a dotnet core application in GitHub Actions and Azure Pipelines, or when trying to use .NET Core on Linux?

Error

Today I'm gonna tell you why the "No usable version of the libssl was found" error happens and show you how to solve it.

Video

As usual, if you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video with the whole explanation and demo, which to be fair is much more complete than this post.

Link to the video: https://youtu.be/EbEzgxLi8YY

If you rather prefer reading, well... let's just continue :)

Why The Error Happens

So first think first, let me tell you why this happens.

.NET Core, among the other things, relies on some OpenSSL libraries.

OpenSSL

OpenSSL is one of the most common cryptographic libraries used on Linux, and it has multiple versions. Version 1.0 is kind of old, but still heavily used, while 1.1 is the newer version that was relatively recently released.

The problem is that versions 1.0 and 1.1 are not compatible. An application that expects 1.0 cannot build against 1.1, nor run against it.

Many Linux distributions are starting to make OpenSSL 1.1 the new default instead of the version 1.0

And here is the problem: .NET Core 2.1, and all earlier versions, only support OpenSSL 1.0.

How to Solve it

So, how can we fix this? We have 2 ways.

Upgrade .NET Core version

The simplest one would be to upgrade to a most recent version of .NET Core.

And I'm not talking about major upgrades, you don't need to go all the way to .NET 5.

OpenSSL .NET Core 2.1

Luckily for us, the .NET team has updated .NET Core 2.1 to support the version 1.1 of OpenSSL.

All you need to do is make sure that you are using the latest minor build of .NET Core 2.1, which at the time of writing is the 2.1.28 which has an SDK version of 2.1.816. And of course

And doing this in Actions or Pipelines is very simple. Just change the version of .NET Core in the Setup task and you are done.

Install the Older Version

If for any reason it is not possible for you to use the newer version of .NET Core, there is still one more thing you can do.

Even tho as I've said before Many Linux distributions are starting to make OpenSSL 1.1 the new default, most of them still have a package for 1.0.

So you just need to find and install that.

On CentOS and Fedora for example it's called compact-openssl10. For openSUSE, instead, it's libopenssl1_0_0. Finally, for Ubuntu and Debian we have the libssl-dev.

After installing the older version of the library, .NET Core will find it, pick it up and use it automatically.

And this of course can be done locally on your machine, but also on the CI agents in Azure Pipelines and GitHub Actions, simply using a script task or action.

Conclusions

Let me know in the comment section below if you have any more questions about fixing this problem.

Also, check out this video in which I show how to use GitHub Actions with the .NET Framework.

Like, share and follow me 🚀 for more content:

📽 YouTube
Buy me a coffee
💖 Patreon
🌐 CoderDave.io Website
👕 Merch
👦🏻 Facebook page
🐱‍💻 GitHub
👲🏻 Twitter
👴🏻 LinkedIn
🔉 Podcast

Buy Me A Coffee

Discussion (0)