Unable install SQLserver tool in ubuntu 20

Viewed 8734

I installed SQLserver in my ubuntu. But when I install sqlserver-tool something happened. type

sudo apt-get install unixodbc-dev

return

eading package lists... Done
Building dependency tree       
Reading state information... Done
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 to resolve the situation:

The following packages have unmet dependencies:
 unixodbc-dev : Depends: unixodbc (= 2.3.7)
                Depends: odbcinst1debian2 (= 2.3.7) but 2.3.6-0.1build1 is to be installed
E: Unable to correct problems, you have held broken packages.

so that I tried below

sudo apt-get install unixodbc

returns

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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 to resolve the situation:

The following packages have unmet dependencies:
 unixodbc : Depends: odbcinst1debian2 (>= 2.3.7) but 2.3.6-0.1build1 is to be installed
            Depends: libodbc1 (>= 2.3.7) but 2.3.6-0.1build1 is to be installed
E: Unable to correct problems, you have held broken packages.

and lastly

sudo apt-get install odbcinst1debian2

return

eading package lists... Done
Building dependency tree       
Reading state information... Done
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 to resolve the situation:

The following packages have unmet dependencies:
 odbcinst1debian2 : PreDepends: multiarch-support but it is not installable
E: Unable to correct problems, you have held broken packages.

I completely stacked and have no idea at all. Dose anybody can help for me. Thanks.

4 Answers

User rim96 has right, the reason is that Microsoft's source list includes unixodbc in higer version (2.3.7) that depends on multi-arch (unlike Ubuntu's version 2.3.6) I think that unixodbc 2.3.6 is good enough. In my case the follow steps helped me.

Remove Microsoft's source list.

mv /etc/apt/sources.list.d/mssql-tools.list ~/

Update sources

sudo apt-get update 

Install unixodbc 2.3.6 from Ubuntu repository

sudo apt-get install unixodbc

Move Microsoft's source list back

mv ~/mssql-tools.list /etc/apt/sources.list.d/

Update sources again

sudo apt-get update

Install mssq-tools (or whatever you want) from Microsoft's repository

sudo apt-get install mssql-tools

User Jiří Chmiel's answer helped a lot, though I changed two lines to:

    sudo mv /etc/apt/sources.list.d/msprod.list ~/

and:

    sudo mv ~/msprod.list /etc/apt/sources.list.d/

was what worked for me (Ubuntu 20.04 in Dec '20)

If you follow Microsoft install guide for SQL Server Tools, for Ubuntu it says

If you are using Ubuntu 18.04 or Ubuntu 20.04, change the repository path in step 2 below from /ubuntu/16.04 to /ubuntu/18.04 or /ubuntu/20.04

So in step 2, you should do

curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

instead of

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Related