SensorsIot / IOTstack

Docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.45k stars 308 forks source link

If MariaDB and/or NextCloud fail to build #664

Closed Paraphraser closed 1 year ago

Paraphraser commented 1 year ago

If you try to install or upgrade either MariaDB or NextCloud, you may hit the following error:

=> ERROR [2/3] RUN sed -i.bak   -e "s/^thread_cache_size/# thread_cache_size/"   -e "s/^read_buffer_size/# read_buffer_size/"   /defaults/my.cnf          1.5s
> [2/3] RUN sed -i.bak   -e "s/^thread_cache_size/# thread_cache_size/"   -e "s/^read_buffer_size/# read_buffer_size/"   /defaults/my.cnf:
#0 0.541 sed: /defaults/my.cnf: No such file or directory
failed to solve: process "/bin/sh -c sed -i.bak   -e \"s/^thread_cache_size/# thread_cache_size/\"   -e \"s/^read_buffer_size/# read_buffer_size/\"   /defaults/my.cnf" did not complete successfully: exit code: 1

IOTstack uses a local Dockerfile to customise MariaDB to do two things:

  1. apply two "stability patches";
  2. add a health-check to the container.

The stability patches are added to /defaults/my.cnf inside the container but the folks who maintain the base image for MariaDB have just renamed my.cnf to custom.cnf. That change of name is what's causing this failure.

NextCloud uses MariaDB so this problem will also prevent NextCloud from building properly.

I'll work on a pull request to fix this but, in the meantime, here's a temporary fix to get MariaDB and NextCloud running again:

  1. Use a text editor to open the file:

    ~/IOTstack/.templates/mariadb/Dockerfile
  2. As shown in the screen shot below, change my.cnf to custom.cnf, then save the file.

    mariadb
  3. Be in the correct directory:

    $ cd ~/IOTstack
  4. Depending on which container(s) you are having trouble with, you may need either or both of the following commands:

    $ docker-compose up -d --build mariadb
    $ docker-compose up -d --build nextcloud_db
  5. Tidy up:

    $ docker system prune -f

This issue will remain open until the pull request is applied. If you place a "watch" on this issue, you'll be notified when that happens. Then you can undo the temporary fix like this:

$ cd ~/IOTstack
$ git restore .templates/mariadb/Dockerfile
$ git pull
adagiomolto commented 1 year ago

Thanks, lucky to see the work already done :-) Can confirm it works.