lhroot icon indicating copy to clipboard operation
lhroot copied to clipboard

Can't Install Postgresql

Open 9emss opened this issue 2 years ago • 3 comments

Hey i have issue to install postgresql on chroot. every method i have tried, but nothing works. they have same error about creating shared memory.

9emss avatar Jun 08 '23 16:06 9emss

mount /dev/shm manually

eg. mount -t tmpfs tmpfs /data/ubuntu/dev/shm

FerryAr avatar Jul 04 '23 02:07 FerryAr

mount /dev/shm manually

eg. mount -t tmpfs tmpfs /data/ubuntu/dev/shm

Does not seem to work

I also notice this mount already in the bootlinux_init. May be it's another issue

The full error (debian 11):

/usr/lib/postgresql/13/bin/initdb -D /var/lib/postgresql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... 2024-05-25 08:45:06.009 UTC [24688] FATAL:  could not create shared memory segment: Function not implemented
2024-05-25 08:45:06.009 UTC [24688] DETAIL:  Failed system call was shmget(key=55302, size=56, 03600).
child process exited with exit code 1
initdb: removing data directory "/var/lib/postgresql/data"

ppvan avatar May 25 '24 08:05 ppvan

After some investigations, I'm been able to get postgres running. First compile android-shmem from source inside chroot eviroment (or cross compile on PC, as long as it is same architecture with your phone cpu).

You'll need to make a modification to this part, remove the if statement(I have no idea what will it affected).

Then move the .so file to /lib (inside chroot), mine is /lib/libandroid-shmem.so Now before do any thing with postgres server, you it to custom LD_PRELOAD like this

env LD_PRELOAD="/lib/libandroid-shmem.so" pg_ctl start

ppvan avatar May 25 '24 16:05 ppvan