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

ERROR [db 6/12] RUN apt-get update && apt-get -y --no-install-recommends install cron #3506

Open
vengefulpunk opened this issue Feb 8, 2025 · 2 comments

Comments

@vengefulpunk
Copy link

vengefulpunk commented Feb 8, 2025

I am trying to install BookWyrm on Ubuntu 24.04, but I am having an issue and receiving an error recommending installing cron. I even tested adding an entry into crontab, and it worked fine.

` => [db internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.18kB 0.0s
=> [db internal] load metadata for docker.io/library/postgres:13.0 0.2s
=> [db internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [db 1/12] FROM docker.io/library/postgres:13.0@sha256:8f7c3c9b61d82a4a021da5d9618faf056633e089302a726d619fa467c73609e4 0.0s
=> [db internal] load build context 0.0s
=> => transferring context: 86B 0.0s
=> CACHED [db 2/12] RUN mkdir /backups 0.0s
=> CACHED [db 3/12] COPY ./backup.sh /usr/local/bin/bookwyrm-backup.sh 0.0s
=> CACHED [db 4/12] COPY ./weed.sh /usr/local/bin/bookwyrm-weed.sh 0.0s
=> CACHED [db 5/12] COPY ./cronfile /etc/cron.d/cronfile 0.0s
=> ERROR [db 6/12] RUN apt-get update && apt-get -y --no-install-recommends install cron 1.3s

[db 6/12] RUN apt-get update && apt-get -y --no-install-recommends install cron:
0.174 Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
0.187 Get:2 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
0.213 Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
0.284 Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [610 kB]
0.357 Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7,909 kB]
0.446 Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [8,788 B]
0.525 Ign:7 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease
0.554 Err:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg Release
0.554 404 Not Found [IP: 72.32.157.246 80]
0.962 Reading package lists...
1.248 E: The repository 'http://apt.postgresql.org/pub/repos/apt buster-pgdg Release' does not have a Release file.


failed to solve: process "/bin/sh -c apt-get update && apt-get -y --no-install-recommends install cron" did not complete successfully: exit code: 100`

@tofuwabohu
Copy link
Contributor

We get the same error after having to rebuild. These steps don't happen on the vm but while building the Database image based on the postgres-docker Dockerfile. It's based on Postgres:13.0, which is based on debian:buster-20201012-slim, which is EOL since last year and at some point in the recent past postgresql seems to have removed the repositories for buster.

In a local test, I switched the base image to postgres:bookworm (which I find very fitting) and it can install cron with no trouble, but docker entrypoint seems to have moved which leads to problems further in the build:

  \> [10/12] RUN awk '$0 ~ /^\t_main "\$@"$/ { print "\tif [[ $1 == cron ]]; then\n\t\techo \"POSTGRES_DB=${POSTGRES_DB}\" > /backups/.env\n\t\techo \"POSTGRES_USER=${POSTGRES_USER}\" >> /backups/.env\n\t\tservice cron start\n\t\tshift\n\tfi" }{ print }' docker-entrypoint.sh > bookwyrm-entrypoint.sh:
0.369 awk: cannot open docker-entrypoint.sh (No such file or directory)

I'm not sure I understand that command correctly. The new container has a docker-entrypoint.sh as well but probably it differs from the first one.

I was, as a workaround, able to get around the issues by changing the docker-compose db section, but that removes the automatic backups.

  db:
    #build: postgres-docker
    image: postgres:13.0
    restart: always
    env_file: .env
      #entrypoint: /bookwyrm-entrypoint.sh
      #command: cron postgres
    volumes:
      - pgdata:/var/lib/postgresql/data
      - backups:/backups
    networks:
      - main

I guess we need to update the selfbuilt postgres image but I'm lost on the awk command (and maybe, while at it, upgrading to the latest version would prevent future issues with this). We could also switch to mainline postgres and pull the backup functionality out of the production database container.

@tofuwabohu
Copy link
Contributor

tofuwabohu commented Feb 10, 2025

Just noticed there's #3439 with the same problem and a better workaround fixing the awk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants