Search code examples
azure-sql-databaseazure-cli

Unable to install Sqlcmd / mssql-tools on ubuntu 20.04


I am following the Sqlcmd installation directions from the microsoft site here Install the SQL Server command-line tools sqlcmd and bcp on Linux. The target environment is ubuntu-20.04 on Docker

The following installation does not work

sudo apt-get install -y mssql-tools unixodbc-dev
The following packages have unmet dependencies:
 mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
 unixodbc-dev : Depends: unixodbc (= 2.3.7) but it is not going to be installed
                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.

Note that I started manually correcting the missing packages but after a few iterations it led to a non-installable package

root@bb72040ed700:/usr/build# apt install -y mssql-tools unixodbc-dev unixodbc

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 unixodbc-dev : 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.

Then later:

libodbc1 : PreDepends: multiarch-support but it is not installable odbcinst1debian2 : PreDepends: multiarch-support but it is not installable

Note: I have already viewed the similar post Intalling mssql-tools and unixodbc-dev on Ubuntu 20 . Since I had already updated the link to 20.04 the answer provided was already incorporated and did not resolve this error.

Per request: here is output of cat /etc/os-release:

# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Any ideas how to get Sqlcmd installed on ubuntu 20.04 ?


Solution

  • Found out how to install msodbcsql17 on ubuntu: this was the crux of the errors Install msodbcsql17 on ubuntu

    curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main" | tee /etc/apt/sources.list.d/mssql-release.list
    sudo apt update
    sudo apt-get install -y msodbcsql17