Skip to content

Fix: psql not found#68

Merged
mujx merged 1 commit intomujx:masterfrom
enricodeleo:patch-1
Oct 28, 2022
Merged

Fix: psql not found#68
mujx merged 1 commit intomujx:masterfrom
enricodeleo:patch-1

Conversation

@enricodeleo
Copy link
Contributor

Due to missing packages the error

/app/start.sh: line 22: psql: command not found

Appears until we make psql available via postgresql-contrib.

Due to missing packages the error 

```
/app/start.sh: line 22: psql: command not found
```

Appears until we make psql available via `postgresql-contrib`.
@mujx mujx merged commit 6692a71 into mujx:master Oct 28, 2022
@mujx
Copy link
Owner

mujx commented Oct 28, 2022

Thanks

@rriski
Copy link
Contributor

rriski commented Nov 30, 2022

I'm still experiencing this issue with mujx/hakatime:latest-arm

@mujx
Copy link
Owner

mujx commented Dec 1, 2022

@rriski Are you using the latest version? Can you try pull the image again just in case?

@rriski
Copy link
Contributor

rriski commented Dec 2, 2022

Yep, latest version. Tried removing the image locally and pulling again. The digest matches the latest image version in Dockerhub sha256:c0645c73a209534740822e55b68acc90c13f8667f5d4e5c3cb7b3af4b997714f so I'm definitely using the latest version. I also built an image from git master and that has the same issue.

@mujx
Copy link
Owner

mujx commented Dec 2, 2022

Btw what is the context of needing the psql command in the container since the app will only need the library.

@rriski
Copy link
Contributor

rriski commented Dec 2, 2022

It is used in the start.sh script:

if PGPASSWORD="${HAKA_DB_PASS}" psql -w -U "${HAKA_DB_USER}" -h "${HAKA_DB_HOST}" -d "${HAKA_DB_NAME}" -c "select count(*) from users" 2>&1 > /dev/null; then

mujx added a commit that referenced this pull request Dec 2, 2022
@mujx
Copy link
Owner

mujx commented Dec 2, 2022

@rriski I've added the correct package in the image that should fix the problem.

rriski added a commit to rriski/hakatime that referenced this pull request Dec 10, 2022
rriski added a commit to rriski/hakatime that referenced this pull request Dec 10, 2022
Postgresql client has a dependency to perl and removing perl also removes `psql`
from the container image.

Attached logs from running `apt remove perl` from a container built with this
patch:

    root@3c557f7743b3:/# apt remove perl
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    libedit2 libgdbm-compat4 libgdbm6 libicu70 libllvm14 libperl5.34 libreadline8 libxml2 libxslt1.1 locales netbase perl-modules-5.34 readline-common ssl-cert tzdata ucf
    Use 'apt autoremove' to remove them.
    The following packages will be REMOVED:
    libjson-perl perl postgresql postgresql-14 postgresql-client postgresql-client-14 postgresql-client-common postgresql-common
    0 upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
    After this operation, 49.2 MB disk space will be freed.
    Do you want to continue? [Y/n]

Related to mujx#68
@rriski
Copy link
Contributor

rriski commented Dec 10, 2022

The issue is still present and I've narrowed the problem down to the following line: https://github.com/mujx/hakatime/blob/master/Dockerfile.arm#L47 (apt-get remove -y perl). Apparently there is some dependency chain between psql and perl and removing perl leads to postgresql-client also being removed. See the following logs obtained by running docker buildx build --platform=linux/arm64 -f Dockerfile.arm . -t hakatime:test --progress plain --no-cache

