无法在Ubuntu 20.04上安装Sqlcmd / mssql-tools。

huangapple go评论132阅读模式
英文:

Unable to install Sqlcmd / mssql-tools on ubuntu 20.04

问题

我正在按照微软网站上的Sqlcmd安装说明进行操作,链接在这里 在Linux上安装SQL Server命令行工具sqlcmd和bcp。目标环境是在_Docker_上的ubuntu-20.04

以下安装步骤无法完成:

sudo apt-get install -y mssql-tools unixodbc-dev
以下软件包有未满足的依赖关系:
 mssql-tools : 依赖: msodbcsql17 (>= 17.3.0.0) 但是它将不会被安装
 unixodbc-dev : 依赖: unixodbc (= 2.3.7) 但是它将不会被安装
                依赖: odbcinst1debian2 (= 2.3.7) 但是2.3.6-0.1build1将会被安装
E: 无法纠正问题,您已经拥有损坏的软件包。

请注意,我开始手动纠正缺少的软件包,但经过几次迭代后导致一个无法安装的软件包:

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

读取软件包列表... 完成 构建依赖树 正在读取状态信息... 完成 无法安装某些软件包。这可能意味着您已经请求了一个不可能的情况,或者如果您正在使用不稳定的发行版,则某些必需的软件包尚未被创建或已经移出了Incoming。以下信息可能有助于解决此问题:

以下软件包有未满足的依赖关系:unixodbc : 依赖: odbcinst1debian2 (>= 2.3.7) 但是2.3.6-0.1build1将会被安装
依赖: libodbc1 (>= 2.3.7) 但是2.3.6-0.1build1将会被安装
unixodbc-dev : 依赖: odbcinst1debian2 (= 2.3.7) 但是2.3.6-0.1build1将会被安装
E: 无法纠正问题,您已经拥有损坏的软件包。

后来:

libodbc1 : 预先依赖于: multiarch-support 但它无法安装
odbcinst1debian2 : 预先依赖于: multiarch-support 但它无法安装

注意:我已经查看了类似的帖子 在Ubuntu 20上安装mssql-tools和unixodbc-dev。由于我已经更新到 20.04,提供的答案已经被合并,未解决此错误。

按要求,这是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

有没有办法在 ubuntu 20.04 上安装 Sqlcmd

英文:

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 ?

答案1

得分: 0

学会了如何在Ubuntu上安装msodbcsql17:这是错误的关键 在Ubuntu上安装msodbcsql17

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
英文:

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

huangapple
  • 本文由 发表于 2023年4月4日 12:34:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75925543.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定