Unable to load dynamic library 'imap.so'

after upgrading nextcloud from 27.0 to 27.0.1 I am getting the following errors. What could be the issue? I am pulling the latest apache image. Dockerfile and versions.php is right below.

app_1        | Can't start Nextcloud because the version of the data (
app_1        | Warning: PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so (libc-client.so.2007e: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
app_1        | 27.0.1.2) is higher than the docker image version (
app_1        | Warning: PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so (libc-client.so.2007e: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
app_1        | 27.0.1.2) and downgrading is not supported. Are you sure you have pulled the newest image version?
nextcloud_app exited with code 1
FROM nextcloud:apache

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        libmagickcore-6.q16-6-extra \
        procps \
        smbclient \
        supervisor \
# Install ghostscript for PDF Previews and libreoffice/default-jre/libreoffice-java-common for DOCX Previews
        ghostscript \
        libreoffice \
        default-jre \
        libreoffice-java-common \
    ; \
    rm -rf /var/lib/apt/lists/*

RUN set -ex; \
    \
    savedAptMark="$(apt-mark showmanual)"; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        libbz2-dev \
        libc-client-dev \
        libkrb5-dev \
        libsmbclient-dev \
    ; \
    \
    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
    docker-php-ext-install \
        bz2 \
        imap \
    ; \
    pecl install smbclient; \
    docker-php-ext-enable smbclient; \
    \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
    apt-mark auto '.*' > /dev/null; \
    apt-mark manual $savedAptMark; \
    ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
        | awk '/=>/ { print $3 }' \
        | sort -u \
        | xargs -r dpkg-query -S \
        | cut -d: -f1 \
        | sort -u \
        | xargs -rt apt-mark manual; \
    \
    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
    rm -rf /var/lib/apt/lists/*

RUN mkdir -p \
    /var/log/supervisord \
    /var/run/supervisord \
;

COPY supervisord.conf /

ENV NEXTCLOUD_UPDATE=1

CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]

#Enable PDF Previews
RUN sed -i 's+domain="coder" rights="none" pattern="P+domain="coder" rights="read|write" pattern="P+' /etc/ImageMagick-6/policy.xml
RUN sed -i 's+domain="coder" rights="none" pattern="E+domain="coder" rights="read|write" pattern="E+' /etc/ImageMagick-6/policy.xml
RUN sed -i 's+domain="coder" rights="none" pattern="X+domain="coder" rights="read|write" pattern="X+' /etc/ImageMagick-6/policy.xml
<?php 
$OC_Version = array(27,0,1,2);
$OC_VersionString = '27.0.1';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '26.0' => true,
    '27.0' => true,
  ),
  'owncloud' => 
  array (
    '10.11' => true,
  ),
);
$OC_Build = '2023-07-20T10:49:53+00:00 e9174a418927eade3a1e6261978b27abdfdfcef6';
$vendor = 'nextcloud';

I’d be most concerned about the “Can’t start NC because of version” and “downgrading is not supported” messages than the missing IMAP library.

You say you “upgraded” - do you have the logs from that? How did the update/upgrade process go?

Since you’re running a customized image, you’ll have to keep track of changes that happen upstream and make sure you’re accommodating them. I see you’re using some variation of the old supervisord examples stuff - not sure if anyone has tested it with recent image changes.

Upstream moved to Bookworm recently. That’s one bit that might be different:

I got it working now with the help of XtraLarge who had the problem himself and looked into it. The purge command basically removed needed dependencies so just removing it from the Dockerfile solved the issue. My working Dockerfile is in the GitHub Issue.

1 Like