#13 [stage-2 2/7] RUN apt-get update -y -qq &&     apt-get install --no-install-recommends -y netcat libffi-dev libgmp-dev libpq-dev zlib1g-dev postgresql postgresql-client ca-certificates curl &&     apt-get remove -y perl &&     apt-get autoremove -y &&     apt-get autoclean &&     rm -rf /usr/lib/x86_64-linux-gnu/libLLVM* /usr/lib/x86_64-linux-gnu/libicudata.so*
#13 71.05 Setting up postgresql-client (14+238) ...
#13 71.29 Setting up postgresql (14+238) ...
#13 71.45 Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
#13 71.51 Processing triggers for ca-certificates (20211016ubuntu0.22.04.1) ...
#13 71.53 Updating certificates in /etc/ssl/certs...
#13 72.91 0 added, 0 removed; done.
#13 72.91 Running hooks in /etc/ca-certificates/update.d...
#13 72.91 done.
#13 73.28 Reading package lists...
#13 73.95 Building dependency tree...
#13 74.16 Reading state information...
#13 74.50 The following packages were automatically installed and are no longer required:
#13 74.50   libedit2 libgdbm-compat4 libgdbm6 libicu70 libllvm14 libperl5.34
#13 74.51   libreadline8 libxml2 libxslt1.1 locales netbase perl-modules-5.34
#13 74.51   readline-common ssl-cert tzdata ucf
#13 74.51 Use 'apt autoremove' to remove them.
#13 74.53 The following packages will be REMOVED:
#13 74.53   libjson-perl perl postgresql postgresql-14 postgresql-client
#13 74.53   postgresql-client-14 postgresql-client-common postgresql-common
#13 74.70 0 upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
#13 74.70 After this operation, 49.2 MB disk space will be freed.
(Reading database ... 13329 files and directories currently installed.)
#13 74.73 Removing postgresql (14+238) ...
#13 74.78 Removing postgresql-14 (14.5-0ubuntu0.22.04.1) ...
#13 74.79 invoke-rc.d: could not determine current runlevel
#13 74.80 invoke-rc.d: policy-rc.d denied execution of stop.
#13 75.00 Removing postgresql-common (238) ...
#13 75.05 Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
#13 75.15 Removing libjson-perl (4.04000-1) ...
#13 75.24 Removing postgresql-client (14+238) ...
#13 75.32 Removing postgresql-client-14 (14.5-0ubuntu0.22.04.1) ...
#13 75.41 Removing postgresql-client-common (238) ...
#13 75.47 Removing perl (5.34.0-3ubuntu1.1) ...
#13 75.62 Reading package lists...
#13 76.33 Building dependency tree...
#13 76.50 Reading state information...
#13 76.71 The following packages will be REMOVED:
#13 76.71   libedit2 libgdbm-compat4 libgdbm6 libicu70 libllvm14 libperl5.34
#13 76.71   libreadline8 libxml2 libxslt1.1 locales netbase perl-modules-5.34
#13 76.71   readline-common ssl-cert tzdata ucf
#13 76.88 0 upgraded, 0 newly installed, 16 to remove and 0 not upgraded.
#13 76.88 After this operation, 209 MB disk space will be freed

Notice the line "#13 75.24 Removing postgresql-client".

Opened a PR with the fix: #71

mujx pushed a commit that referenced this pull request Dec 13, 2022
Postgresql client has a dependency to perl and removing perl also removes `psql`
from the container image.

Attached logs from running `apt remove perl` from a container built with this
patch:

    root@3c557f7743b3:/# apt remove perl
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    libedit2 libgdbm-compat4 libgdbm6 libicu70 libllvm14 libperl5.34 libreadline8 libxml2 libxslt1.1 locales netbase perl-modules-5.34 readline-common ssl-cert tzdata ucf
    Use 'apt autoremove' to remove them.
    The following packages will be REMOVED:
    libjson-perl perl postgresql postgresql-14 postgresql-client postgresql-client-14 postgresql-client-common postgresql-common
    0 upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
    After this operation, 49.2 MB disk space will be freed.
    Do you want to continue? [Y/n]

Related to #68
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

Successfully merging this pull request may close these issues.

3 participants