Search code examples
pythonazuredockerazure-functionsdebian

Azure Function App Docker Build fails with 'usrmerge' error


While trying to build docker image, I am getting this following error:

******************************************************************************
32.87 *
32.87 * The usr-is-merged package cannot be installed because this system does
32.87 * not have a merged /usr.
32.87 *
32.87 * Please install the usrmerge package to convert this system to merged-/usr.
32.87 *
32.87 * For more information please read https://wiki.debian.org/UsrMerge.
32.87 *
32.87 ******************************************************************************

We do not have this library in our docker image, so I believe that it's a subdependency. I tried the suggestion and installed usrmerge package, but it still gives me the same error.

Here's my docker file:

FROM mcr.microsoft.com/azure-functions/python:4-python3.9 AS prod-image

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

RUN echo "deb https://security.debian.org/debian-security stable-security/updates main" >> /etc/apt/sources.list && \
    echo "deb https://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \
    echo "deb https://deb.debian.org/debian trixie main" >> /etc/apt/sources.list && \
    apt-get update && apt-get install -y \
    poppler-data \
    poppler-utils \
    build-essential \
    libpq-dev \
    libpq5 \
    python3-cryptography \
    python3-dev \
    libc6-dev \
    ghostscript \
    libgs10 \
    libgs10-common \
    tesseract-ocr

I have already tried to install usrmerge library, i.e., I added it into the list of packages that I was trying to install in the Dockerfile.

Expecting that the docker image builds without any error. This error popped up suddenly, the same docker image is in prod and dev envs, so it was working before today (02 November 2023).


Solution

  • Ok - I fixed it. I changed the debian version to bookworm from bullseye. Also I removed trixie list since I didn't require it. In any case, here's the updated install script:

    RUN echo "deb https://security.debian.org/debian-security stable-security/updates main" >> /etc/apt/sources.list && \
        echo "deb https://deb.debian.org/debian bookworm main contrib non-free" >> /etc/apt/sources.list && \
        apt-get update && apt-get install -y \
        poppler-data \
        poppler-utils \
        build-essential \
        libpq-dev \
        libpq5 \
        python3-cryptography \
        python3-dev \
        libc6-dev \
        ghostscript \
        libgs10 \
        libgs10-common \
        tesseract-ocr