termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
761 stars 160 forks source link

postgresql-11 (11.7-0+deb10u1) ownership issue while installing #116

Open JanuszChmiel opened 4 years ago

JanuszChmiel commented 4 years ago

postgresql-11 (11.7-0+deb10u1) package contain special bootstrap script, which fails with The following error. running bootstrap script ... 2020-06-28 17:26:11.493 UTC [11301] FATAL: data directory "/var/lib/postgresql/11/main" has wrong ownership 2020-06-28 17:26:11.493 UTC [11301] HINT: The server must be started by the user that owns the data directory. child process exited with exit code 1 initdb: removing contents of data directory "/var/lib/postgresql/11/main" Error: initdb failed Error: could not create default cluster. Please create it manually with

pg_createcluster 11 main --start

or a similar command (see 'man pg_createcluster'). I have used Debian Buster aarch64. And I have installed The following packages. apt-get install postgresql-11 postgresql-11-postgis-2.5 postgresql-11-pgrouting I can not use Arch Linux, because there are not The packages, which I need, so I must use Debian. Because building C code of some packages on The phone with Proot can take mana y minutes, so I have given it up. Do you think, that server databases related packages can work from Proot and Termux? Or no? Dynamic shared memory is being used so I do nnot know, if it will not cause AN issues even if I will use android-shmem.so.

green2k commented 4 years ago

This may be related to https://github.com/Neo-Oli/termux-ubuntu/issues/88

michalbednarski commented 4 years ago

Looks like one way around is to run postgres in Termux outside proot, as described on Termux wiki, then you'll be able to connect from prooted system

Proot (except UserLAnd version) doesn't keep file owner uids and just reports whatever real uid is, while pg_createcluster launched as root only switches effective uid. One way around that is to switch to postgres user (for example with su postgres) when running pg_createcluster

Still there's shared memory and while using libandroid-shmem workaround makes pg_createcluster appear to succeed, attempting to connect leads to root@postgres FATAL: role "root" does not exist

JanuszChmiel commented 4 years ago

Thank you very much for yours useful advices. I will be open heart to you. My goal related to use postgresssql is not A stupid experiment because I do not know what could I do with my free time. One absolvent of informatic sciences have made excellent GPS navigation app for visually impaired users. It is based on Android client app and server app. Unfortunately, Internet in our country is not so cheap as in Poland or in USA. So I have tried to use virtual server which would host prepared Open street maps. The author of The app have prepared professional article with step by step instructions. https://github.com/scheibler/WalkersGuide-Server In The installation article part. Does somebody of us would have A good will to install aall components according to this article remotely on my phone? My problems are how to setup a optimum buffers value because only 1,2 GB can be used safely in other case, system reserves 1,2 GB of RAm for its fluent run. I also do not know how to configure gins or similar name so I would be able to connect locally to 127.0.0.1 from WalkersGuide Android client app. It would allow many visually impaired users to use this revolutionar navigation app without Internet. Walkersguid author is excellent programmer but he ddo not have free time to develop new app without Internet access, he would had to begin completely from Scratch. Android client app is oficially available from here. https://play.google.com/store/apps/details?id=org.walkersguide.android&hl=en

My next problem is that I do not know, if Debian installed by using script based on Deboodstrap allow to load android-shmem.so. ArchLinux installed by MR Rausty script support it perfectly. But no Debian. May be, that is it because that /dev/shm virtual folder is not emulated?

JanuszChmiel commented 4 years ago

Mr bednarski, I know, that ideal situation would be, if all required package which Walksers guid author uses could be directly prepared for Termux so it would be possible to run them without Proot. But it would require many many hours of time to recode C complex code. And because I can use even Gradio with Orca by using Proot and ArchLinux, even flat review of Orca work fast, build in quick navigation keys for WEB pages navigation, speech ia slso perfectly possible, I think, that Proot is so professionaly programmed, that it should not cause problem. Sure ideal situation for all Prooted distro is mobile phone which do not require too much work around from Proot routines. So no partial file system insensitivity, no Pokedata problem, ETC.

Unfortunately, some Lenovo devices uses real time data encryption and this can not be disabled from The user perspective, device can not be decrypted from its encrypted state and in this case, Proot file manipulations can be also slower. I Am afraid, that encryption is build in to Kernel firmware for some Flash memory chips for Lenovo tablets for example.

JanuszChmiel commented 4 years ago

Unfortunately, non Beta stable release of Userland and its Proot also have issues with ownership. You will have right, but I still get error from debootstrap script when installing postgresssql also error related to ownership.

michalbednarski commented 4 years ago

I've packaged what I was able to do in order to run WalkersGuide server on Debian proot into following installation script: https://gist.github.com/michalbednarski/6b0213e691f512573519cbd2b901a759

Script has to be run as root inside guest system, after successful execution it will install components into /walkersgude (in guest filesystem)

Caveats:

Following two scripts are installed into guest /bin

JanuszChmiel commented 4 years ago

Dear Mr bednarski, You have made very nice surprice for Me and for other visually impaired users. Thank you very very much for yours time and for yours attempt to help Me. Do you think, that I have The chance to run The server or I would had to buy phone with 8 GB of RAM? Sure, SQL databases are very large, it can have many GB of data. I will try The scripts and thank you very much again.

JanuszChmiel commented 4 years ago

And thank you very much that you have even patched Androidshmem library. Very well done.

JanuszChmiel commented 4 years ago

aYours script is working like A charm. I Am now running it. Packages are being installed. I will read Debian Wiky articles about configuring HTTPS WEB server. The question is, if suh complex apps can run only by using local IP traffic by using 127.0.0.1. If HTTPS do not require real domain and real Internet connection. But I will have to fight myself, you have done too much for Me including C library extension. Without you MR GBednarski, I would be never able to use Proot with Huavei 10 mate Lite. Thanks to yours suggested work around, which have been incorporated to Termux Proot branch, I can work with many Linux apps including Seamonkey, Gradio, Orca and even Libre office including spell checking support.

JanuszChmiel commented 4 years ago

Yours script have helped very much. You can close The issue. Very well done. I Am starting to generate Mysql database for Czech Republic, I will observe The amount of Free internal storage by using Windows APp or by using Settings file storage. I will have to be careful to do not let storage to gout of The available space, since it could crash The system. But I can not make qaulified conting. The standalone file from Fabrik.org has among 700 MB. But how much space will take The resulting Mysql databse is The big surprice.