MSSQL ODBC Client on Debian 9 Stretch

Many years ago fREW Schmidt wrote a very handy article on installing MSSQL ODBC drivers in debian. Since then Microsoft have improved their support of debian somewhat and things have changed making it easier to install, however they still (as at 2017-11-06) have not released proper drivers for Debian Stretch.
Add the microsoft repo

echo 'deb [arch=amd64] jessie main' > /etc/apt/sources.list.d/mssql-release.list

Add the key

curl | sudo apt-key add -

then update and install

sudo apt update
sudo apt install msodbcsql mssql-tools

If you try and connect to sql now you get an obscure error like this:

/opt/mssql-tools/bin/sqlcmd -S -U xxx -P yyy
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Can't open lib '/opt/microsoft/msodbcsql/lib64/' : file not found.

But the file exists:

$ file /opt/mssql-tools/bin/sqlcmd
/opt/mssql-tools/bin/sqlcmd: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/, for GNU/Linux 2.6.32, BuildID[sha1]=21a353af470e7849544daab892ec9b1bfc36dc87, not stripped

This somewhat misleading error is actually due to the libmsodbcsql lib being linked against a very specific version of libssl. Check the output of ldd:

$ ldd /opt/microsoft/msodbcsql/lib64/ | grep 'not found' => not found => not found

But it turns out this can easily be solved by manually installing the libssl package from Debian Jessie:

wget ""
sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb

then you should be back in business.


14 responses to “MSSQL ODBC Client on Debian 9 Stretch”

  1. tgarriz Avatar


  2. w0rks Avatar

    You’re the man!! This saved me a bunch of time tracking down the issue!

  3. Snickers Avatar

    Thanks. Was able to get it working on Debian Stretch.

  4. stupid dog Avatar
    stupid dog

    Finally, shame on me that it took me 2h to find your post. But again – MANY THANKS!

  5. pmateusz Avatar

    Many thanks! You save great deal of my time.

  6. rube Avatar

    You’re awesome!

    1. Jason Avatar


  7. Rodrigo Hernan Ramos Avatar
    Rodrigo Hernan Ramos

    actualizarón el paquete de lib.
    ahora es:
    sudo wget “”
    sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u9_amd64.deb

  8. Hi Thanks
    now is
    sudo wget “”
    sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u9_amd64.deb

  9. Hey,
    i cant find the packages msodbcsql and mssql-tools.
    E: Paket msodbcsql kann nicht gefunden werden.
    E: Paket mssql-tools kann nicht gefunden werden.
    There are only amd64 packages.
    msodbcsql17:amd64{ab} mssql-tools:amd64{b}
    But i cant install them. Can someone help me?

  10. Daniel Walters Avatar
    Daniel Walters

    i just want to say thanks for solving this problem. the file has moved location now but your process was invaluable.
    I opened a stackoverflow ticket documenting the new location.

    1. Jason Avatar

      Thanks Daniel

  11. Rahul Bafna Avatar
    Rahul Bafna

    Is it possible to install ODBC Driver on Debian 9 as of today? Your thread above seems to discuss about the Raspberry OS not compatible with Debian 9 as of 2017. We are facing lot of issues while installing odbc driver for debian9 Stretch for our raspberry pi 3b+ model.
    Apparently no other temporary driver works either. Do you suggest some interim fix so that we can connect MSSQL from raspberry pi

    1. Jason Avatar

      I’m sorry, I’m not aware of any way to fix this.

Leave a Reply

Your email address will not be published. Required fields are marked *