rocker-org / rocker

R configurations for Docker
https://rocker-project.org
GNU General Public License v2.0
1.45k stars 273 forks source link

cannot build docker due to usrmerge failing #511

Closed kurt-o-sys closed 1 year ago

kurt-o-sys commented 1 year ago

I have a docker file based on rocker/r-base:latest. It has been a while since I did a build (so the 'latest' will be a newer version than my previous builds). However, when I try to build now, I get an error due to usrmerge post-install failure:

Unpacking usrmerge (33) ...
Setting up usrmerge (33) ...
Warning: overlayfs detected, /usr/lib/usrmerge/convert-usrmerge will not
be run automatically. See #1008202 for details.
If this is a container then it can be converted by unpacking the image,
entering it with chroot(8), installling usrmerge and then repacking the
image again. at /usr/lib/usrmerge/convert-usrmerge line 399.
E: usrmerge failed.
dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 usrmerge
E: Sub-process /usr/bin/dpkg returned an error code (1)
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

It seems to be related to Docker and using overlayfs.

How to solve the issue with the rocker/r-base container? Am I missing something?

Thanks!

FROM r-base:latest
MAINTAINER Kurt Sys <kurt.sys@moment-4.be>

RUN apt-mark hold base-passwd 

RUN apt update -qq && apt upgrade -y && apt install -y \
    git-core \
    libssl-dev \
    libcurl4-gnutls-dev \
    libxml2-dev \
    libsodium-dev \
    r-cran-devtools

RUN R -e "if('devtools' %in% rownames(installed.packages()) == FALSE) install.packages('devtools', dependencies=TRUE)"
RUN R -e "devtools::install_github('rstudio/plumber')"
RUN R -e "if('OrgMassSpecR' %in% rownames(installed.packages()) == FALSE) install.packages('OrgMassSpecR')"
RUN R -e "if('tidyr' %in% rownames(installed.packages()) == FALSE) install.packages('tidyr')"
RUN R -e "if('purrr' %in% rownames(installed.packages()) == FALSE) install.packages('purrr')"
RUN R -e "if('dplyr' %in% rownames(installed.packages()) == FALSE) install.packages('dplyr')"
RUN R -e "if('swagger' %in% rownames(installed.packages()) == FALSE) install.packages('swagger')"
RUN R -e "if('rlang' %in% rownames(installed.packages()) == FALSE) install.packages('rlang')"
RUN R -e "if('httpuv' %in% rownames(installed.packages()) == FALSE) install.packages('httpuv')"
RUN R -e "if('testthat' %in% rownames(installed.packages()) == FALSE) install.packages('testthat')"
RUN R -e "if('nloptr' %in% rownames(installed.packages()) == FALSE) install.packages('nloptr')"
RUN R -e "if('stringr' %in% rownames(installed.packages()) == FALSE) install.packages('stringr')"
RUN R -e "if('mgcv' %in% rownames(installed.packages()) == FALSE) install.packages('mgcv')"
eddelbuettel commented 1 year ago

Strange. Are you sure you are at the latest builds? This definitely hit me earlier in the year (e.g. a few weeks before the 4.2.2 upgrade) but not since. I am building quite a a few containers off r-base myself.

And for kicks I just launched r-base:latest and did it there: apt update -qq followed by apt upgrade for 126 packages. No issue. And rocker/r-base should be the same. (And works the same here with 126 updates).

edd@rob:~$ docker images | grep 'r-base.*latest'
r-base                               latest          3de1ef2039fb   6 weeks ago     838MB
rocker/r-base                        latest          ce611fb80498   6 weeks ago     838MB
edd@rob:~$ 
eddelbuettel commented 1 year ago

I am wondering if the Docker version or host version may matter. I do not see how.

If the CI fails, I would not know how either and recommend to build outside. For what it is worth, I also build in CI (mostly via scheduled / repeated jobs to ensure they do not 'age out' of the sixty day window) and those do not fail either. See for example this actions page for drd.

I would recommend that you try to isolate this locally a little futher. (Also: I would not recommend that suite of RUN commands per R package. Just use one, and consider binaries. Debian has about 1k packages r-cran-* and may have all covered, I otherwise now prefer r2u a lot which has all of CRAN as Ubuntu (22.04 and 20.04) binaries. I live off that for my own CI.)

kurt-o-sys commented 1 year ago

Yeah, I'm getting there. I may need to build the docker container first and push it to my own registry. I'm using a special 'ci-docker' file for my CI pipelines. I guess I need to update that one.

All these RUN commands, I remember I did it with the Debian packages, but that didn't work out for some reason. Can't remember why, I just may retry it :). But first, let's see what's going on with that usrmerge package.

Thanks!

eddelbuettel commented 1 year ago

Exactly -- sorry for the trouble you are seeing but I am fairly certain you have "merely" one outdated one there somewhere in your workflow. Once you update that to have a common and current Debian base the usrmerge will be baked in and not be an issue. With that, allow me to close this. If you find an actual reproducible and minimal issue let me and reopen.