Postgresql16 issue after fresh install, as initial database cannot be created, as command not recognized

HI I am wanting to install PostgresSQL for one of the app that requires version 16. I found very little references and after long time building it looks that the SQL was build and installed, but I cannot start it, because there is missing initial Database. The folder is there, just nothing in it. ( one of the the recomendations was to delete hat folder) It does not recognize command (despite program and manyothers are there) initdb. I tried to insert it into .bashrc , or set up an alternative by using. (it is supposte to run as superuser, whichI do,and I also try ot include the PATH in different definitions into the bashrc..) systemd was not created yet. Other solution was about puting UID of superuser to somewhre. UID is 944, but cannot do is as systemd is not created yet in this phase

initdb set/path/initdb

And after 4 hours of search everywhere are only recommendation of how to do it on Debian, and those solutions does not work. It looks, that SQL his should be in support. Somebody some ideas?
only post similar I found is not the same issue
postgre 17

heee is officieal, but again refers to Debian, to my understanding.

You haven’t mentioned the method you used to install postgresql16, so I’ll assume that you have installed it from the AUR (pamac build postgresql16).

Did you follow the instructions in the pinned comment on the AUR (en) - postgresql16 page:

mrechte commented on 2025-02-12 16:40 (UTC)

Introduction

Unfortunately, for some unknown reason, AUR maintainer refuses competition with the official package at the same major version.

This version may cohabit with other major versions, including the official one.

Data directory is /var/lib/postgres/data16

Initialize the database
su - postgres
. /opt/postgresql16/bin/pgenv.sh
initdb -k
Start the service
systemctl start postgresql16
Use the service
. /opt/postgresql16/bin/pgenv.sh
psql -U postgres

postgresql is at 18.1 on Manjaro all branches.

 $ mbn info postgresql -q
Branch         : archlinux
Name           : postgresql
Version        : 18.1-2
Repository     : extra
Build Date     : Thu 18 Dec 2025 09:58:04 
Packager       : Jelle van der Waa <jelle@archlinux.org>
Branch         : unstable
Name           : postgresql
Version        : 18.1-2
Repository     : extra
Build Date     : Thu 18 Dec 2025 09:58:04 
Packager       : Jelle van der Waa <jelle@archlinux.org>
Branch         : testing
Name           : postgresql
Version        : 18.1-1
Repository     : extra
Build Date     : Thu 13 Nov 2025 18:03:41 
Packager       : Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Branch         : stable
Name           : postgresql
Version        : 18.1-1
Repository     : extra
Build Date     : Thu 13 Nov 2025 18:03:41 
Packager       : Jan Alexander Steffens (heftig) <heftig@archlinux.org>

For other versions you need to ensure that your postgresql version is not updated unintentionally. Please see the Arch Wiki on how to handle upgrade situations.

Running two different versions side by side will only create frustration and confusion.

I can easily imagine and understand the complexity in maintaining a DBS - I maintain a whole eco-system around MSSQL - API server - and web klient, including communication to external services and integration to ERP system.

Thank you Indeed I did use graphical environment of pamac where it took really long time to build up,.but at the end it did happend. I am sorry I did not look that link you sent me, for some reasons, I still do not understand How I suppose to use that webside, but I see it helped, and now I did manage to start it up and have it running, Going to sleep now, and will do some more test tomorrow, thank you very much for link
I see now
.opt/xxxonly adds the paths for calling the services of postgre..
and other comand is for updating the password. I am not sure, why it is not referring first to create user, but maybe it is only because someone who wrote that comment wanted to simplify it for himself… I see there is a slight difference in comand syntax I foud indication to write it oposite way around Like this export PATH=$PATH:/opt/postgre/16/bin...
May that be an issue?
One issue is that the .sh file did not added the requirid paths into bashrc file, so for now I did added it manually.May it be because thes .sh files are actually not doing what they should that why i got this issue at the first place?MAY SOMEBODY respond me this plz?

I am also not able to work with it in webmin. The webmin says this:

The PostgreSQL host configuration file /var/lib/postgres/data/pg_hba.conf was not found on your system. I will try to follow the link below now. Maybe PostgreSQL has not been initialised, or your module configuration is incorrect.

May someone approve that is good to try? probably yes.

I can’t provide any advice on running the postgresql16 application as I have no experience with using or running databases, and I do not want to give you wrong advice based on guesswork rather than knowledge.

