VSTS-Agent Installation on CentOS returns error 'System.Security.Cryptography.Native.OpenSsl': (Exception from HRESULT: 0x8007007E)

2

I am trying to install a VSTS agent on a CentOS Operating system, and when trying to run ./config.sh, I see the following error in ${myagent_dir}/_diag directory

> [2018-05-12 15:44:09Z ERR  Terminal]
> System.TypeInitializationException: The type initializer for
> 'System.Net.Http.CurlHandler' threw an exception. --->
> System.TypeInitializationException: The type initializer for 'Http'
> threw an exception. ---> System.TypeInitializationException: The type
> initializer for 'HttpInitializer' 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.CryptoInitializer.Initialize()    at
> Interop.HttpInitializer..cctor()    --- End of inner exception stack
> trace ---    at Interop.HttpInitializer.Initialize()    at
> Interop.Http..cctor()    --- End of inner exception stack trace ---   
> at Interop.Http.GetSupportedFeatures()    at
> System.Net.Http.CurlHandler..cctor()    --- End of inner exception
> stack trace ---    at System.Net.Http.CurlHandler..ctor()    at
> Microsoft.VisualStudio.Services.Agent.Util.ApiUtil.CreateConnection(Uri
> serverUri, VssCredentials credentials, IEnumerable`1
> additionalDelegatingHandler)    at
> Microsoft.VisualStudio.Services.Agent.Listener.Configuration.BuildReleasesAgentConfigProvider.<TestConnectionAsync>d__14.MoveNext()

My setup is as follows

[user@server ~]# cat /etc/*release*
CentOS Linux release 7.5.1804 (Core)
Derived from Red Hat Enterprise Linux 7.5 (Source)

Also, I had to install a different version libicu by following the link below to resolve the "Failed to initialize CoreCLR, HRESULT: 0x80131500" issue.

http://fsoikin.blogspot.com/2015/12/getting-coreclr-running-on-centos.html

I made sure I had all the prerequisites by the following links, with no issues when doing all the yum installs

https://github.com/Microsoft/vsts-agent/blob/master/docs/start/envredhat.md https://www.microsoft.com/net/learn/get-started/linux/centos

I am running the steps as follows

[user@server ~]$ export LD_LIBRARY_PATH=/opt/libicu52:/usr/lib64/:/usr/lib
[user@server ~]$ cd /opt/tfs_agent/
[user@server tfs_agent]$ ./config.sh

>> End User License Agreements:

Building sources from a TFVC repository requires accepting the Team Explorer Everywhere End User License Agreement. This step is not required for building sources from Git repositories.

A copy of the Team Explorer Everywhere license agreement can be found at:
  /opt/tfs_agent/externals/tee/license.html

Enter (Y/N) Accept the Team Explorer Everywhere license agreement now? (press enter for N) > Y

>> Connect:

Enter server URL > https://tfs_url/collectionName/_admin/_AgentPool
Enter authentication type (press enter for Negotiate) > PAT
Enter personal access token > ****************************************************
Connecting to server ...
The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
Failed to connect.  Try again or ctrl-c to quit
Enter server URL > Exiting...

Online search results points me to Openssl issues when trying to do the same thing with MacOS and none seem to be applicable in my case. Any help on this is appreciated!

tfs
azure-devops
centos7
asked on Stack Overflow May 12, 2018 by Harish

2 Answers

1

The prerequisites by the following links: Red Hat/CentOS System Prerequisites [2.124.0 or below]

It's only apply to the build agent version with 2.124.0 or below.

The latest build agent version is v2.133.3 Please double check your build agent version, if you are using 2.125.0 or above, you need to make sure your machine is prepared with our prerequisites below:

Linux System Prerequisites [2.125.0 or above]

Besides, suggest you also go through this official tutorial how to Deploy an agent on Linux

answered on Stack Overflow May 15, 2018 by PatrickLu-MSFT
0

The issue was I downloaded an incorrect version (built for Ubuntu). The problem is resolved by downloading the correct version of the agent.

answered on Stack Overflow May 15, 2018 by Harish

User contributions licensed under CC BY-SA 3.0