5

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

7
  • What version of Ubuntu are you using?
    – Dan Guzman
    Aug 16, 2019 at 10:36
  • Sorry it's Ubuntu 19.04. I know it's not officially supported (only supported version is 16.04 for some reason) but it has worked well on 17, 18 and 19 since I started using it up to this week. Aug 16, 2019 at 13:05
  • Although the install isn't blocked, there are known issues with SQL Server on later Ubuntu versions related to OpenSSL as described in this Microsoft blog post. That's why it's not supported yet.
    – Dan Guzman
    Aug 16, 2019 at 23:49
  • 1
    Just set up a new VM using 18.04 and that fails with the same error and then I tried 16.04 and that one works so seems something has changed in some package recently in newer versions that has broken compatibility. 16.04 is too old for my other services so I will have to run an old legacy 16.04 instance just for SQL Server. It seems even the 2019 preview works on 16.04 too. Would appreciate it if anyone finds a workaround for this latest problem in the more recent versions of Ubuntu. Aug 17, 2019 at 1:20
  • 2
    One workaround would be running a SQL Server Ubuntu 16.04 docker image on your later version host.
    – Dan Guzman
    Aug 17, 2019 at 1:35

1 Answer 1

8

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:

  1. Stop SQL Server

    sudo systemctl stop mssql-server
    
  2. Open the editor for the service configuration

    sudo systemctl edit mssql-server
    
  3. In the editor, add the following lines to the file and save it:

    [Service]
    Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
    
  4. 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
    
  5. Start SQL Server

    sudo systemctl start mssql-server
    
1
  • 1
    Thanks so much @Dawoodjee that has fixed it and it now works again. I thought it was something SSL related but couldn't work out how to get it working again. Really wish Microsoft would officially support more recent versions. Sep 22, 2019 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.