RHEL 8 Container MSSQL ODBC Driver e2fsprogs
Asked Answered
G

4

7

I'm trying to build a custom docker container using the RHEL 8 UBI. As part of this I want to install the MSSQL 17 ODBC driver. I've followed the steps outlined in Microsofts Documentation here: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#redhat17

And added the Microsoft repo to my yum.repos.d directory however when I try to build the container I get the following error: nothing provides e2fsprogs needed by msodbcsql17-17.6.1.1-1.x86_64

When I dug a bit further into this it looks as though it looks as though for RHEL-7 Microsoft suggest installing e2fsprogs manually you can see that here: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#offline-installation

This unfortunately isn't possible in RHEL-8 as e2fsprogs-static has been removed: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#removed-packages_changes-to-packages

The full output from the build is:

$  docker build -f ./test.dockerfile -t daark:1 .
Sending build context to Docker daemon  25.77MB
Step 1/7 : FROM registry.redhat.io/ubi8/ubi
 ---> a1f8c9699786
Step 2/7 : RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
 ---> Using cache
 ---> 90b3e1514239
Step 3/7 : RUN yum search odbc
 ---> Using cache
 ---> b26f78d0da28
Step 4/7 : RUN yum search msodbcsql17
 ---> Using cache
 ---> c6f7751b97dc
Step 5/7 : ENV ACCEPT_EULA=Y
 ---> Using cache
 ---> 2b0003944673
Step 6/7 : RUN yum install -y unixODBC unixODBC-devel
 ---> Using cache
 ---> 1d0b8c594905
Step 7/7 : RUN yum install -y msodbcsql17
 ---> Running in 67c30e75fb42
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:08:11 ago on Wed Aug  5 09:36:32 2020.
Error:
 Problem: cannot install the best candidate for the job
  - nothing provides e2fsprogs needed by msodbcsql17-17.6.1.1-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
The command '/bin/sh -c yum install -y msodbcsql17' returned a non-zero code: 1

This error is pretty reproducible here is the test dockerfile i'm using to debug


FROM registry.redhat.io/ubi8/ubi
RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN yum search odbc
RUN yum search msodbcsql17
ENV ACCEPT_EULA=Y
RUN yum install -y unixODBC unixODBC-devel 
RUN yum install -y msodbcsql17

Has anyone managed to get this ODBC driver installed on an RHEL 8 UBI based container?

Gussie answered 5/8, 2020 at 9:54 Comment(0)
C
1

Latest msodbcsql17 release fixes this issue. The documentation steps work smooth once again. See docs issue

Chickie answered 2/8, 2021 at 13:14 Comment(0)
G
5

I found a work around that I hope will help the next person to hit this. Rather than running yum install -y msodbcsql17 I instead used yum to download the RPM yum download -y msodbcsql17 then used rpm -Uvh --nodeps msodbcsql17*rpm to install it.

You can use this docker file:

FROM registry.redhat.io/ubi8/ubi
RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN yum search odbc
RUN yum search msodbcsql17
ENV ACCEPT_EULA=Y
RUN yum install -y unixODBC unixODBC-devel 
RUN yum download -y msodbcsql17
RUN rpm -Uvh --nodeps msodbcsql17*rpm
Gussie answered 5/8, 2020 at 10:46 Comment(3)
Thank you for this, I will try this i our environment, but it seems strange that one can just skip dependencies!Hera
@Hera - it's a weird one, as far as I can tell it's because redhat stopped supporting that dependency unfortunately rather than them just skipping it they've assumed it's going to be available from the repo's :(Gussie
@Gussie thank you for posting this solution. Your solution got me over the problem I was facing. I ended modifying your solution to this (in case it helps anyone else): ``` FROM registry.access.redhat.com/ubi8/python-38 as development USER root RUN yum update --assumeyes && \ yum install --assumeyes \ unixODBC-devel \ && yum clean all RUN curl packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo RUN yum download -y msodbcsql17 RUN ACCEPT_EULA=y rpm -Uvh --nodeps msodbcsql17*rpm ```Maigre
M
3

@daark thank you for posting your solution. Your solution got me over the problem I was facing. I ended modifying your solution to the following (in case it helps anyone else):

FROM registry.access.redhat.com/ubi8/python-38

USER root
RUN yum update --assumeyes && \
  yum install --assumeyes \
    unixODBC-devel \
  && yum clean all

RUN curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN yum download -y msodbcsql17
RUN ACCEPT_EULA=y rpm -Uvh --nodeps msodbcsql17*rpm

I tried to add this to the @daark's solution as a comment, but it was too difficult to display the code properly.

Good luck to anyone else facing this issue 🍀

Maigre answered 11/5, 2021 at 21:43 Comment(5)
Thanks for updating Zhao, this seems to be becoming more of an issue good to get as many answers in this as possible!Gussie
Isn't it dangerous to install the driver it without dependecies? It can fail at runtime.Chickie
@Chickie sorry I’m not sure if it’s dangerous. And I’m not sure what dependencies you are referring to.Maigre
I'm referring to e2fsprogs library which is a dependency of msodbcsql17. Ran into the same issue today. In your answer the command line installs msodbcsql17 without checking for dependencies. (see --nodeps flag)Chickie
Oh I see. I’ll try and see if the —nodeps is needed or notMaigre
C
1

Latest msodbcsql17 release fixes this issue. The documentation steps work smooth once again. See docs issue

Chickie answered 2/8, 2021 at 13:14 Comment(0)
M
0

I can confirm that installation on redhat/ubi8 works with msodbcsql17-17.8.1.2-1.x86_64.rpm.

FROM redhat/ubi8 
COPY msodbcsql17-17.8.1.2-1.x86_64.rpm /tmp 
RUN MSSQL_PID=Developer ACCEPT_EULA=Y yum -y localinstall /tmp/msodbcsql17-17.8.1.2-1.x86_64.rpm; rm /tmp/msodbcsql17-17.8.1.2-1.x86_64.rpm
Monodic answered 2/8, 2022 at 18:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.