Facing an issue while installing msodbcsql17 on ubuntu 16.04

Johny Kandhari 0 Reputation points
2023-01-11T14:53:38.9833333+00:00

I am installing msodbcsql17 in one of my docker container using below script. Docker container contains below image

python-ubuntu:3.9-ubuntu

RUN apt-get install -y unixodbc-dev>=2.3.7 unixodbc>=2.3.7

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

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

RUN apt-get update

RUN ACCEPT_EULA=Y apt-get install -y -f --allow-unauthenticated msodbcsql17

RUN ACCEPT_EULA=Y apt-get install -y --allow-unauthenticated mssql-tools

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

ENV PATH "$PATH:/opt/mssql-tools/bin"

But I am facing below Error Logs. In January 2021 I was able to build the image successfully with the same Dockerfile but now we are facing the issue.

#23 1.929 The following NEW packages will be installed:

#23 1.930 msodbcsql17

#23 2.961 0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.

#23 2.961 Need to get 744 kB of archives.

#23 2.961 After this operation, 0 B of additional disk space will be used.

#23 2.961 Get:1 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 msodbcsql17 amd64 17.8.1.1-1 [744 kB]

#23 4.114 debconf: delaying package configuration, since apt-utils is not installed

#23 4.149 Fetched 744 kB in 2s (370 kB/s)

#23 4.187 Selecting previously unselected package msodbcsql17.

(Reading database ... 16929 files and directories currently installed.)

#23 4.211 Preparing to unpack .../msodbcsql17_17.8.1.1-1_amd64.deb ...

#23 4.309 debconf: unable to initialize frontend: Dialog

#23 4.309 debconf: (TERM is not set, so the dialog frontend is not usable.)

#23 4.309 debconf: falling back to frontend: Readline

#23 4.309 debconf: unable to initialize frontend: Readline

#23 4.309 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)

#23 4.309 debconf: falling back to frontend: Teletype

#23 4.340 Unpacking msodbcsql17 (17.8.1.1-1) ...

#23 4.483 Setting up msodbcsql17 (17.8.1.1-1) ...

#23 4.496 dpkg: error processing package msodbcsql17 (--configure):

#23 4.496 installed msodbcsql17 package post-installation script subprocess returned error exit status 127

#23 4.510 Errors were encountered while processing:

#23 4.510 msodbcsql17

#23 4.518 E: Sub-process /usr/bin/dpkg returned an error code (1)

Please see if anything can be done to this problem as I am stuck with the issue since 7 days now

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,823 questions
{count} votes

2 answers

Sort by: Most helpful
  1. rob 15 Reputation points
    2023-04-28T19:22:39.2+00:00

    Hi @Johny Kandhari ,

    I had the same issue (in Databricks) and found your post via Google. Assuming this issue is still outstanding for your Docker container, the cause is likely that your Ubuntu version is too new for the package registry you've referenced.

    Assuming you are using Ubuntu 22.0 or higher,

    https://packages.microsoft.com/config/ubuntu/16.04/prod.list

    should be changed to

    https://packages.microsoft.com/config/ubuntu/22.04/prod.list

    Hope this helps!

    Rob Kimball

    3 people found this answer helpful.
    0 comments No comments

  2. Seeya Xi-MSFT 16,471 Reputation points
    2023-01-12T06:20:29.9566667+00:00

    Hi Johny Kandhari,

    Please refer to this case about how to remove msodbcsql17:

    [https://unix.stackexchange.com/questions/706827/dpkg-remove-msodbcsql17

    Then read this document about Install the Microsoft ODBC driver for SQL Server (Linux):

    [https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16

    Best regards

    Seeya Xi


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.