Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load dynamic library ‘imap.so’ #2037

Closed
Sim0nW0lf opened this issue Jul 25, 2023 · 18 comments · Fixed by #2046
Closed

Unable to load dynamic library ‘imap.so’ #2037

Sim0nW0lf opened this issue Jul 25, 2023 · 18 comments · Fixed by #2046
Labels

Comments

@Sim0nW0lf
Copy link

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';
@J0WI J0WI added the question label Jul 26, 2023
@XtraLarge
Copy link

XtraLarge commented Jul 28, 2023

Hi,
I've the same problem. The customizing is exactly the one that the project recomands as a full customizing example, but nextcloud did not start at all with that. So I can not understand that this is only a question.

So please fix it!

@jojolll
Copy link

jojolll commented Jul 28, 2023

Hi, there,

Same problem here, using a variant of the dockerfile as well (provided as an example in the repo: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm/Dockerfile)

When upgrading my image to nextcloud:fpm, the one generated 3 days ago, impossible to start the container afterwards with the upgrade error message.

On my side, I had another system on which I was able to recover my previous modified image, and restoring it was able to restart my nextcloud instance without any problem in the version 27.0.1.2 (no version change between the two images).

It seems that the problem is due to the change in version of Debian and PHP, since we're moving from bullseye to a bookworm. I haven't found any other information though to solve the issue.

@burgha
Copy link
Member

burgha commented Jul 29, 2023

I have exactly the same problem at the moment

@XtraLarge
Copy link

XtraLarge commented Jul 29, 2023

Hi,

I've tested a little bit and found, that there is something wrong with the garbe collection of the build process. I've commented it out and the problem was away ....

FROM nextcloud:apache

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        ghostscript \
        libmagickcore-6.q16-6-extra \
        procps \
        smbclient \
        supervisor \
#       libreoffice \
    ; \
    rm -rf /var/lib/apt/lists/*

#RUN set -ex; \
#    savedAptMark="$(apt-mark showmanual)"; 

RUN set -ex; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        libbz2-dev \
        libc-client-dev \
        libkrb5-dev \
        libsmbclient-dev

RUN set -ex; \
    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
    docker-php-ext-install \
        bz2 \
        imap
RUN set -ex; \
    pecl install smbclient; \
    docker-php-ext-enable smbclient; 

# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
#RUN set -ex; \
#    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;

#RUN set -ex; \
#    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"]

conclusion: It seems that that the purge command will also remove something needed for the imap.so library or the library himself.

@Sim0nW0lf
Copy link
Author

Sim0nW0lf commented Jul 29, 2023

Thank you very much for looking into this. It solved the issue for me too. My working Dockerfile looks like this now:

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; \
    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;

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

@jojolll
Copy link

jojolll commented Jul 29, 2023

Hello
Same for me, corrected with the autoremove modification.

I don't know if this is very useful, but it seems to be: I've kept part of the cleanup:

    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
    rm -rf /var/lib/apt/lists/*

some really useless packets are removed with this method. I think more should be removed, but it's better than nothing 👍 )

@jojolll
Copy link

jojolll commented Jul 29, 2023

@Sim0nW0lf Shouldn't the issue be left open so that the dockerfile is fixed in the repository?

@Sim0nW0lf
Copy link
Author

If you say the problem exists with the official Dockerfile too, yes. I didn't test it but let's see what they think.

@Sim0nW0lf Sim0nW0lf reopened this Jul 29, 2023
@edmondsiu0
Copy link

This bug affected me building docker container with nextcloud:26.0.4-apache - applying XtraLarge's recommendation allowed the container to come up successfully.

@stavros-k
Copy link
Contributor

Fix is here:
https://github.com/nextcloud/docker/pull/2033/files

@rabesocke
Copy link

@stavros-k Thank you for the fix in Nextcloud Docker core.

I think, this fix should also be added to the example files (https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles).

@stavros-k
Copy link
Contributor

I didn't add any fix in this repo, I just linked the fix that people have to apply in their custom builds

@XtraLarge
Copy link

XtraLarge commented Aug 2, 2023

Hi,
i can confirm that the fix works! I implemented it in the full apache example Dockerfile, but the examples in this repository were not corrected at this time. I recommend to fix your examples also ....

FROM nextcloud:apache

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        ghostscript \
        libmagickcore-6.q16-6-extra \
        procps \
        smbclient \
        supervisor \
#       libreoffice \
    ; \
    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 '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
        | sort -u \
        | xargs -r dpkg-query --search \
        | 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"]

@Sim0nW0lf
Copy link
Author

I didn't add any fix in this repo, I just linked the fix that people have to apply in their custom builds

But the fix has been merged a week ago. I have tried that part in the Dockerfile and it works, so problem solved 👍🏼

# 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 '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| 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/*

@rabesocke
Copy link

Sure, the problem is solved with the changes.

But I would suggest, that everyone of us used the Dockerfile from the example folder. So, this fix should also be added to all Dockerfiles in the mentioned example folder in this repo.

@Sim0nW0lf
Copy link
Author

True, sorry I missed that the example folder was not updated.

@Murazaki
Copy link
Contributor

Still getting the bug on nextcloud:fpm modified with dockerfile :

FROM nextcloud:fpm

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        ghostscript \
        libmagickcore-6.q16-6-extra \
        procps \
        smbclient \
#       supervisor \
#       libreoffice \
    ; \
    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"]

@Murazaki
Copy link
Contributor

nvm did not see the fix was to be added to this file 👍

FROM nextcloud:fpm

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        ghostscript \
        libmagickcore-6.q16-6-extra \
        procps \
        smbclient \
#       supervisor \
#       libreoffice \
    ; \
    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 '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
        | sort -u \
        | xargs -r dpkg-query --search \
        | 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"]

flx5 added a commit to flx5/nextcloud-full-image that referenced this issue Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants