ODK Central Build Error

After executing :point_up_2: command, this is what I got back.

{"Status":"unhealthy","FailingStreak":8333,"Log":[{"Start":"2020-09-21T04:55:17.372930056-04:00","End":"2020-09-21T04:55:17.474724042-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:55:47.478806438-04:00","End":"2020-09-21T04:55:47.581083314-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:56:17.584939398-04:00","End":"2020-09-21T04:56:17.688484183-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:56:47.692954492-04:00","End":"2020-09-21T04:56:47.794798131-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:57:17.7982906-04:00","End":"2020-09-21T04:57:17.901514048-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"}]}

Then connect to the nginx container and install netcat

apt-get install netcat

This is not normal because netcat should be installed already (nginx.dockerfile) and it worked when you executed it manually :face_with_monocle: (may be I am mistaken and you should install netcat on the host instead of the container)

RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib 

May be there is no link between nc and netcat, so you might want to update the health check in the docker-composer (line 40) but I doubt it

 nginx:
   container_name: nginx
   build:
     context: .
     dockerfile: nginx.dockerfile
   depends_on:
     - service
     - enketo
   environment:
     - SSL_TYPE=${SSL_TYPE}
     - DOMAIN=${DOMAIN}
     - CERTBOT_EMAIL=${SYSADMIN_EMAIL}
   ports:
     - "80:80"
     - "443:443"
   healthcheck:
     test: [ "CMD-SHELL", "netcat -z localhost 443 || exit 1" ]
   restart: always

br

Did you try to rebuild everything after you change the EOL? (this will remove all container and image, be careful if you have a bad internet connectivity, that means downloading them all over again)

docker-compose down --rmi all

br

A dialogue between terminal and :smile_cat: yours truly...lol

:man_technologist:: docker exec -it ebfaecfd15fb bash
:asterisk: : <got into root@ebfaecfd15fb>

:man_technologist:: apt-get install netcat
:asterisk:: E: Unable to locate package netcat

:man_technologist:: apt-get update --fix-missing
:asterisk: : Reading package lists... Done

:man_technologist:: apt-get install netcat
:asterisk: : Setting up netcat (1.10-41.1) ...

:man_technologist:: RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib
:asterisk: : E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

:man_technologist:: apt-get update --fix-missing
:asterisk: : Reading package lists... Done

:man_technologist:: RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib
:asterisk: :

bash: RUN: command not found
Reading package lists... Done
Building dependency tree
Reading state information... Done
netcat is already the newest version (1.10-41.1).
The following additional packages will be installed:
libgdbm-compat4 libgdbm6 libhiredis0.14 libluajit-5.1-2 libluajit-5.1-common
libnginx-mod-http-auth-pam libnginx-mod-http-cache-purge libnginx-mod-http-dav-ext
libnginx-mod-http-echo libnginx-mod-http-fancyindex libnginx-mod-http-geoip
libnginx-mod-http-headers-more-filter libnginx-mod-http-image-filter libnginx-mod-http-lua
libnginx-mod-http-ndk libnginx-mod-http-perl libnginx-mod-http-subs-filter
libnginx-mod-http-uploadprogress libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
libnginx-mod-mail libnginx-mod-nchan libnginx-mod-stream libperl5.28 netbase nginx-common perl
perl-base perl-modules-5.28
Suggested packages:
gdbm-l10n fcgiwrap nginx-doc ssl-cert perl-doc libterm-readline-gnu-perl
| libterm-readline-perl-perl make libb-debug-perl liblocale-codes-perl
The following packages will be REMOVED:
nginx nginx-module-geoip nginx-module-image-filter nginx-module-njs nginx-module-xslt
The following NEW packages will be installed:
libgdbm-compat4 libgdbm6 libhiredis0.14 libluajit-5.1-2 libluajit-5.1-common
libnginx-mod-http-auth-pam libnginx-mod-http-cache-purge libnginx-mod-http-dav-ext
libnginx-mod-http-echo libnginx-mod-http-fancyindex libnginx-mod-http-geoip
libnginx-mod-http-headers-more-filter libnginx-mod-http-image-filter libnginx-mod-http-lua
libnginx-mod-http-ndk libnginx-mod-http-perl libnginx-mod-http-subs-filter
libnginx-mod-http-uploadprogress libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
libnginx-mod-mail libnginx-mod-nchan libnginx-mod-stream libperl5.28 lua-zlib netbase nginx-common
nginx-extras perl perl-modules-5.28
The following packages will be upgraded:
openssl perl-base
2 upgraded, 30 newly installed, 5 to remove and 22 not upgraded.
Need to get 12.5 MB of archives.
After this operation, 47.2 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 perl-base amd64 5.28.1-6+deb10u1 [1514 kB]
Get:2 http://security.debian.org/debian-security buster/updates/main amd64 nginx-common all 1.14.2-2+deb10u3 [121 kB]
Err:3 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-auth-pam amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-cache-purge amd64 1.14.2-2+deb10u3 [95.1 kB]
Err:5 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-dav-ext amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:6 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-echo amd64 1.14.2-2+deb10u3 [104 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 perl-modules-5.28 all 5.28.1-6+deb10u1 [2873 kB]
Err:8 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-fancyindex amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:9 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-geoip amd64 1.14.2-2+deb10u3 [94.0 kB]
Err:10 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-headers-more-filter amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:11 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-image-filter amd64 1.14.2-2+deb10u3 [97.5 kB]
Get:12 http://deb.debian.org/debian buster/main amd64 libgdbm6 amd64 1.18.1-4 [64.7 kB]
Get:13 http://deb.debian.org/debian buster/main amd64 libgdbm-compat4 amd64 1.18.1-4 [44.1 kB]
Get:14 http://deb.debian.org/debian buster/main amd64 libperl5.28 amd64 5.28.1-6+deb10u1 [3894 kB]
Err:15 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-ndk amd64 1.14.2-2+deb10u3
501 Not Implemented [IP: 151.101.248.204 80]
Get:16 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-lua amd64 1.14.2-2+deb10u3 [238 kB]
Err:16 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-lua amd64 1.14.2-2+deb10u3
File has unexpected size (93232 != 237784). Mirror sync in progress? [IP: 151.101.248.204 80]
Hashes of expected file:

:man_technologist:: docker-compose down --rmi all
:asterisk: : Stopping nginx ... done Stopping service ... done Stopping enketo ... done Stopping mail ... done Stopping pyxform ... done Stopping enketo_redis_main ... done Stopping enketo_redis_cache ... done Stopping central_postgres_1 ... done Removing nginx ... done Removing service ... done Removing enketo ... done Removing mail ... done Removing pyxform ... done Removing enketo_redis_main ... done Removing enketo_redis_cache ... done Removing central_postgres_1 ... done Removing secrets ... done Removing network central_default Removing image postgres:9.6 Removing image itsissa/namshi-smtp:4.89-2.deb9u5 Removing image getodk/pyxform-http:v1.0.0 Removing image central_secrets Removing image redis:5 Removing image redis:5 WARNING: Image redis:5 not found. Removing image central_enketo Removing image central_service Removing image central_nginx

:man_technologist:: docker ps
:asterisk: : CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

:man_technologist:: docker-compose build
:asterisk: : Service 'nginx' failed to build : The command '/bin/sh -c apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib' returned a non-zero code: 100

:man_technologist::
:asterisk: :

After changing those lines and also replacing EOL as suggested by @aankrah (sed 's/\r$//' nginx.dockerfile) I am still getting an error for nginx build step:

Can you help me out?

Hello @tertek,
I'm sorry to hear you're facing an error. However, your post in its current state does not do much to adequately equip those who might be able to help you. Kindly furnish us with the version of Central you are installing. The OS you are installing on and what you might have already tried to solve your issue.

I am certain the community would have lots of suggestions when we know exactly what your situation is.

1 Like

Hey @aankrah ,
Thank you for your quick response. Actually, I could resolve the issue in the meanwhile. I had to replace EOL for the following files as well:

files\prebuild\write-version.sh
files\prebuild\build-frontend.sh

Edit: Turns out that later when starting ODK more *.sh files have to be fixed. I have written a short Windows command that fixes all relevant files. It is part of a small guide
Installing ODK Central on Windows 10

Maybe it helps :slight_smile:

3 Likes

Hey there!

I have added /bin/sh in nginx.dockerfile but how do I do this "Then replace the Windows EOL by linux EOLin all the files (Git wrongly configured to use CRLF instead of LF when writing the files)"

i need help please! I have been trying to resolve this error for past 2 weeks.

Step 3/19 : RUN files/prebuild/write-version.sh
---> Running in 37743973b02e
/bin/sh: 1: files/prebuild/write-version.sh: not found
ERROR: Service 'nginx' failed to build : The command '/bin/sh -c files/prebuild/write-version.sh' returned a non-zero code: 127

can you please help me out.
Facing exact sane error.

I have replaced EOL and all but nothing works for me

2 posts were split to a new topic: Central failed to bind to port 80