Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: apt-get install msodbcsql

When I execute the following in the terminal:

#sudo apt-get install msodbcsql

I get the following error:

Installation Failed, ODBC Driver 11 for SQL Server Detected!

I tried to reinstall following this tutorial:

https://learn.microsoft.com/en-us/sql/connect/odbc/linux/installing-the-microsoft-odbc-driver-for-sql-server-on-linux

but I still get the same error. Any ideas?

like image 550
Lenwë Galathil Avatar asked Dec 19 '22 09:12

Lenwë Galathil


2 Answers

I'm using Debian with Ubuntu packages for mssql server. I had the same problem trying to reinstall mssql-tools, the message:

Installation Failed, ODBC Driver 13 for SQL Server Detected!

The solution: In file /etc/odbcinst.ini delete the following lines:

[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.8.0
UsageCount=1

Finally, I did apt -f install and problem solved.

like image 124
sebastian Avatar answered Jan 05 '23 16:01

sebastian


To solve this i did a couple of things:

  1. I removed the contents of /etc/odbcinst.ini as suggested by Sebastian

  2. I stopped the mssql-server service sudo systemctl stop mssql-serverI don't know if this was necessary, but fiddling with tools related to it, it seemed the decent thing to do.

  3. I did sudo apt remove mssql-tools

  4. Then sudo apt remove msodbcsql The mssqlodbc part appended by whatever version number

  5. Then sudo apt install mssql-toolsthis will install the newest version of mssql-tools for which msodbcsql is a requirement and thus it will itself fetch the required (newest i should think) version of that package. At this point, the problem has been fixed, The Sql service should still be started though

  6. sudo systemctl start mssql-server

And thus everything was fine for me again.

Please notice that i did this in elementary OS 0.4 Loki.

like image 44
rasmus91 Avatar answered Jan 05 '23 16:01

rasmus91