Hopefully someone with knowledge of postgresql might be able to step in and provide more assistance.

However, you should be aware that postgresql16 is not supported by Manjaro due to it being an AUR package, and it being several versions behind the version of postgresql that is in the repos (currently v18.1).

You might have to do some research yourself on this matter.

For now I am testing the following way to start it up.

postgres=# \password postgres
#first  is good to reset password for postgres user
Enter new password for user "postgres": 
Enter it again: 
postgres=# sudo rm -rf /var/lib/postgres/data16/*
postgres*# sudo /opt/postgresql16/bin/postgresql-16-setup initdb
postgres*# sudo chown -R postgres:postgres /var/lib/postgres/data16
postgres*# sudo chmod -R 700 /var/lib/postgres/data16
postgres*# sudo systemctl start postgresql-16
postgres*# sudo systemctl enable postgresql-16
postgres*# sudo systemctl status postgresql-16

the google was recomendng to do it all from user though using sudo comands to increase the access permisions, for operating with files. It is not clear for me why it did not work. I had to change the paths a bit in coresponding whre the instalation is, not the one described by google. But the verification of status definitely did not work out. Will try to do it out of postgres user, if any difference.

there was written also you have to

empty install “data” directories and read all log files carefully.
After doing the above verify that postgres is in /var/lib/pgsql and a running process with “ps -ef | grep postgres” (its on port 5432)

If you run into any other problems you may need to create or modify a postgres user/password or clean a postgres data directory out. So this is what I gona do. thoughh not sure if it really would helpnor where to find the logs.

I got this log

sudo: /opt/postgresql16/bin/postgresql-16-setup: command not found
[micelula ~]# ps -ef | grep postgres
postgres     892       1  0 ene17 ?        00:00:02 /opt/postgresql16/bin/postgres -D /var/lib/postgres/data16
postgres     918     892  0 ene17 ?        00:00:00 postgres: checkpointer 
postgres     919     892  0 ene17 ?        00:00:00 postgres: background writer 
postgres     921     892  0 ene17 ?        00:00:00 postgres: walwriter 
postgres     922     892  0 ene17 ?        00:00:00 postgres: autovacuum launcher 
postgres     923     892  0 ene17 ?        00:00:00 postgres: logical replication launcher 
root       60095   59856  0 00:46 pts/1    00:00:00 sudo -iu postgres
root       60097   60095  0 00:46 pts/2    00:00:00 sudo -iu postgres
postgres   60098   60097  0 00:46 pts/2    00:00:00 -bash
root       61879   61759  0 01:14 pts/2    00:00:00 grep --colour=auto postgres
[micelula ~]# ps -ef | grep postgres
root       60095   59856  0 00:46 pts/1    00:00:00 sudo -iu postgres
root       60097   60095  0 00:46 pts/2    00:00:00 sudo -iu postgres
postgres   60098   60097  0 00:46 pts/2    00:00:00 -bash
root       61899   61759  0 01:15 pts/2    00:00:00 grep --colour=auto postgres

Does it mean it is running?

THE RECOMENDATION IS TOP VERIFY and it seems not running

[micelula ~]#  systemctl status postgresql-16
Unit postgresql-16.service could not be found.

to myunderstanding it should be a config file under /var/lib/postgres/data16/pg_hba.conf
It just is empty folder data16, so i think it did not get initialized… i Don know, shall I try to create one?
official documentation

the issue is when I type the command somehow it odes not find. I have tried to add it into env variable as PATH, but maybe it is not the right place where to put it.

pg_ctl -D /var/lib/postgres/data16 initdb
bash: pg_ctl: command not found

I got it.. The right steps was initiate it to log in into superuser and do this command.

micelula ~]# su postgres
[postgres@micelula root]$ initdb -D /var/lib/postgres/data16 
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 this locale configuration:
  provider:    libc
  LC_COLLATE:  en_GB.UTF-8
  LC_CTYPE:    en_GB.UTF-8
  LC_MESSAGES: en_GB.UTF-8
  LC_MONETARY: es_ES.UTF-8
  LC_NUMERIC:  es_ES.UTF-8
  LC_TIME:     es_ES.UTF-8
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgres/data16 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Europe/Madrid
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgres/data16 -l logfile start