HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

SQL Server on Ubuntu - An existing connection was forcibly closed by the remote host after reboot

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
aftertherebootserversqlubunturemoteclosedwashost

Problem

I have been running SQL Server on Ubuntu for a while and everything has been working fine but I rebooted the server and now all connections to SQL Server fail with the error:

A connection was successfully established with the server, but then an error occurred during the login process. 
(provider: SSL Provider, error: 0 - 
An existing connection was forcibly closed by the remote host.) 
(Microsoft SQL Server, Error: 10054)


I have tried uninstalling and reinstalling SQL Server, setting various mssql-conf values (since removed again) etc. but nothing I do makes any difference.

Articles relating to Windows seem to point to it being SSL-related but SSL was not enabled. I did try to enable it and set a certificate but then even though I made permissions to the certificate and private key 777 and chowned to the mssql user/group it just told me it couldn't read it and then SQL Server failed to start up so I removed again.

Can anyone suggest anything I can do to get it working again please as I am out of ideas?

Thanks
Robin

Solution

MSSQL expects OpenSSL v1.0 while Ubuntu 18+ uses OpenSSL 1.1, resulting in a OpenSSL version mismatch. The solution is to symlink ssl v1.0 as below:

-
Stop SQL Server

sudo systemctl stop mssql-server


-
Open the editor for the service configuration

sudo systemctl edit mssql-server


-
In the editor, add the following lines to the file and save it:

[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"


-
Create symbolic links to OpenSSL 1.0 for SQL Server to use

sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so

sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so


-
Start SQL Server

sudo systemctl start mssql-server

Code Snippets

sudo systemctl stop mssql-server
sudo systemctl edit mssql-server
[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so

sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
sudo systemctl start mssql-server

Context

StackExchange Database Administrators Q#245496, answer score: 8

Revisions (0)

No revisions yet.