Install PostgreSQL on a Raspberry Pi 3

raspberrypi3

#1

Hi,

I am trying to build a LoraServer on a Raspberry Pi 3 with Stretch using resin.io but i cannot install postgresql and I don’t understand why.

To install it I simply use:

RUN apt-get update && apt-get install -y --no-install-recommends postgresql (also tried with postgresql-9.6) postgresql-client postgresql-contrib && rm -rf /var/lib/apt/lists/*

On git push an error is displayed:

[main] Setting up postgresql-client-9.5 (9.5.4-3) …
[main] update-alternatives: using /usr/share/postgresql/9.5/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
[main] update-alternatives: error: error creating symbolic link ‘/usr/share/man/man7/ABORT.7.gz.dpkg-tmp’: No such file or directory
[main] dpkg: error processing package postgresql-client-9.5 (–configure):
[main] subprocess installed post-installation script returned error exit status 2
[main] dpkg: dependency problems prevent configuration of postgresql-9.5:
[main] postgresql-9.5 depends on postgresql-client-9.5; however:
[main] Package postgresql-client-9.5 is not configured yet.
[main] dpkg: error processing package postgresql-9.5 (–configure):
[main] dependency problems - leaving unconfigured

Which ends up with this message:

[main] Errors were encountered while processing:
[main] postgresql-client-9.5
[main] postgresql-9.5
[main] postgresql-contrib-9.5
[main] E: Sub-process /usr/bin/dpkg returned an error code (1)

And finishes with : [Error] Not deploying release.

Did anyone else had this problem ? How can it be fixed ?

Best regards,
becklo


#4

Hi,

Which base image are you using in your Dockerfile? Googling for the symbolic link error yields some results about -slim images causing this error when installing some postgresql versions. Can you try building the application with a non-slim base image?


#9

Hi,

I try to find another raspberry pi 3 compliant resin OS (in resin/* directory) but I cannot find a non-slim strect version.
I tried with:

  • resin/armv7hf-debian:stretch
  • arm32v7/debian:stretch
  • resin/raspberrypi3-debian:stretch

Where can I find other OS so I can try to fix this ?
Thanks for your answer.

Best regards,
becklo.


#10

Hi,

For those who are interested, it is not a problem of OS at the end but just a missing directory.
I fixed the problem by creating manually /usr/share/man/man7 just by adding RUN mkdir -p /usr/share/man/man7 on my Dockerfile.

becklo


#11

I presume this directory should be created empty, in which case empty directories do not git commit and a good workaround is to simply instruct docker to create them (as becklo found). I’m reckoning this one’s solved now.