Skip to content
Home » Repair SQL Server on Linux after an Ubuntu distribution upgrade

Repair SQL Server on Linux after an Ubuntu distribution upgrade

broken glass

SQL Server 2017 is supported on Ubuntu 16.04 LTS (Long-Term Support), however that version of Ubuntu Linux is now more than two years old, so you may be tempted to update Ubuntu to a more modern release such as Ubuntu 18.04 LTS (Bionic Beaver). Unfortunately (as of this writing), SQL Server 2017 is not supported on later versions of Ubuntu.

(Note: Ubuntu releases new distributions every six months. The version number 16.04 means that it was released in April 2016.)

The more adventurous among us who use SQL Server 2017 in a development environment — where we need to keep the Ubuntu distribution as up to date as possible — might run into the following issue:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
mssql-server : Depends: openssl (<= 1.1.0)
E: Unable to correct problems, you have held broken packages.

I would like to share this very handy answer written by langioletto that I found on Ask Ubuntu, which resolves this dependency issue.

WARNING: Downgrading packages is dangerous, especially in libraries like OpenSSL. Do not run this in a production environment!

apt-get install -y libjemalloc1 libsss-nss-idmap0 libc++1 gawk curl
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
wget http://archive.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20160104ubuntu1_all.deb
dpkg -i ca-certificates_20160104ubuntu1_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.0.2g-1ubuntu4_amd64.deb
dpkg -i openssl_1.0.2g-1ubuntu4_amd64.deb
apt install -y libcurl3
apt-get update
apt-get install -y mssql-server

Once SQL Server is installed, you will have to run sudo /opt/mssql/bin/mssql-conf setup to make sure SQL Server is configured correctly. Fortunately, SQL Server 2017 on Linux is non-destructive with any databases you already had from previous installations, so the service should start up happily by itself and all your databases should be usable.

Thanks, langioletto!

Share your Linux development environment tips and tricks with me on Twitter at @bornsql.

5 thoughts on “Repair SQL Server on Linux after an Ubuntu distribution upgrade”

  1. This is just crazy. Given how Microsoft has said they’re committed to SQL Server on Linux, and how they’ve contributed so much to Ubuntu in particular, I wonder why there is still no update that makes SQL Server 2017 compatible with the 18.04 LTS libraries.

    Fortunately there are always options to those with the fortitude to do crazy things with their development environments 😛

    1. What is even more crazy is that it doesn’t support latest 16.04.04 either because of the openssl issue. If you do dist-upgrade it will bump openssl and remove mssql-server package … I had 400 updates and didn’t notice this until my web server went down in fire …

  2. Great post Randolph!

    Actually we are new to Ubuntu world so if you elaborate the steps with meaning and purspose please it would be much great

    1. Manish, there’s a lot to discuss that would be out of the scope of this comment section. I recommend reading about package management from Ubuntu’s official documentation to get a better understanding of how it all works. Good luck!

Comments are closed.