1

Topic: Install Hangs while creating database

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.2 from GitHub, Commit: c19db01
- Deployed with iRedMail Easy or the downloadable installer? Download
- Linux/BSD distribution name and version: FreeBSD 12.1-RELEASE-p10 (fresh install on VM)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL (12)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

NOTE: This is a Test/Report install from the code 1.3.2 on Github (Commit: c19db01) on FreeBSD!!!

The installation hangs while creating the database.

I tested v1.3[.1] when it came out and it had the same error. I did not bother as 1.3[.1] is not FreeBSD ready.
But now digging a bit more, this issues does not look related with the Python2/3 migration.

I am running VMWare Fusion 10.1.6 (macOS) 16Gb
VM: 1Gb memory, 20Gb disk, with 17 data/ 3 swap. // Only to test installation, not to run anything.

# = = = = = = = = = =
# bash iRedMail.sh
...
====> Compressing man pages (compress-man)
===>  Installing for logwatch-7.5.1
===>  Checking if logwatch is already installed
===>   Registering installation for logwatch-7.5.1
Installing logwatch-7.5.1...
===>  Cleaning for logwatch-7.5.1
[ INFO ] Total time of ports compiling: 3 seconds, ~= 0 minute(s)

********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Generate self-signed SSL cert (4096 bits, expire in 10 years).
[ INFO ] Generate Diffie Hellman Group with openssl, please wait.
[ INFO ] Create required system accounts.
[ INFO ] Configure PostgreSQL database server.
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.log
...
creating directory /var/db/postgres/data12 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Australia/Victoria
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
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:

    /usr/local/bin/pg_ctl -D /var/db/postgres/data12 -l logfile start

 + < DEBUG > Make sure PostgreSQL binds to local address: 127.0.0.1.
 + < DEBUG > Set client_min_messages to ERROR.
 + < DEBUG > Copy iRedMail SSL cert/key with strict permission.
 + < DEBUG > Start PostgreSQL server and sleep 5 seconds for initialization
pg_ctl: PID file "/var/db/postgres/data12/postmaster.pid" does not exist
Is server running?
 + < DEBUG > Setting password for PostgreSQL admin: (postgres).
ALTER ROLE
 + < DEBUG > Update pg_hba.conf to force local users to authenticate with md5.
 + < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.
 + < DEBUG > Generate /var/db/postgres/.pgpass.
 + < DEBUG > Generate sample SQL templates.
 + < DEBUG > Create roles (vmail, vmailadmin) and database: vmail.
CREATE ROLE
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
 + < DEBUG > Create tables in vmail database.
(( Hangs Here ))


# = = = = = = = = = =
# ls -l /var/db/postgres/data12/postmaster.pid
-rw-------  1 postgres  postgres  89  9 Oct 15:54 /var/db/postgres/data12/postmaster.pid

# cat /var/db/postgres/data12/postmaster.pid
7323
/var/db/postgres/data12
1602219272
5432
/tmp
127.0.0.1
  5432001    458752
ready   


# = = = = = = = = = =
# cat ./runtime/install.status
...
export status_install_port_security_pyfail2ban='processing'
export status_install_port_security_pyfail2ban='DONE'  # 25 seconds, ~= 0 minute(s).
export status_install_port_sysutils_logwatch='processing'
export status_install_port_sysutils_logwatch='DONE'  # 3 seconds, ~= 0 minute(s).
export status_post_install_cleanup='DONE'
export status_generate_ssl_keys="DONE"
export status_add_user_vmail="DONE"
export status_add_user_mlmmj="DONE"
export status_add_user_iredadmin="DONE"
export status_add_user_iredapd="DONE"
export status_pgsql_initialize="DONE"
(( Hangs Here ))


# = = = = = = = = = =
# cat /var/log/messages
Oct  9 15:51:12 server pkg-static[78891]: py38-psycopg2-2.8.6 installed
Oct  9 15:51:57 server pkg-static[77117]: py38-sqlite3-3.8.6_7 installed
Oct  9 15:51:59 server pkg-static[23931]: py38-sqlalchemy10-1.0.14 installed
Oct  9 15:52:56 server pkg-static[63957]: py38-cython-0.29.15 installed
Oct  9 15:53:14 server pkg-static[4990]: py38-pycryptodome-3.9.8 installed
Oct  9 15:53:15 server pkg-static[57089]: py38-dnspython-1.16.0 installed
Oct  9 15:53:19 server pkg-static[35984]: py38-webpy-0.61 installed
Oct  9 15:53:24 server pkg-static[19996]: py38-simplejson-3.17.2 installed
Oct  9 15:53:47 server pkg-static[7589]: libinotify-20180201_2 installed
Oct  9 15:53:48 server pkg-static[71830]: py38-pyinotify-0.9.6 installed
Oct  9 15:53:49 server pkg-static[35786]: py38-fail2ban-0.11.1_1 installed
Oct  9 15:53:52 server pkg-static[67552]: logwatch-7.5.1 installed
Oct  9 15:55:37 server postgres[19844]: [6-1] 2020-10-09 15:55:37.460 AEDT [19844] FATAL:  canceling authentication due to timeout
(( Last message ))

# = = = = = = = = = =
# top
last pid: 53822;  load averages:  0.45,  0.47,  0.43                                                      up 0+08:08:55  19:58:10
48 processes:  1 running, 45 sleeping, 2 stopped
CPU:  0.0% user,  0.0% nice,  0.4% system,  0.0% interrupt, 99.6% idle
Mem: 17M Active, 972M Inact, 27M Laundry, 439M Wired, 132M Buf, 525M Free
Swap: 3072M Total, 3072M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
53822 root          1  20    0    13M  3828K RUN      0:00   0.03% top
27034 sysadmin      1  20    0    20M  6968K select   0:02   0.02% sshd
62262 ntpd          1  20    0    16M    16M select   0:02   0.00% ntpd
17008 root          1  20    0    11M  2648K select   0:00   0.00% syslogd
91763 sysadmin      1  20    0    20M  6972K select   1:25   0.00% sshd
75450 root          1  20    0    11M  2324K piperd   0:03   0.00% tee
 7323 postgres      1  20    0   172M    29M select   0:01   0.00% postgres
75263 root          1  52    0    15M  5908K wait     0:00   0.00% bash
 8665 postgres      1  20    0    30M    19M select   0:00   0.00% postgres
27997 root          1  20    0    13M  3848K pause    0:00   0.00% csh
 7726 postgres      1  20    0   172M    29M select   0:00   0.00% postgres
 8239 postgres      1  20    0   173M    30M select   0:00   0.00% postgres
 7747 postgres      1  20    0   172M    29M select   0:00   0.00% postgres


# = = = = = = = = = =
# ps aux
USER       PID  %CPU %MEM    VSZ   RSS TT  STAT STARTED      TIME COMMAND
. . .
postgres  7323   0.0  1.5 176356 30124  -  Ss   15:54     0:00.54 /usr/local/bin/postgres -D /var/db/postgres/data12
postgres  7457   0.0  1.5 176388 30408  -  Is   15:54     0:00.02 postgres: checkpointer    (postgres)
postgres  7726   0.0  1.5 176356 30132  -  Ss   15:54     0:00.14 postgres: background writer    (postgres)
postgres  7747   0.0  1.5 176356 30132  -  Ss   15:54     0:00.12 postgres: walwriter    (postgres)
postgres  8239   0.0  1.5 176868 30436  -  Ss   15:54     0:00.12 postgres: autovacuum launcher    (postgres)
postgres  8665   0.0  0.9  30780 19124  -  Ss   15:54     0:00.16 postgres: stats collector    (postgres)
postgres  9040   0.0  1.5 176756 30328  -  Is   15:54     0:00.02 postgres: logical replication launcher    (postgres)
root     17008   0.0  0.1  11400  2648  -  Ss   11:49     0:00.08 /usr/sbin/syslogd -ss
postgres 19743   0.0  1.5 177288 31264  -  Is   15:54     0:00.00 postgres: postgres template1 [local]  (postgres)
ntpd     62262   0.0  0.8  16600 16676  -  Ss   11:49     0:01.56 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var
root     71111   0.0  0.1  11400  2724  -  Is   11:49     0:00.10 /usr/sbin/cron -s
root     18710   0.0  0.2  12084  3384  0  T+   15:54     0:00.00 su - postgres -c psql -d template1 -f /var/db/postgres/data12/i
postgres 19077   0.0  0.4  17496  7504  0  T    15:54     0:00.00 psql -d template1 -f /var/db/postgres/data12/iredmail.sql
root     75263   0.0  0.3  15640  5908  0  I+   12:44     0:00.36 bash iRedMail.sh
root     23119   0.0  0.1  10780  2376  1  I+   12:45     0:00.01 tail -f install.log
root     23061   0.0  0.1  10780  2376  2  I+   12:45     0:00.00 tail -f install.status
root     54504   0.0  0.2  11900  3268  3  R+   19:58     0:00.00 ps aux


# = = = = = = = = = =
# pkg info | grep -E "(python|post)"
postfix-3.5.7,1                Secure alternative to widely-used Sendmail
postgresql12-client-12.4       PostgreSQL database (client)
postgresql12-contrib-12.4      The contrib utilities from the PostgreSQL distribution
postgresql12-server-12.4_1     PostgreSQL is the most advanced open-source database available anywhere
python38-3.8.6                 Interpreted object-oriented programming language


# = = = = = = = = = =
# uname -a
12.1-RELEASE-p10 FreeBSD 12.1-RELEASE-p10 GENERIC  amd64

# ulimit -a
cpu time               (seconds, -t)  unlimited
file size           (512-blocks, -f)  unlimited
data seg size           (kbytes, -d)  33554432
stack size              (kbytes, -s)  524288
core file size      (512-blocks, -c)  unlimited
max memory size         (kbytes, -m)  unlimited
locked memory           (kbytes, -l)  unlimited
max user processes              (-u)  6656
open files                      (-n)  57852
virtual mem size        (kbytes, -v)  unlimited
swap limit              (kbytes, -w)  unlimited
socket buffer size       (bytes, -b)  unlimited
pseudo-terminals                (-p)  unlimited
kqueues                         (-k)  unlimited
umtx shared locks               (-o)  unlimited

Stay safe. Cheers

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Install Hangs while creating database

angeloklin wrote:

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.2 from GitHub, Commit: c19db01
- Deployed with iRedMail Easy or the downloadable installer? Download
- Linux/BSD distribution name and version: FreeBSD 12.1-RELEASE-p10 (fresh install on VM)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL (12)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

NOTE: This is a Test/Report install from the code 1.3.2 on Github (Commit: c19db01) on FreeBSD!!!

The installation hangs while creating the database.

I tested v1.3[.1] when it came out and it had the same error. I did not bother as 1.3[.1] is not FreeBSD ready.
But now digging a bit more, this issues does not look related with the Python2/3 migration.

I am running VMWare Fusion 10.1.6 (macOS) 16Gb
VM: 1Gb memory, 20Gb disk, with 17 data/ 3 swap. // Only to test installation, not to run anything.

# = = = = = = = = = =
# bash iRedMail.sh
...
====> Compressing man pages (compress-man)
===>  Installing for logwatch-7.5.1
===>  Checking if logwatch is already installed
===>   Registering installation for logwatch-7.5.1
Installing logwatch-7.5.1...
===>  Cleaning for logwatch-7.5.1
[ INFO ] Total time of ports compiling: 3 seconds, ~= 0 minute(s)

********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Generate self-signed SSL cert (4096 bits, expire in 10 years).
[ INFO ] Generate Diffie Hellman Group with openssl, please wait.
[ INFO ] Create required system accounts.
[ INFO ] Configure PostgreSQL database server.
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.log
...
creating directory /var/db/postgres/data12 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Australia/Victoria
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
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:

    /usr/local/bin/pg_ctl -D /var/db/postgres/data12 -l logfile start

 + < DEBUG > Make sure PostgreSQL binds to local address: 127.0.0.1.
 + < DEBUG > Set client_min_messages to ERROR.
 + < DEBUG > Copy iRedMail SSL cert/key with strict permission.
 + < DEBUG > Start PostgreSQL server and sleep 5 seconds for initialization
pg_ctl: PID file "/var/db/postgres/data12/postmaster.pid" does not exist
Is server running?
 + < DEBUG > Setting password for PostgreSQL admin: (postgres).
ALTER ROLE
 + < DEBUG > Update pg_hba.conf to force local users to authenticate with md5.
 + < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.
 + < DEBUG > Generate /var/db/postgres/.pgpass.
 + < DEBUG > Generate sample SQL templates.
 + < DEBUG > Create roles (vmail, vmailadmin) and database: vmail.
CREATE ROLE
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
 + < DEBUG > Create tables in vmail database.
(( Hangs Here ))


# = = = = = = = = = =
# ls -l /var/db/postgres/data12/postmaster.pid
-rw-------  1 postgres  postgres  89  9 Oct 15:54 /var/db/postgres/data12/postmaster.pid

# cat /var/db/postgres/data12/postmaster.pid
7323
/var/db/postgres/data12
1602219272
5432
/tmp
127.0.0.1
  5432001    458752
ready   


# = = = = = = = = = =
# cat ./runtime/install.status
...
export status_install_port_security_pyfail2ban='processing'
export status_install_port_security_pyfail2ban='DONE'  # 25 seconds, ~= 0 minute(s).
export status_install_port_sysutils_logwatch='processing'
export status_install_port_sysutils_logwatch='DONE'  # 3 seconds, ~= 0 minute(s).
export status_post_install_cleanup='DONE'
export status_generate_ssl_keys="DONE"
export status_add_user_vmail="DONE"
export status_add_user_mlmmj="DONE"
export status_add_user_iredadmin="DONE"
export status_add_user_iredapd="DONE"
export status_pgsql_initialize="DONE"
(( Hangs Here ))


# = = = = = = = = = =
# cat /var/log/messages
Oct  9 15:51:12 server pkg-static[78891]: py38-psycopg2-2.8.6 installed
Oct  9 15:51:57 server pkg-static[77117]: py38-sqlite3-3.8.6_7 installed
Oct  9 15:51:59 server pkg-static[23931]: py38-sqlalchemy10-1.0.14 installed
Oct  9 15:52:56 server pkg-static[63957]: py38-cython-0.29.15 installed
Oct  9 15:53:14 server pkg-static[4990]: py38-pycryptodome-3.9.8 installed
Oct  9 15:53:15 server pkg-static[57089]: py38-dnspython-1.16.0 installed
Oct  9 15:53:19 server pkg-static[35984]: py38-webpy-0.61 installed
Oct  9 15:53:24 server pkg-static[19996]: py38-simplejson-3.17.2 installed
Oct  9 15:53:47 server pkg-static[7589]: libinotify-20180201_2 installed
Oct  9 15:53:48 server pkg-static[71830]: py38-pyinotify-0.9.6 installed
Oct  9 15:53:49 server pkg-static[35786]: py38-fail2ban-0.11.1_1 installed
Oct  9 15:53:52 server pkg-static[67552]: logwatch-7.5.1 installed
Oct  9 15:55:37 server postgres[19844]: [6-1] 2020-10-09 15:55:37.460 AEDT [19844] FATAL:  canceling authentication due to timeout
(( Last message ))

# = = = = = = = = = =
# top
last pid: 53822;  load averages:  0.45,  0.47,  0.43                                                      up 0+08:08:55  19:58:10
48 processes:  1 running, 45 sleeping, 2 stopped
CPU:  0.0% user,  0.0% nice,  0.4% system,  0.0% interrupt, 99.6% idle
Mem: 17M Active, 972M Inact, 27M Laundry, 439M Wired, 132M Buf, 525M Free
Swap: 3072M Total, 3072M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
53822 root          1  20    0    13M  3828K RUN      0:00   0.03% top
27034 sysadmin      1  20    0    20M  6968K select   0:02   0.02% sshd
62262 ntpd          1  20    0    16M    16M select   0:02   0.00% ntpd
17008 root          1  20    0    11M  2648K select   0:00   0.00% syslogd
91763 sysadmin      1  20    0    20M  6972K select   1:25   0.00% sshd
75450 root          1  20    0    11M  2324K piperd   0:03   0.00% tee
 7323 postgres      1  20    0   172M    29M select   0:01   0.00% postgres
75263 root          1  52    0    15M  5908K wait     0:00   0.00% bash
 8665 postgres      1  20    0    30M    19M select   0:00   0.00% postgres
27997 root          1  20    0    13M  3848K pause    0:00   0.00% csh
 7726 postgres      1  20    0   172M    29M select   0:00   0.00% postgres
 8239 postgres      1  20    0   173M    30M select   0:00   0.00% postgres
 7747 postgres      1  20    0   172M    29M select   0:00   0.00% postgres


# = = = = = = = = = =
# ps aux
USER       PID  %CPU %MEM    VSZ   RSS TT  STAT STARTED      TIME COMMAND
. . .
postgres  7323   0.0  1.5 176356 30124  -  Ss   15:54     0:00.54 /usr/local/bin/postgres -D /var/db/postgres/data12
postgres  7457   0.0  1.5 176388 30408  -  Is   15:54     0:00.02 postgres: checkpointer    (postgres)
postgres  7726   0.0  1.5 176356 30132  -  Ss   15:54     0:00.14 postgres: background writer    (postgres)
postgres  7747   0.0  1.5 176356 30132  -  Ss   15:54     0:00.12 postgres: walwriter    (postgres)
postgres  8239   0.0  1.5 176868 30436  -  Ss   15:54     0:00.12 postgres: autovacuum launcher    (postgres)
postgres  8665   0.0  0.9  30780 19124  -  Ss   15:54     0:00.16 postgres: stats collector    (postgres)
postgres  9040   0.0  1.5 176756 30328  -  Is   15:54     0:00.02 postgres: logical replication launcher    (postgres)
root     17008   0.0  0.1  11400  2648  -  Ss   11:49     0:00.08 /usr/sbin/syslogd -ss
postgres 19743   0.0  1.5 177288 31264  -  Is   15:54     0:00.00 postgres: postgres template1 [local]  (postgres)
ntpd     62262   0.0  0.8  16600 16676  -  Ss   11:49     0:01.56 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var
root     71111   0.0  0.1  11400  2724  -  Is   11:49     0:00.10 /usr/sbin/cron -s
root     18710   0.0  0.2  12084  3384  0  T+   15:54     0:00.00 su - postgres -c psql -d template1 -f /var/db/postgres/data12/i
postgres 19077   0.0  0.4  17496  7504  0  T    15:54     0:00.00 psql -d template1 -f /var/db/postgres/data12/iredmail.sql
root     75263   0.0  0.3  15640  5908  0  I+   12:44     0:00.36 bash iRedMail.sh
root     23119   0.0  0.1  10780  2376  1  I+   12:45     0:00.01 tail -f install.log
root     23061   0.0  0.1  10780  2376  2  I+   12:45     0:00.00 tail -f install.status
root     54504   0.0  0.2  11900  3268  3  R+   19:58     0:00.00 ps aux


# = = = = = = = = = =
# pkg info | grep -E "(python|post)"
postfix-3.5.7,1                Secure alternative to widely-used Sendmail
postgresql12-client-12.4       PostgreSQL database (client)
postgresql12-contrib-12.4      The contrib utilities from the PostgreSQL distribution
postgresql12-server-12.4_1     PostgreSQL is the most advanced open-source database available anywhere
python38-3.8.6                 Interpreted object-oriented programming language


# = = = = = = = = = =
# uname -a
12.1-RELEASE-p10 FreeBSD 12.1-RELEASE-p10 GENERIC  amd64

# ulimit -a
cpu time               (seconds, -t)  unlimited
file size           (512-blocks, -f)  unlimited
data seg size           (kbytes, -d)  33554432
stack size              (kbytes, -s)  524288
core file size      (512-blocks, -c)  unlimited
max memory size         (kbytes, -m)  unlimited
locked memory           (kbytes, -l)  unlimited
max user processes              (-u)  6656
open files                      (-n)  57852
virtual mem size        (kbytes, -v)  unlimited
swap limit              (kbytes, -w)  unlimited
socket buffer size       (bytes, -b)  unlimited
pseudo-terminals                (-p)  unlimited
kqueues                         (-k)  unlimited
umtx shared locks               (-o)  unlimited

Stay safe. Cheers


# = = = = = = = = = = = =
Stop and restating the process gives the same result.

# kill 15
# bash iRedMail.sh
. . .
[ INFO ] Total time of ports compiling: 0 seconds, ~= 0 minute(s)
< SKIP > Function: post_install_cleanup.

********************************************************************
* Start iRedMail Configurations
********************************************************************
< SKIP > Function: generate_ssl_keys.
[ INFO ] Create required system accounts.
< SKIP > Function: add_user_vmail.
< SKIP > Function: add_user_mlmmj.
< SKIP > Function: add_user_iredadmin.
< SKIP > Function: add_user_iredapd.
[ INFO ] Configure PostgreSQL database server.
< SKIP > Function: pgsql_initialize.


# = = = = = = = = = = .runtime/install.log
[ INFO ] Total time of ports compiling: 0 seconds, ~= 0 minute(s)
< SKIP > Function: post_install_cleanup.
< SKIP > Function: generate_ssl_keys.
[ INFO ] Create required system accounts.
< SKIP > Function: add_user_vmail.
< SKIP > Function: add_user_mlmmj.
< SKIP > Function: add_user_iredadmin.
< SKIP > Function: add_user_iredapd.
[ INFO ] Configure PostgreSQL database server.
< SKIP > Function: pgsql_initialize.
 + < DEBUG > Generate sample SQL templates.
 + < DEBUG > Create roles (vmail, vmailadmin) and database: vmail.
psql:/var/db/postgres/data12/init_vmail_db.sql:2: ERROR:  role "vmail" already exists
psql:/var/db/postgres/data12/init_vmail_db.sql:5: ERROR:  role "vmailadmin" already exists
psql:/var/db/postgres/data12/init_vmail_db.sql:8: ERROR:  database "vmail" already exists
ALTER DATABASE
 + < DEBUG > Create tables in vmail database.


# = = = = = = = = = = ./runtime/install.status
Nothing new!


# = = = = = = = = = = /var/log/messages
Oct  9 20:51:25 server postgres[11878]: [6-1] 2020-10-09 20:51:25.088 AEDT [11878] ERROR:  role "vmail" already exists
Oct  9 20:51:25 server postgres[11878]: [6-2] 2020-10-09 20:51:25.088 AEDT [11878] STATEMENT:  CREATE USER vmail WITH ENCRYPTED PA
SSWORD '' NOSUPERUSER NOCREATEDB NOCREATEROLE;
Oct  9 20:51:25 server postgres[11878]: [7-1] 2020-10-09 20:51:25.090 AEDT [11878] ERROR:  role "vmailadmin" already exists
Oct  9 20:51:25 server postgres[11878]: [7-2] 2020-10-09 20:51:25.090 AEDT [11878] STATEMENT:  CREATE USER vmailadmin WITH ENCRYPT
ED PASSWORD '' NOSUPERUSER NOCREATEDB NOCREATEROLE;
Oct  9 20:51:25 server postgres[11878]: [8-1] 2020-10-09 20:51:25.092 AEDT [11878] ERROR:  database "vmail" already exists
Oct  9 20:51:25 server postgres[11878]: [8-2] 2020-10-09 20:51:25.092 AEDT [11878] STATEMENT:  CREATE DATABASE vmail WITH TEMPLATE
 template0 ENCODING 'UTF8';
Oct  9 20:52:25 server postgres[12845]: [6-1] 2020-10-09 20:52:25.151 AEDT [12845] FATAL:  canceling authentication due to timeout

3

Re: Install Hangs while creating database

Does it work if you give it (at least) 4GB  RAM?

4

Re: Install Hangs while creating database

ZhangHuangbin wrote:

Does it work if you give it (at least) 4GB  RAM?

I can try overnight using 2/4Gb.

Both test and production since `iRedMail` 1.0 installed and are running with 1.0Gb memory.

I do not use `netdata` and `SoGo`.

I test with `VMware` and run in the cloud. I have three personal and low traffic domains.

`Roundcube` runs all the time, but I use it occasionally only.

Thanks.

5

Re: Install Hangs while creating database

angeloklin wrote:
ZhangHuangbin wrote:

Does it work if you give it (at least) 4GB  RAM?

I can try overnight using 2/4Gb.

Both test and production since `iRedMail` 1.0 installed and are running with 1.0Gb memory.

I do not use `netdata` and `SoGo`.

I test with `VMware` and run in the cloud. I have three personal and low traffic domains.

`Roundcube` runs all the time, but I use it occasionally only.

Thanks.


I was already running the VM with 2Gb.
I increased to 4Gb and it hangs at a point a bit further.

# = = = = = = = = = =
# bash iRedMail.sh
...
********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Generate self-signed SSL cert (4096 bits, expire in 10 years).
[ INFO ] Generate Diffie Hellman Group with openssl, please wait.
[ INFO ] Create required system accounts.
[ INFO ] Configure PostgreSQL database server.
[ INFO ] Setup daily cron job to backup PostgreSQL databases with /var/vmail/backup/backup_pgsql.sh
[ INFO ] Configure Postfix (MTA).
[ INFO ] Configure Dovecot (POP3/IMAP/Managesieve/LMTP/LDA).
[ INFO ] Configure Nginx web server.
[ INFO ] Configure PHP.
[ INFO ] Configure mlmmj (mailing list manager).
[ INFO ] Configure ClamAV (anti-virus toolkit).
[ INFO ] Configure Amavisd-new (interface between MTA and content checkers).
[ INFO ] Configure SpamAssassin (content-based spam filter).
[ INFO ] Configure iRedAPD (postfix policy daemon).
tr: Illegal byte sequence               <<<< This shows up a few times !!
[ INFO ] Configure iRedAdmin (official web-based admin panel).
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.log
...
INSERT 0 1
INSERT 0 1
INSERT 0 1
 + < DEBUG > Generate modular syslog and log rotate config files for iRedAPD.
[ INFO ] Configure iRedAdmin (official web-based admin panel).
 + < DEBUG > Extracting: iRedAdmin-beta.tar.bz2 -> /usr/local/www
 + < DEBUG > Set correct permission for iRedAdmin: /usr/local/www/iRedAdmin-beta.
 + < DEBUG > Import iRedAdmin database template.
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.status
...
export status_generate_ssl_keys="DONE"
export status_add_user_vmail="DONE"
export status_add_user_mlmmj="DONE"
export status_add_user_iredadmin="DONE"
export status_add_user_iredapd="DONE"
export status_pgsql_initialize="DONE"
export status_pgsql_import_vmail_users="DONE"
export status_pgsql_cron_backup="DONE"
export status_pgsql_setup="DONE"
export status_postfix_config_basic="DONE"
export status_postfix_config_vhost="DONE"
export status_postfix_config_postscreen="DONE"
export status_postfix_setup="DONE"
export status_dovecot_config="DONE"
export status_dovecot_log="DONE"
export status_dovecot_initialize_db_for_ldap="DONE"
export status_dovecot_setup="DONE"
export status_nginx_config="DONE"
export status_web_server_extra="DONE"
export status_php_config="DONE"
export status_web_server_config="DONE"
export status_mlmmj_config="DONE"
export status_mlmmjadmin_config="DONE"
export status_clamav_config="DONE"
export status_amavisd_initialize_db="DONE"
export status_amavisd_config="DONE"
export status_sa_config="DONE"
export status_iredapd_install="DONE"
export status_iredapd_initialize_db="DONE"
export status_iredapd_cron_setup="DONE"
export status_iredapd_config="DONE"
export status_iredapd_syslog_setup="DONE"
export status_iredapd_setup="DONE"
export status_iredadmin_install="DONE"
export status_iredadmin_web_config="DONE"
(( Hangs Here ))


# = = = = = = = = = =
# cat /var/log/messages
Oct 10 02:18:34 server pkg-static[88229]: py38-pyinotify-0.9.6 installed
Oct 10 02:18:35 server pkg-static[41497]: py38-fail2ban-0.11.1_1 installed
Oct 10 02:18:38 server pkg-static[852]: logwatch-7.5.1 installed
Oct 10 02:19:50 server postgres[45163]: [6-1] 2020-10-10 02:19:50.675 AEDT [45163] FATAL:  password authentication failed for user "iredadmin"
Oct 10 02:19:50 server postgres[45163]: [6-2] 2020-10-10 02:19:50.675 AEDT [45163] DETAIL:  User "iredadmin" has no password assigned.
Oct 10 02:19:50 server postgres[45163]: [6-3]     Connection matched pg_hba.conf line 99: "local all     all                 md5"
Oct 10 03:01:00 server postgres[65131]: [6-1] 2020-10-10 03:01:00.576 AEDT [65131] ERROR:  relation "log" does not exist at character 13
Oct 10 03:01:00 server postgres[65131]: [6-2] 2020-10-10 03:01:00.576 AEDT [65131] STATEMENT:  INSERT INTO log (event, loglevel, msg, admin, ip, timestamp) VALUES ('backup', 'info', 'Database: vmail, size: 8.0K (original: 48K)', 'cron_backup_sql', '127.0.0.1', NOW());
Oct 10 03:01:00 server postgres[67316]: [6-1] 2020-10-10 03:01:00.600 AEDT [67316] FATAL:  database "roundcubemail" does not exist
Oct 10 03:01:00 server postgres[87173]: [6-1] 2020-10-10 03:01:00.899 AEDT [87173] ERROR:  relation "log" does not exist at character 13
Oct 10 03:01:00 server postgres[87173]: [6-2] 2020-10-10 03:01:00.899 AEDT [87173] STATEMENT:  INSERT INTO log (event, loglevel, msg, admin, ip, timestamp) VALUES ('backup', 'info', 'Database: amavisd, size: 4.0K (original: 20K)', 'cron_backup_sql', '127.0.0.1', NOW());
Oct 10 03:01:01 server postgres[92980]: [6-1] 2020-10-10 03:01:01.057 AEDT [92980] ERROR:  relation "log" does not exist at character 13
Oct 10 03:01:01 server postgres[92980]: [6-2] 2020-10-10 03:01:01.057 AEDT [92980] STATEMENT:  INSERT INTO log (event, loglevel, msg, admin, ip, timestamp) VALUES ('backup', 'info', 'Database: iredadmin, size: 4.0K (original: 4.0K)', 'cron_backup_sql', '127.0.0.1', NOW());
Oct 10 03:01:01 server postgres[93467]: [6-1] 2020-10-10 03:01:01.071 AEDT [93467] FATAL:  database "sogo" does not exist
Oct 10 03:01:01 server postgres[1470]: [6-1] 2020-10-10 03:01:01.296 AEDT [1470] ERROR:  relation "log" does not exist at character 13
Oct 10 03:01:01 server postgres[1470]: [6-2] 2020-10-10 03:01:01.296 AEDT [1470] STATEMENT:  INSERT INTO log (event, loglevel, msg, admin, ip, timestamp) VALUES ('backup', 'info', 'Database: iredapd, size: 4.0K (original: 28K)', 'cron_backup_sql', '127.0.0.1', NOW());
Oct 10 03:01:01 server postgres[2326]: [6-1] 2020-10-10 03:01:01.308 AEDT [2326] FATAL:  database "sa_bayes" does not exist
Oct 10 03:50:57 server postfix/postqueue[63575]: fatal: Cannot flush mail queue - mail system is down
Oct 10 03:50:57 server postfix/postqueue[63082]: fatal: Cannot flush mail queue - mail system is down


# = = = = = = = = = =
# cat /var/log/maillog
Oct 10 00:00:00 server newsyslog[37520]: logfile turned over
Oct 10 03:00:10 server postfix/postdrop[22723]: warning: unable to look up public/pickup: No such file or directory
Oct 10 03:01:00 server postfix/postqueue[72526]: warning: Mail system is down -- accessing queue directly
Oct 10 03:01:00 server postfix/postqueue[74603]: warning: Mail system is down -- accessing queue directly
Oct 10 03:01:01 server postfix/postdrop[65750]: warning: unable to look up public/pickup: No such file or directory
Oct 10 03:50:57 server postfix/postdrop[50278]: warning: unable to look up public/pickup: No such file or directory
Oct 10 03:50:57 server postfix/postqueue[63575]: warning: unable to look up public/qmgr: No such file or directory
Oct 10 03:50:57 server postfix/postqueue[63575]: fatal: Cannot flush mail queue - mail system is down
Oct 10 03:50:57 server postfix/postqueue[63082]: warning: unable to look up public/qmgr: No such file or directory
Oct 10 03:50:57 server postfix/postqueue[63082]: fatal: Cannot flush mail queue - mail system is down
Oct 10 03:51:03 server postfix/postdrop[71984]: warning: unable to look up public/pickup: No such file or directory
Oct 10 03:51:03 server postfix/postdrop[72606]: warning: unable to look up public/pickup: No such file or directory
Oct 10 04:15:36 server postfix/postdrop[65688]: warning: unable to look up public/pickup: No such file or directory
Oct 10 04:15:36 server postfix/postdrop[66459]: warning: unable to look up public/pickup: No such file or directory

This looks suspicious. I naver had this problem before.
I do not think it was the problem, but I run from a reversed snapshot on VMWare.
I will try once again from scratch and see how it goes.

Stay safe.

6

Re: Install Hangs while creating database

I have no idea at all. sad
Which ssh terminal application did you use? Are you running Windows OS?

7

Re: Install Hangs while creating database

Another run, reinstalling FreeBSD.

This also hangs, but not at the same location. It is a moving target.
I used Commit 13d45c5 (Switch perl to 5.32 on FreeBSD). I saw some further changes, will try those later.

# = = = = = = = = = =
# bash iRedMail.sh
...
Installing logwatch-7.5.1...
===>  Cleaning for logwatch-7.5.1
[ INFO ] Total time of ports compiling: 2 seconds, ~= 0 minute(s)

********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Generate self-signed SSL cert (4096 bits, expire in 10 years).
[ INFO ] Generate Diffie Hellman Group with openssl, please wait.
[ INFO ] Create required system accounts.
[ INFO ] Configure PostgreSQL database server.
[ INFO ] Setup daily cron job to backup PostgreSQL databases with /var/vmail/backup/backup_pgsql.sh
[ INFO ] Configure Postfix (MTA).
[ INFO ] Configure Dovecot (POP3/IMAP/Managesieve/LMTP/LDA).
[ INFO ] Configure Nginx web server.
[ INFO ] Configure PHP.
[ INFO ] Configure mlmmj (mailing list manager).
[ INFO ] Configure ClamAV (anti-virus toolkit).
[ INFO ] Configure Amavisd-new (interface between MTA and content checkers).
[ INFO ] Configure SpamAssassin (content-based spam filter).
[ INFO ] Configure iRedAPD (postfix policy daemon).
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.log
...
CREATE TABLE
INSERT 0 1
INSERT 0 1
UPDATE 1
ALTER DATABASE
[ INFO ] Configure SpamAssassin (content-based spam filter).
 + < DEBUG > Copy sample SpamAssassin config file: /root/iRedMail-1.3.1/samples/spamassassin/local.cf -> /usr/local/etc/mail/spamassassin/local.cf.
 + < DEBUG > Enable crontabs for SpamAssassin update.
 + < DEBUG > Compile SpamAssassin ruleset into native code.
config: registryboundaries: no tlds defined, need to run sa-update
Oct 10 17:40:19.635 [67576] info: generic: base extraction starting. this can take a while...
cd /
rm -rf /tmp/.spamassassin67576QBOpJKtmp
[ INFO ] Configure iRedAPD (postfix policy daemon).
 + < DEBUG > Extracting: iRedAPD-4.4.tar.gz -> /opt
 + < DEBUG > Configure iRedAPD.
iredapd_enable:  -> YES
 + < DEBUG > Make iredapd starting after system startup.
 + < DEBUG > Import iRedAPD database template.
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
(( Hangs Here ))


# = = = = = = = = = =
# cat ./runtime/install.status
...
export status_post_install_cleanup='DONE'
export status_generate_ssl_keys="DONE"
export status_add_user_vmail="DONE"
export status_add_user_mlmmj="DONE"
export status_add_user_iredadmin="DONE"
export status_add_user_iredapd="DONE"
export status_pgsql_initialize="DONE"
export status_pgsql_import_vmail_users="DONE"
export status_pgsql_cron_backup="DONE"
export status_pgsql_setup="DONE"
export status_postfix_config_basic="DONE"
export status_postfix_config_vhost="DONE"
export status_postfix_config_postscreen="DONE"
export status_postfix_setup="DONE"
export status_dovecot_config="DONE"
export status_dovecot_log="DONE"
export status_dovecot_initialize_db_for_ldap="DONE"
export status_dovecot_setup="DONE"
export status_nginx_config="DONE"
export status_web_server_extra="DONE"
export status_php_config="DONE"
export status_web_server_config="DONE"
export status_mlmmj_config="DONE"
export status_mlmmjadmin_config="DONE"
export status_clamav_config="DONE"
export status_amavisd_initialize_db="DONE"
export status_amavisd_config="DONE"
export status_sa_config="DONE"
export status_iredapd_install="DONE"
(( Hangs Here ))


# = = = = = = = = = =
# cat /var/log/messages
Oct 10 17:39:01 server pkg-static[64910]: py38-pyinotify-0.9.6 installed
Oct 10 17:39:01 server pkg-static[87097]: py38-fail2ban-0.11.1_1 installed
Oct 10 17:39:04 server pkg-static[68850]: logwatch-7.5.1 installed
Oct 10 17:40:19 server postgres[75132]: [6-1] 2020-10-10 17:40:19.892 AEDT [75132] FATAL:  password authentication failed for user "iredapd"
Oct 10 17:40:19 server postgres[75132]: [6-2] 2020-10-10 17:40:19.892 AEDT [75132] DETAIL:  User "iredapd" has no password assigned.
Oct 10 17:40:19 server postgres[75132]: [6-3]   Connection matched pg_hba.conf line 99: "local all     all                 md5"
(( Last message ))


# = = = = = = = = = =
# cat /var/log/maillog
Oct 10 12:35:25 server newsyslog[81481]: logfile first created
Oct 10 18:00:10 server postfix/postdrop[87185]: warning: unable to look up public/pickup: No such file or directory
(( Last message ))


# = = = = = = = = = =
# top
last pid: 36719;  load averages:  0.29,  0.35,  0.39     up 0+05:41:54  19:21:44
53 processes:  1 running, 50 sleeping, 2 stopped
CPU:  0.4% user,  0.0% nice,  0.8% system,  0.0% interrupt, 98.8% idle
Mem: 36M Active, 2032M Inact, 1644K Laundry, 797M Wired, 294M Buf, 1129M Free
Swap: 4096M Total, 4096M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
18929 postgres      1  20    0   172M    31M select   0:00   0.06% postgres
36524 root          1  20    0    13M  3816K RUN      0:00   0.04% top
19524 postgres      1  20    0    30M    21M select   0:00   0.04% postgres
23442 sysadmin      1  20    0    20M  8636K select   0:00   0.03% sshd
19420 postgres      1  20    0   173M    32M select   0:00   0.02% postgres
 7237 ntpd          1  20    0    16M    16M select   0:01   0.00% ntpd
33565 sysadmin      1  20    0    20M  8464K select   1:20   0.00% sshd
39404 root          1  52    0    15M  6612K wait     0:01   0.00% bash
35280 sysadmin      1  20    0    20M  8452K select   0:00   0.00% sshd
36623 sysadmin      1  20    0    20M  8452K select   0:00   0.00% sshd
19358 postgres      1  20    0   172M    31M select   0:00   0.00% postgres
23749 root          1  20    0    11M  2804K nanslp   0:00   0.00% cron
19398 postgres      1  20    0   172M    31M select   0:00   0.00% postgres
20564 root          1  20    0    11M  2656K select   0:00   0.00% syslogd
19198 postgres      1  20    0   172M    36M select   0:00   0.00% postgres


# = = = = = = = = = =
# ps aux
USER       PID  %CPU %MEM    VSZ   RSS TT  STAT STARTED      TIME COMMAND
. . .
root        11 100.0  0.0      0    16  -  RNL  13:39   161:31.07 [idle]
root         0   0.0  0.0      0   240  -  DLs  13:39     1:50.75 [kernel]
root         1   0.0  0.0   9960   656  -  ILs  13:39     0:00.01 /sbin/init --
root         2   0.0  0.0      0    16  -  DL   13:39     0:00.00 [crypto]
root         3   0.0  0.0      0    16  -  DL   13:39     0:00.00 [crypto returns 0]
root         4   0.0  0.0      0    32  -  DL   13:39     0:09.17 [cam]
root         5   0.0  0.0      0    16  -  DL   13:39     0:00.00 [mpt_recovery0]
root         6   0.0  0.0      0    16  -  DL   13:39     0:00.00 [sctp_iterator]
root         7   0.0  0.0      0    16  -  DL   13:39     0:03.29 [rand_harvestq]
root         8   0.0  0.0      0    16  -  DL   13:39     0:00.00 [soaiod1]
root         9   0.0  0.0      0    16  -  DL   13:39     0:00.00 [soaiod2]
root        10   0.0  0.0      0    16  -  DL   13:39     0:00.00 [audit]
root        12   0.0  0.0      0   720  -  WL   13:39     0:20.14 [intr]
root        13   0.0  0.0      0    48  -  DL   13:39     0:00.02 [geom]
root        14   0.0  0.0      0    16  -  DL   13:39     0:00.00 [sequencer 00]
root        15   0.0  0.0      0   160  -  DL   13:39     0:01.52 [usb]
root        16   0.0  0.0      0    16  -  DL   13:39     0:00.00 [soaiod3]
root        17   0.0  0.0      0    16  -  DL   13:39     0:00.00 [soaiod4]
root        18   0.0  0.0      0    48  -  DL   13:39     0:01.96 [pagedaemon]
root        19   0.0  0.0      0    16  -  DL   13:39     0:00.00 [vmdaemon]
root        20   0.0  0.0      0    64  -  DL   13:39     0:38.50 [bufdaemon]
root        21   0.0  0.0      0    16  -  DL   13:39     0:00.36 [vnlru]
root        22   0.0  0.0      0    16  -  DL   13:39     0:21.22 [syncer]
ntpd      7237   0.0  0.4  16600 16676  -  Ss   13:39     0:01.38 /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var
postgres 18929   0.0  0.8 176356 32168  -  Ss   17:39     0:00.39 /usr/local/bin/postgres -D /var/db/postgres/data12
postgres 19198   0.0  0.9 176492 37220  -  Is   17:39     0:00.06 postgres: checkpointer    (postgres)
postgres 19358   0.0  0.8 176356 32172  -  Ss   17:39     0:00.07 postgres: background writer    (postgres)
postgres 19398   0.0  0.8 176356 32172  -  Ss   17:39     0:00.06 postgres: walwriter    (postgres)
postgres 19420   0.0  0.8 176948 32580  -  Ss   17:39     0:00.14 postgres: autovacuum launcher    (postgres)
postgres 19524   0.0  0.5  30896 21268  -  Ss   17:39     0:00.22 postgres: stats collector    (postgres)
postgres 19681   0.0  0.8 176756 32428  -  Is   17:39     0:00.01 postgres: logical replication launcher    (postgres)
root     20564   0.0  0.1  11400  2656  -  Ss   13:39     0:00.06 /usr/sbin/syslogd -s
root     23749   0.0  0.1  11400  2804  -  Ss   13:39     0:00.07 /usr/sbin/cron -s
root     39404   0.0  0.2  15748  6612  0  I+   13:42     0:00.60 bash iRedMail.sh
root     74945   0.0  0.1  12084  3312  0  T+   17:40     0:00.00 su - postgres -c psql -U iredapd -d iredapd
postgres 75090   0.0  0.2  17420  8348  0  T    17:40     0:00.00 psql -U iredapd -d iredapd


# = = = = = = = = = =
# pkg info | grep -E "(python|post)"
postfix-3.5.7,1                Secure alternative to widely-used Sendmail
postgresql12-client-12.4       PostgreSQL database (client)
postgresql12-contrib-12.4      The contrib utilities from the PostgreSQL distribution
postgresql12-server-12.4_1     PostgreSQL is the most advanced open-source database available anywhere
python38-3.8.6                 Interpreted object-oriented programming language


# = = = = = = = = = =
# uname -a
FreeBSD server.katra.local 12.1-RELEASE-p10 FreeBSD 12.1-RELEASE-p10 GENERIC  amd64


# ulimit -a
cpu time               (seconds, -t)  unlimited
file size           (512-blocks, -f)  unlimited
data seg size           (kbytes, -d)  33554432
stack size              (kbytes, -s)  524288
core file size      (512-blocks, -c)  unlimited
max memory size         (kbytes, -m)  unlimited
locked memory           (kbytes, -l)  unlimited
max user processes              (-u)  8499
open files                      (-n)  116838
virtual mem size        (kbytes, -v)  unlimited
swap limit              (kbytes, -w)  unlimited
socket buffer size       (bytes, -b)  unlimited
pseudo-terminals                (-p)  unlimited
kqueues                         (-k)  unlimited
umtx shared locks               (-o)  unlimited

8

Re: Install Hangs while creating database

Quite weird.
Could you run the installer with "bash -xv iRedMail.sh" on a new testing server? It will print a lot more detailed message, i need that for troubleshooting.

9

Re: Install Hangs while creating database

ZhangHuangbin wrote:

I have no idea at all. sad
Which ssh terminal application did you use? Are you running Windows OS?

I use macOS and test iRedMail on VMware Fusion.
The default macOS ssh terminal.

I saw a new commit.
I will download and try again, without `tee` and will remove some hardening option of FreeBSD's install.

I cannot think of anything wrong either.

Thanks,

10

Re: Install Hangs while creating database

Hello,

Another run. Run with `bash -xv iRedMail.sh` and without `tee`.

Stops at the same point as the first time.

Outputs below.

# = = = = = = = = = =
# bash -xv iRedMail.sh
+ echo 'export status_add_user_iredapd="DONE"'
+ '[' X == XYES ']'
check_status_before_run backend_install
+ check_status_before_run backend_install
+ function_name=backend_install
+ function_status_name=status_backend_install
++ eval echo '$status_backend_install'
+++ echo
+ function_status_value=
+ '[' X == XDONE ']'
+ backend_install
+ '[' XPGSQL == XOPENLDAP -o XPGSQL == XMYSQL ']'
+ '[' XPGSQL == XPGSQL ']'
+ export SQL_SERVER_ADDRESS=127.0.0.1
+ SQL_SERVER_ADDRESS=127.0.0.1
+ export SQL_SERVER_PORT=5432
+ SQL_SERVER_PORT=5432
+ export SQL_ROOT_USER=postgres
+ SQL_ROOT_USER=postgres
+ export SQL_ROOT_PASSWD=pass
+ SQL_ROOT_PASSWD=pass
+ SQL_SERVER_ADDRESS_IS_IPV6=NO
+ echo 127.0.0.1
+ grep :
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' '!' -f /usr/local/etc/dovecot/dovecot.conf ']'
+ cp -rf /usr/local/etc/dovecot/example-config/dovecot.conf /usr/local/etc/dovecot/example-config/conf.d /usr/local/etc/dovecot/
+ rm -f /usr/local/etc/dovecot/conf.d/10-ssl.conf
++ generate_password_hash BCRYPT pass
++ _scheme=BCRYPT
++ _password=pass
++ '[' XBCRYPT == XBCRYPT ']'
++ _scheme=BLF-CRYPT
++ doveadm pw -s BLF-CRYPT -p pass
+ export 'DOMAIN_ADMIN_PASSWD_HASH={BLF-CRYPT}$2y$05$GMh5A8gfn10H1V66F2iES.g6Fw0y9apzBflR5/pdXy4ADDqj30pdG'
+ DOMAIN_ADMIN_PASSWD_HASH='{BLF-CRYPT}$2y$05$GMh5A8gfn10H1V66F2iES.g6Fw0y9apzBflR5/pdXy4ADDqj30pdG'
+ '[' XPGSQL == XOPENLDAP ']'
+ '[' XPGSQL == XMYSQL ']'
+ '[' XPGSQL == XPGSQL ']'
+ check_status_before_run pgsql_setup
+ function_name=pgsql_setup
+ function_status_name=status_pgsql_setup
++ eval echo '$status_pgsql_setup'
+++ echo
+ function_status_value=
+ '[' X == XDONE ']'
+ pgsql_setup
+ ECHO_INFO 'Configure PostgreSQL database server.'
+ '[' 'XConfigure PostgreSQL database server.' == X-n ']'
+ echo -e '[ INFO ] Configure PostgreSQL database server.'
[ INFO ] Configure PostgreSQL database server.
+ echo -e '[ INFO ] Configure PostgreSQL database server.'
+ check_status_before_run pgsql_initialize
+ function_name=pgsql_initialize
+ function_status_name=status_pgsql_initialize
++ eval echo '$status_pgsql_initialize'
+++ echo
+ function_status_value=
+ '[' X == XDONE ']'
+ pgsql_initialize
+ ECHO_DEBUG 'Initialize PostgreSQL databases.'
+ echo -e ' + < DEBUG > Initialize PostgreSQL databases.'
+ '[' XFREEBSD == XRHEL ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ service_control enable postgresql_enable YES
+ action=enable
+ shift 1
+ service=postgresql_enable
+ services='postgresql_enable YES'
+ '[' XFREEBSD == XLINUX ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' Xenable == Xenable ']'
+ '[' X2 == X2 ']'
+ /usr/sbin/sysrc -f /etc/rc.conf.local postgresql_enable=YES
+ /usr/local/etc/rc.d/postgresql initdb
+ backup_file /var/db/postgres/data12/pg_hba.conf /var/db/postgres/data12/postgresql.conf
+ '[' X2 '!=' X0 ']'
+ for f in $@
+ '[' -f /var/db/postgres/data12/pg_hba.conf ']'
+ '[' XNO == XYES ']'
+ cp -f /var/db/postgres/data12/pg_hba.conf /var/db/postgres/data12/pg_hba.conf.2020.10.10.20.33.27
+ for f in $@
+ '[' -f /var/db/postgres/data12/postgresql.conf ']'
+ '[' XNO == XYES ']'
+ cp -f /var/db/postgres/data12/postgresql.conf /var/db/postgres/data12/postgresql.conf.2020.10.10.20.33.27
+ '[' -f /var/db/postgres/data12/postgresql.conf ']'
+ ECHO_DEBUG 'Make sure PostgreSQL binds to local address: 127.0.0.1.'
+ echo -e ' + < DEBUG > Make sure PostgreSQL binds to local address: 127.0.0.1.'
+ perl -pi -e 's#.*(listen_addresses.=.)(.).*#${1}${2}$ENV{LOCAL_ADDRESS}${2}#' /var/db/postgres/data12/postgresql.conf
+ ECHO_DEBUG 'Set client_min_messages to ERROR.'
+ echo -e ' + < DEBUG > Set client_min_messages to ERROR.'
+ perl -pi -e 's#.*(client_min_messages =).*#${1} error#' /var/db/postgres/data12/postgresql.conf
+ '[' XFREEBSD == XFREEBSD ']'
+ perl -pi -e 's/^#(ssl.=.)off(.*)/${1}on${2}/' /var/db/postgres/data12/postgresql.conf
+ ECHO_DEBUG 'Copy iRedMail SSL cert/key with strict permission.'
+ echo -e ' + < DEBUG > Copy iRedMail SSL cert/key with strict permission.'
+ backup_file /var/db/postgres/data12/server.crt /var/db/postgres/data12/server.key
+ '[' X2 '!=' X0 ']'
+ for f in $@
+ '[' -f /var/db/postgres/data12/server.crt ']'
+ for f in $@
+ '[' -f /var/db/postgres/data12/server.key ']'
+ rm -f /var/db/postgres/data12/server.crt /var/db/postgres/data12/server.key
+ cp -f /etc/ssl/certs/iRedMail.crt /etc/ssl/certs/iRedMail_CA_PostgreSQL.pem
+ cp -f /etc/ssl/private/iRedMail.key /etc/ssl/private/iRedMail_PostgreSQL.key
+ chown postgres:postgres /etc/ssl/certs/iRedMail_CA_PostgreSQL.pem /etc/ssl/private/iRedMail_PostgreSQL.key
+ chmod 0600 /etc/ssl/certs/iRedMail_CA_PostgreSQL.pem /etc/ssl/private/iRedMail_PostgreSQL.key
+ ln -s /etc/ssl/certs/iRedMail_CA_PostgreSQL.pem /var/db/postgres/data12/server.crt
+ ln -s /etc/ssl/private/iRedMail_PostgreSQL.key /var/db/postgres/data12/server.key
+ ECHO_DEBUG 'Start PostgreSQL server and sleep 5 seconds for initialization'
+ echo -e ' + < DEBUG > Start PostgreSQL server and sleep 5 seconds for initialization'
+ service_control stop postgresql
+ sleep 5
+ service_control start postgresql
+ sleep 5
+ ECHO_DEBUG 'Setting password for PostgreSQL admin: (postgres).'
+ echo -e ' + < DEBUG > Setting password for PostgreSQL admin: (postgres).'
+ su - postgres -c 'psql -d template1'
+ ECHO_DEBUG 'Update pg_hba.conf to force local users to authenticate with md5.'
+ echo -e ' + < DEBUG > Update pg_hba.conf to force local users to authenticate with md5.'
+ perl -pi -e 's/^(local.*)/#${1}/g' /var/db/postgres/data12/pg_hba.conf
+ perl -pi -e 's/^(host.*)/#${1}/g' /var/db/postgres/data12/pg_hba.conf
+ '[' X12 == X8 ']'
+ echo 'local all     postgres   peer'
+ echo 'local all     all                 md5'
+ echo 'host  all     all     0.0.0.0/0   md5'
+ ECHO_DEBUG 'Restart PostgreSQL server and sleeping for 5 seconds.'
+ echo -e ' + < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.'
+ service_control stop postgresql
+ sleep 5
+ service_control start postgresql
+ sleep 5
+ ECHO_DEBUG 'Generate /var/db/postgres/.pgpass.'
+ echo -e ' + < DEBUG > Generate /var/db/postgres/.pgpass.'
+ cat
+ chown postgres:postgres /var/db/postgres/.pgpass
+ chmod 0600 /var/db/postgres/.pgpass
+ cat
+ echo 'export status_pgsql_initialize="DONE"'
+ check_status_before_run pgsql_import_vmail_users
+ function_name=pgsql_import_vmail_users
+ function_status_name=status_pgsql_import_vmail_users
++ eval echo '$status_pgsql_import_vmail_users'
+++ echo
+ function_status_value=
+ '[' X == XDONE ']'
+ pgsql_import_vmail_users
+ ECHO_DEBUG 'Generate sample SQL templates.'
+ echo -e ' + < DEBUG > Generate sample SQL templates.'
+ cp -f /root/iRedMail-1.3.1/samples/postgresql/sql/init_vmail_db.sql /var/db/postgres/data12/
+ cp -f /root/iRedMail-1.3.1/samples/iredmail/iredmail.pgsql /var/db/postgres/data12/iredmail.sql
+ cp -f /root/iRedMail-1.3.1/samples/postgresql/sql/add_first_domain_and_user.sql /var/db/postgres/data12/
+ cp -f /root/iRedMail-1.3.1/samples/postgresql/sql/grant_permissions.sql /var/db/postgres/data12/
+ perl -pi -e 's#PH_VMAIL_DB_NAME#$ENV{VMAIL_DB_NAME}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_VMAIL_DB_BIND_USER#$ENV{VMAIL_DB_BIND_USER}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_VMAIL_DB_BIND_PASSWD#$ENV{VMAIL_DB_BIND_PASSWD}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_VMAIL_DB_ADMIN_USER#$ENV{VMAIL_DB_ADMIN_USER}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_VMAIL_DB_ADMIN_PASSWD#$ENV{VMAIL_DB_ADMIN_PASSWD}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_DOMAIN_ADMIN_EMAIL#$ENV{DOMAIN_ADMIN_EMAIL}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_FIRST_DOMAIN#$ENV{FIRST_DOMAIN}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_TRANSPORT#$ENV{TRANSPORT}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_DOMAIN_ADMIN_PASSWD_HASH#$ENV{DOMAIN_ADMIN_PASSWD_HASH}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_DOMAIN_ADMIN_MAILDIR_HASH_PART#$ENV{DOMAIN_ADMIN_MAILDIR_HASH_PART}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#PH_DOMAIN_ADMIN_NAME#$ENV{DOMAIN_ADMIN_NAME}#g' /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ '[' X12 == X8 ']'
+ perl -pi -e 's#^-- \\c#\\c#g' /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#(.*storagebasedirectory.*DEFAULT..)(.*)#${1}$ENV{STORAGE_BASE_DIR}${2}#' /var/db/postgres/data12/iredmail.sql
+ perl -pi -e 's#(.*storagenode.*DEFAULT..)(.*)#${1}$ENV{STORAGE_NODE}${2}#' /var/db/postgres/data12/iredmail.sql
+ chmod 0755 /var/db/postgres/data12/add_first_domain_and_user.sql /var/db/postgres/data12/grant_permissions.sql /var/db/postgres/data12/init_vmail_db.sql /var/db/postgres/data12/iredmail.sql
+ ECHO_DEBUG 'Create roles (vmail, vmailadmin) and database: vmail.'
+ echo -e ' + < DEBUG > Create roles (vmail, vmailadmin) and database: vmail.'
+ su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/init_vmail_db.sql'
+ ECHO_DEBUG 'Create tables in vmail database.'
+ echo -e ' + < DEBUG > Create tables in vmail database.'
+ su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'
(( Hangs Here ))

# = = = = = = = = = =
# ./runtime/install.log
creating directory /var/db/postgres/data12 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Australia/Victoria
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
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:

    /usr/local/bin/pg_ctl -D /var/db/postgres/data12 -l logfile start

 + < DEBUG > Make sure PostgreSQL binds to local address: 127.0.0.1.
 + < DEBUG > Set client_min_messages to ERROR.
 + < DEBUG > Copy iRedMail SSL cert/key with strict permission.
 + < DEBUG > Start PostgreSQL server and sleep 5 seconds for initialization
+ action=stop
+ shift 1
+ service=postgresql
+ services=postgresql
+ '[' XFREEBSD == XLINUX ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' Xstop == Xenable ']'
+ '[' Xstop == Xdisable ']'
+ /usr/local/etc/rc.d/postgresql stop
pg_ctl: PID file "/var/db/postgres/data12/postmaster.pid" does not exist
Is server running?
+ action=start
+ shift 1
+ service=postgresql
+ services=postgresql
+ '[' XFREEBSD == XLINUX ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' Xstart == Xenable ']'
+ '[' Xstart == Xdisable ']'
+ /usr/local/etc/rc.d/postgresql start
 + < DEBUG > Setting password for PostgreSQL admin: (postgres).
ALTER ROLE
 + < DEBUG > Update pg_hba.conf to force local users to authenticate with md5.
 + < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.
+ action=stop
+ shift 1
+ service=postgresql
+ services=postgresql
+ '[' XFREEBSD == XLINUX ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' Xstop == Xenable ']'
+ '[' Xstop == Xdisable ']'
+ /usr/local/etc/rc.d/postgresql stop
+ action=start
+ shift 1
+ service=postgresql
+ services=postgresql
+ '[' XFREEBSD == XLINUX ']'
+ '[' XFREEBSD == XFREEBSD ']'
+ '[' Xstart == Xenable ']'
+ '[' Xstart == Xdisable ']'
+ /usr/local/etc/rc.d/postgresql start
 + < DEBUG > Generate /var/db/postgres/.pgpass.
 + < DEBUG > Generate sample SQL templates.
 + < DEBUG > Create roles (vmail, vmailadmin) and database: vmail.
CREATE ROLE
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
 + < DEBUG > Create tables in vmail database.
(( Hangs Here ))

# = = = = = = = = = =
# ./runtime/install.status
export status_install_port_www_webpy='processing'
export status_install_port_www_webpy='DONE'  # 3 seconds, ~= 0 minute(s).
export status_install_port_devel_pysimplejson='processing'
export status_install_port_devel_pysimplejson='DONE'  # 5 seconds, ~= 0 minute(s).
export status_install_port_security_pyfail2ban='processing'
export status_install_port_security_pyfail2ban='DONE'  # 26 seconds, ~= 0 minute(s).
export status_install_port_sysutils_logwatch='processing'
export status_install_port_sysutils_logwatch='DONE'  # 2 seconds, ~= 0 minute(s).
export status_post_install_cleanup='DONE'
export status_generate_ssl_keys="DONE"
export status_add_user_vmail="DONE"
export status_add_user_mlmmj="DONE"
export status_add_user_iredadmin="DONE"
export status_add_user_iredapd="DONE"
export status_pgsql_initialize="DONE"
(( Hangs Here ))

# = = = = = = = = = =
# /var/log/messages
Oct 11 00:10:19 server pkg-static[20874]: roundcube-php74-1.4.9,1 installed
Oct 11 00:10:44 server pkg-static[25634]: py38-psycopg2-2.8.6 installed
Oct 11 00:11:30 server pkg-static[27311]: py38-sqlite3-3.8.6_7 installed
Oct 11 00:11:32 server pkg-static[27438]: py38-sqlalchemy10-1.0.14 installed
Oct 11 00:12:31 server pkg-static[29214]: py38-cython-0.29.15 installed
Oct 11 00:12:49 server pkg-static[29878]: py38-pycryptodome-3.9.8 installed
Oct 11 00:12:50 server pkg-static[30019]: py38-dnspython-1.16.0 installed
Oct 11 00:12:54 server pkg-static[31354]: py38-webpy-0.61 installed
Oct 11 00:12:59 server pkg-static[32450]: py38-simplejson-3.17.2 installed
Oct 11 00:13:22 server pkg-static[36994]: libinotify-20180201_2 installed
Oct 11 00:13:24 server pkg-static[37187]: py38-pyinotify-0.9.6 installed
Oct 11 00:13:25 server pkg-static[37351]: py38-fail2ban-0.11.1_1 installed
Oct 11 00:13:28 server pkg-static[38803]: logwatch-7.5.1 installed
Oct 11 00:15:24 server postgres[39236]: [6-1] 2020-10-11 00:15:24.733 AEDT [39236] FATAL:  canceling authentication due to timeout
(( Hangs Here ))

# = = = = = = = = = =
# top
last pid: 41181;  load averages:  0.60,  0.54,  0.46    up 0+13:51:22  10:19:57
53 processes:  1 running, 50 sleeping, 2 stopped
CPU: 18.7% user,  0.0% nice,  3.8% system,  0.1% interrupt, 77.4% idle
Mem: 10M Active, 2499M Inact, 1648K Laundry, 901M Wired, 395M Buf, 776M Free
Swap: 4096M Total, 4096M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  735 sysadmin      1  20    0    20M  8464K select   1:26   0.00% sshd
  643 ntpd          1  20    0    16M    16M select   0:03   0.00% ntpd
39197 postgres      1  20    0   172M    31M select   0:01   0.00% postgres
  812 root          1  52    0    15M  6468K wait     0:01   0.00% bash
39203 postgres      1  20    0    30M    21M select   0:00   0.00% postgres
39200 postgres      1  20    0   172M    31M select   0:00   0.00% postgres
39202 postgres      1  20    0   173M    32M select   0:00   0.00% postgres
39201 postgres      1  20    0   172M    31M select   0:00   0.00% postgres
  676 root          1  20    0    11M  2784K nanslp   0:00   0.00% cron
  471 root          1  20    0    11M  2656K select   0:00   0.00% syslogd
39199 postgres      1  20    0   172M    32M select   0:00   0.00% postgres
39204 postgres      1  20    0   173M    32M select   0:00   0.00% postgres

# = = = = = = = = = =
# ps aux
USER       PID  %CPU %MEM    VSZ   RSS TT  STAT STARTED      TIME COMMAND
root        11 100.0  0.0      0    16  -  RNL  20:28   644:26.80 [idle]
root         0   0.0  0.0      0   240  -  DLs  20:28     3:54.86 [kernel]
root         1   0.0  0.0   9960   656  -  ILs  20:28     0:00.01 /sbin/init --
root         2   0.0  0.0      0    16  -  DL   20:28     0:00.00 [crypto]
root         3   0.0  0.0      0    16  -  DL   20:28     0:00.00 [crypto returns 0]
root        18   0.0  0.0      0    48  -  DL   20:28     0:04.56 [pagedaemon]
root        19   0.0  0.0      0    16  -  DL   20:28     0:00.00 [vmdaemon]
root        20   0.0  0.0      0    64  -  DL   20:28     0:40.38 [bufdaemon]
root        21   0.0  0.0      0    16  -  DL   20:28     0:00.59 [vnlru]
root        22   0.0  0.0      0    16  -  DL   20:28     0:46.72 [syncer]
root       400   0.0  0.0  10456   960  -  Is   20:28     0:00.02 /sbin/devd
root       471   0.0  0.1  11400  2656  -  Is   20:28     0:00.12 /usr/sbin/syslogd -s
root       676   0.0  0.1  11400  2784  -  Is   20:28     0:00.19 /usr/sbin/cron -s
postgres 39197   0.0  0.8 176356 32168  -  Ss   00:14     0:00.70 /usr/local/bin/postgres -D /var/db/postgres/data12
postgres 39199   0.0  0.8 176388 32444  -  Is   00:14     0:00.03 postgres: checkpointer    (postgres)
postgres 39200   0.0  0.8 176356 32168  -  Ss   00:14     0:00.31 postgres: background writer    (postgres)
postgres 39201   0.0  0.8 176356 32168  -  Ss   00:14     0:00.28 postgres: walwriter    (postgres)
postgres 39202   0.0  0.8 176868 32472  -  Ss   00:14     0:00.30 postgres: autovacuum launcher    (postgres)
postgres 39203   0.0  0.5  30780 21168  -  Ss   00:14     0:00.43 postgres: stats collector    (postgres)
postgres 39204   0.0  0.8 176756 32364  -  Ss   00:14     0:00.03 postgres: logical replication launcher    (postgres)
postgres 39235   0.0  0.8 177288 33300  -  Is   00:14     0:00.00 postgres: postgres template1 [local]  (postgres)
root       812   0.0  0.2  15648  6468  0  I+   20:33     0:00.57 bash -xv iRedMail.sh
root     39233   0.0  0.1  12084  3312  0  T+   00:14     0:00.00 su - postgres -c psql -d template1 -f /var/db/postgres/data12/i
postgres 39234   0.0  0.2  17496  8360  0  T    00:14     0:00.00 psql -d template1 -f /var/db/postgres/data12/iredmail.sql

# = = = = = = = = = =
# postgres
postgres=# SELECT * FROM pg_stat_activity ORDER BY backend_start;
 datid |  datname  |  pid  | usesysid | usename  | application_name | client_addr | client_hostname | client_port |         backend_start         |          xact_start           |          query_start          |         state_change          | wait_event_type |     wait_event      | state  | backend_xid | backend_xmin |                         query                          |         backend_type         
-------+-----------+-------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-----------------+---------------------+--------+-------------+--------------+--------------------------------------------------------+------------------------------
       |           | 39199 |          |          |                  |             |                 |             | 2020-10-11 00:14:19.403791+11 |                               |                               |                               | Activity        | CheckpointerMain    |        |             |              |                                                        | checkpointer
       |           | 39200 |          |          |                  |             |                 |             | 2020-10-11 00:14:19.403882+11 |                               |                               |                               | Activity        | BgWriterHibernate   |        |             |              |                                                        | background writer
       |           | 39201 |          |          |                  |             |                 |             | 2020-10-11 00:14:19.40397+11  |                               |                               |                               | Activity        | WalWriterMain       |        |             |              |                                                        | walwriter
       |           | 39202 |          |          |                  |             |                 |             | 2020-10-11 00:14:19.404058+11 |                               |                               |                               | Activity        | AutoVacuumMain      |        |             |              |                                                        | autovacuum launcher
       |           | 39204 |       10 | postgres |                  |             |                 |             | 2020-10-11 00:14:19.404295+11 |                               |                               |                               | Activity        | LogicalLauncherMain |        |             |              |                                                        | logical replication launcher
     1 | template1 | 39235 |       10 | postgres | psql             |             |                 |          -1 | 2020-10-11 00:14:24.715003+11 |                               |                               | 2020-10-11 00:14:24.716797+11 | Client          | ClientRead          | idle   |             |              |                                                        | client backend
 13810 | postgres  | 41234 |       10 | postgres | psql             |             |                 |          -1 | 2020-10-11 10:35:03.200239+11 | 2020-10-11 10:37:25.306975+11 | 2020-10-11 10:37:25.306975+11 | 2020-10-11 10:37:25.306977+11 |                 |                     | active |             |          491 | SELECT * FROM pg_stat_activity ORDER BY backend_start; | client backend
(7 rows)


postgres=# select state, wait_event, wait_event_type, count(*) from pg_stat_activity group by 1,2,3 order by wait_event;
 state  |     wait_event      | wait_event_type | count 
--------+---------------------+-----------------+-------
        | AutoVacuumMain      | Activity        |     1
        | BgWriterMain        | Activity        |     1
        | CheckpointerMain    | Activity        |     1
 idle   | ClientRead          | Client          |     1
        | LogicalLauncherMain | Activity        |     1
        | WalWriterMain       | Activity        |     1
 active |                     |                 |     1
(7 rows)

11

Re: Install Hangs while creating database

angeloklin wrote:

Oct 11 00:15:24 server postgres[39236]: [6-1] 2020-10-11 00:15:24.733 AEDT [39236] FATAL:  canceling authentication due to timeout

Seems this is the root cause.

While hanging, do you see command "su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'" in command output "ps aux"?
What's the output if you run it as system root user?

su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'

12

Re: Install Hangs while creating database

- This is the same point where it hang the first time.
- The output of `ps aux` is in (all) the report(s). The last one has processes 39233 and 39234.
- Running as `root` gives the results below. The acount `vmailadmin` looks to have an empty password at this stage. I do not know if at this stage it is empty by design to allow initialisation and will be changed later, OR there was a faillure to set/replace the password.
- It does not work using either an empty password or the test password (pass).

$ su - root
Password:
root@server:~ # ps aux | grep post
postgres 684  0.0  0.5 176356 22720  -  Is   14:57   0:00.21 /usr/local/bin/postgres -D /var/db/postgres/data12
postgres 686  0.0  0.5 176356 22784  -  Is   14:57   0:00.00 postgres: checkpointer    (postgres)
postgres 687  0.0  0.5 176356 22772  -  Ss   14:57   0:00.03 postgres: background writer    (postgres)
postgres 688  0.0  0.5 176356 22772  -  Ss   14:57   0:00.01 postgres: walwriter    (postgres)
postgres 689  0.0  0.6 176868 23464  -  Is   14:57   0:00.01 postgres: autovacuum launcher    (postgres)
postgres 690  0.0  0.3  30800 11732  -  Is   14:57   0:00.01 postgres: stats collector    (postgres)
postgres 691  0.0  0.6 176756 23356  -  Ss   14:57   0:00.01 postgres: logical replication launcher    (postgres)
root     824  0.0  0.1  11532  2876  1  S+   15:00   0:00.00 grep post

root@server:~ # su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'
Password for user vmailadmin: 
psql:/var/db/postgres/data12/iredmail.sql:20: error: \connect: FATAL:  password authentication failed for user "vmailadmin"


# = = = = = = = = = =
# /var/log/messages
Oct 11 15:00:53 server postgres[830]: [6-1] 2020-10-11 15:00:53.325 AEDT [830] FATAL:  password authentication failed for user "vmailadmin"
Oct 11 15:00:53 server postgres[830]: [6-2] 2020-10-11 15:00:53.325 AEDT [830] DETAIL:  User "vmailadmin" has no password assigned.
Oct 11 15:00:53 server postgres[830]: [6-3]   Connection matched pg_hba.conf line 99: "local all     all                 md5"
Oct 11 15:00:53 server postgres[831]: [6-1] 2020-10-11 15:00:53.336 AEDT [831] FATAL:  password authentication failed for user "vmailadmin"
Oct 11 15:00:53 server postgres[831]: [6-2] 2020-10-11 15:00:53.336 AEDT [831] DETAIL:  User "vmailadmin" has no password assigned.
Oct 11 15:00:53 server postgres[831]: [6-3]   Connection matched pg_hba.conf line 99: "local all     all                 md5"


# = = = = = = = = = =
root@server:~ # ls -l /var/db/postgres/data12/init_vmail_db.sql 
-rwxr-xr-x  1 root  postgres  413 11 Oct 00:14 /var/db/postgres/data12/init_vmail_db.sql


# = = = = = = = = = =
root@server:~ # cat /var/db/postgres/data12/init_vmail_db.sql
-- Crete role: vmail, read-only.
CREATE USER vmail WITH ENCRYPTED PASSWORD '' NOSUPERUSER NOCREATEDB NOCREATEROLE;

-- Create role: vmailadmin, read + write.
CREATE USER vmailadmin WITH ENCRYPTED PASSWORD '' NOSUPERUSER NOCREATEDB NOCREATEROLE;

-- Create database to store mail accounts
CREATE DATABASE vmail WITH TEMPLATE template0 ENCODING 'UTF8';

-- Grant privilege
ALTER DATABASE vmail OWNER TO vmailadmin;

13

Re: Install Hangs while creating database

angeloklin wrote:

root@server:~ # su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'
Password for user vmailadmin:

Do you have file /var/db/postgres/.pgpass? Does this file contains credential of pgsql user "vmailadmin" (and few others)?

Should be fixed by setting global variable PGPASSFILE in latest commit:
https://github.com/iredmail/iRedMail/commits/master

Interesting thing is i didn't have this issue while testing locally. sad

14

Re: Install Hangs while creating database

ZhangHuangbin wrote:
angeloklin wrote:

root@server:~ # su - postgres -c 'psql -d template1 -f /var/db/postgres/data12/iredmail.sql'
Password for user vmailadmin:

Do you have file /var/db/postgres/.pgpass? Does this file contains credential of pgsql user "vmailadmin" (and few others)?

Should be fixed by setting global variable PGPASSFILE in latest commit:
https://github.com/iredmail/iRedMail/commits/master

Interesting thing is i didn't have this issue while testing locally. sad

Thanks for looking into that.
The password file exists but most passwods are empty.

root@server:~ # cd /var/db/postgres/
root@server:/var/db/postgres # ls -lA
total 12
-rw-------   1 postgres  postgres   149 11 Oct 00:14 .pgpass
-rw-------   1 postgres  postgres  1067 11 Oct 13:19 .psql_history
drwx------  19 postgres  postgres  1024 13 Oct 23:54 data12

root@server:/var/db/postgres # cat .pgpass 
*:*:*:postgres:pass
*:*:*:vmail:
*:*:*:vmailadmin:
*:*:*:iredapd:
*:*:*:iredadmin:
*:*:*:sogo:hSm
*:*:*:roundcube:rNf
*:*:*:amavisd:
*:*:*:fail2ban:

- I do not remember (I did not have) this issue in the past.
- I "think" I had the problem when testing 1.3[.1], but as it was not ready on FreeBSD, I did not bother. Without thinking too much I imagine that could be related to the adjustments of the new version.
- I will test the new commit maybe tomorrow or the day after.
- Please have a look on the `.pgpass` above, in case there are other ids that should be set at this point. Only `postgres`, `sogo` and `roundcube` have non-empty passwords.

Thanks.

15

Re: Install Hangs while creating database

angeloklin wrote:

The password file exists but most passwods are empty.

This is not right.

Do you have passwords for them in file "iRedMail-1.3.1/config" (replace the 1.3.1 by real version number)? e.g.

export VMAIL_DB_BIND_PASSWD='030b94feae9eab379a0a3c2cecd9775b'
export VMAIL_DB_ADMIN_PASSWD='DG6dIpNWYsDMmAsin0gobRooaULgDIoD'
export AMAVISD_DB_PASSWD='afe6c9fa4ed9bdee02531c9cb902675e'
export IREDADMIN_DB_PASSWD='4a3880dddcf0cb11ebcde6779b5d1937'
export RCM_DB_PASSWD='84290fa650dbdb4206b5cd7792ca7a05'
export SOGO_DB_PASSWD='2b78229e1091bc094e1c0b11b94b6ac7'
export SOGO_SIEVE_MASTER_PASSWD='21f072b5dfa3ab3b3e93724df2afa85f'
export IREDAPD_DB_PASSWD='df60069e03f0c060f32e5d43563c960f'
export NETDATA_DB_PASSWD='df60069e03f0c060f32e5d43563c960f'
export MLMMJADMIN_API_AUTH_TOKEN='83CoNPKloJoPJ3u6uESs9dqkuIIyTceB'
export FAIL2BAN_DB_PASSWD='gYQmiAkjlR1hu4eXwIgPkg2cpscUu0uZ'

16

Re: Install Hangs while creating database

ZhangHuangbin wrote:
angeloklin wrote:

The password file exists but most passwods are empty.

This is not right.

Do you have passwords for them in file "iRedMail-1.3.1/config" (replace the 1.3.1 by real version number)? e.g.

export VMAIL_DB_BIND_PASSWD='030b94feae9eab379a0a3c2cecd9775b'
export VMAIL_DB_ADMIN_PASSWD='DG6dIpNWYsDMmAsin0gobRooaULgDIoD'
export AMAVISD_DB_PASSWD='afe6c9fa4ed9bdee02531c9cb902675e'
export IREDADMIN_DB_PASSWD='4a3880dddcf0cb11ebcde6779b5d1937'
export RCM_DB_PASSWD='84290fa650dbdb4206b5cd7792ca7a05'
export SOGO_DB_PASSWD='2b78229e1091bc094e1c0b11b94b6ac7'
export SOGO_SIEVE_MASTER_PASSWD='21f072b5dfa3ab3b3e93724df2afa85f'
export IREDAPD_DB_PASSWD='df60069e03f0c060f32e5d43563c960f'
export NETDATA_DB_PASSWD='df60069e03f0c060f32e5d43563c960f'
export MLMMJADMIN_API_AUTH_TOKEN='83CoNPKloJoPJ3u6uESs9dqkuIIyTceB'
export FAIL2BAN_DB_PASSWD='gYQmiAkjlR1hu4eXwIgPkg2cpscUu0uZ'

Looks like the source of the problem might be somwhere else:

root@server:/var/db/postgres # cd ~/iRedMail-1.3.1
root@server:~/iRedMail-1.3.1 # ls -l 
-rwxr-xr-x   1 root  wheel  84276 10 Oct 01:40 ChangeLog
drwxr-xr-x   2 root  wheel    512 10 Oct 20:30 conf
-r--------   1 root  wheel    638 10 Oct 20:34 config
drwxr-xr-x   2 root  wheel    512 10 Oct 20:30 dialog
-rwxr-xr-x   1 root  wheel    307 10 Oct 01:40 Documentations
drwxr-xr-x   2 root  wheel   1024 10 Oct 20:30 functions
-rwxr-xr-x   1 root  wheel   5244 10 Oct 01:40 iRedMail.sh
-rw-r--r--   1 root  wheel   1252 11 Oct 00:14 iRedMail.tips
drwxr-xr-x   4 root  wheel    512 10 Oct 20:33 pkgs
-rwxr-xr-x   1 root  wheel   1291 10 Oct 01:40 README.md
drwxr-xr-x   2 root  wheel    512 10 Oct 20:34 runtime
drwxr-xr-x  24 root  wheel    512 10 Oct 20:30 samples
drwxr-xr-x   2 root  wheel   1024 10 Oct 20:30 tools
drwxr-xr-x   7 root  wheel    512 10 Oct 20:30 update
root@server:~/iRedMail-1.3.1 # cat config 

export STORAGE_BASE_DIR='/var/vmail'
export WEB_SERVER='NGINX'
export BACKEND_ORIG='PGSQL'
export BACKEND='PGSQL'
export VMAIL_DB_BIND_PASSWD=''
export VMAIL_DB_ADMIN_PASSWD=''
export MLMMJADMIN_API_AUTH_TOKEN=''
export NETDATA_DB_PASSWD=''
export PGSQL_ROOT_PASSWD='pass'
export FIRST_DOMAIN='katra.local'
export DOMAIN_ADMIN_PASSWD_PLAIN='pass'
export USE_IREDADMIN='YES'
export USE_ROUNDCUBE='YES'
export USE_FAIL2BAN='YES'
export AMAVISD_DB_PASSWD=''
export IREDADMIN_DB_PASSWD=''
export RCM_DB_PASSWD='rNf'
export SOGO_DB_PASSWD='hSm'
export SOGO_SIEVE_MASTER_PASSWD=''
export IREDAPD_DB_PASSWD=''
export FAIL2BAN_DB_PASSWD=''
#EOF

17

Re: Install Hangs while creating database

angeloklin wrote:

export VMAIL_DB_BIND_PASSWD=''
export VMAIL_DB_ADMIN_PASSWD=''
export MLMMJADMIN_API_AUTH_TOKEN=''
export NETDATA_DB_PASSWD=''
export PGSQL_ROOT_PASSWD='pass'
...
export AMAVISD_DB_PASSWD=''
export IREDADMIN_DB_PASSWD=''
export RCM_DB_PASSWD='rNf'
export SOGO_DB_PASSWD='hSm'
export SOGO_SIEVE_MASTER_PASSWD=''
export IREDAPD_DB_PASSWD=''
export FAIL2BAN_DB_PASSWD=''

No passwords generated?
Try this command used to generate random passwords on Linux and FreeBSD, anything returned on console?

eval </dev/urandom tr -dc A-Za-z0-9 | (head -c $1 &>/dev/null || head -c 32)

18 (edited by angeloklin 2020-10-15 20:45:41)

Re: Install Hangs while creating database

ZhangHuangbin wrote:
angeloklin wrote:

export VMAIL_DB_BIND_PASSWD=''
export VMAIL_DB_ADMIN_PASSWD=''
export MLMMJADMIN_API_AUTH_TOKEN=''
export NETDATA_DB_PASSWD=''
export PGSQL_ROOT_PASSWD='pass'
...
export AMAVISD_DB_PASSWD=''
export IREDADMIN_DB_PASSWD=''
export RCM_DB_PASSWD='rNf'
export SOGO_DB_PASSWD='hSm'
export SOGO_SIEVE_MASTER_PASSWD=''
export IREDAPD_DB_PASSWD=''
export FAIL2BAN_DB_PASSWD=''

No passwords generated?
Try this command used to generate random passwords on Linux and FreeBSD, anything returned on console?

eval </dev/urandom tr -dc A-Za-z0-9 | (head -c $1 &>/dev/null || head -c 32)

root@server:~ # eval </dev/urandom tr -dc A-Za-z0-9 | (head -c $1 &>/dev/null || head -c 32)
Invalid null command.

root@server:~ # ls -l /dev/urandom 
lrwxr-xr-x  1 root  wheel  6 13 Oct 23:54 /dev/urandom -> random

root@server:~ # ls -l /dev/random
crw-r--r--  1 root  wheel  0x8 13 Oct 23:54 /dev/random

root@server:~ # eval < /dev/urandom tr -dc A-Za-z0-9 
^C

root@server:~ # dd if=/dev/random bs=128 count=1
?ӇI?O=}?>D??R?Cd???_???W??'????J??įÉ]e?*?1?[x!^???>ޤ4?r??U?? ????FҾYoQ??e?ww0F??G?5?]1+0 records in
1+0 records out
128 bytes transferred in 0.000067 secs (1914649 bytes/sec)

Using

cat /dev/random

works (have to kill with ^C).

Using

dd if=/dev/random bs=128 count=1

limites the lenght of the random stream.

BTW: root@FreeBSD does not use `bash` as default and the shell must not be changed.

Bash Test 1

root@server:~ # bash
[root@server ~]# eval </dev/urandom tr -dc A-Za-z0-9 | (head -c $1 &>/dev/null || head -c 32)
tr: Illegal byte sequence
exit

Bash Test 2

root@server:~ # cat > x.sh << EOF
? eval </dev/urandom tr -dc A-Za-z0-9 | (head -c $1 &>/dev/null || head -c 32)
? EOF

root@server:~ # bash -xv x.sh 
eval </dev/urandom tr -dc A-Za-z0-9 | (head -c  &>/dev/null || head -c 32)
+ eval tr -dc A-Za-z0-9
tr -dc A-Za-z0-9
++ tr -dc A-Za-z0-9
+ head -c
tr: Illegal byte sequence
+ head -c 32

Another BTW: Given `OpenSSL` (or `LibreSSL` which is the default on FreeBSD) will be installed anyway, what about generating the passwod using it?

root@server:~ # bash
[root@server ~]# openssl rand -base64 32
kRQTirNSZZZUcJiFnO8pq11NcsK927kIhGVlSr1AmaI=

[root@server ~]# openssl rand -hex 32
1da0fe4f215b0718b2fe80eb2b01a304f83ebea6aa6bee0b2c49bddfa112313f

19

Re: Install Hangs while creating database

angeloklin wrote:

root@server:~ # bash -xv x.sh
eval </dev/urandom tr -dc A-Za-z0-9 | (head -c  &>/dev/null || head -c 32)
+ eval tr -dc A-Za-z0-9
tr -dc A-Za-z0-9
++ tr -dc A-Za-z0-9
+ head -c
tr: Illegal byte sequence

ok, this is the root cause.

On my local testing machine:

[root@fb ~]# eval </dev/urandom tr -dc A-Za-z0-9 | (head -c  &>/dev/null || head -c 32)
oTw6DzhzdPUjM7OeVtRya3HjWTqIn61y[root@fb ~]# 

It returns correct random string. It's 12.1-RELEASE, i guess your "12.1-RELEASE-p10" has some difference, will grab an ISO for new installation.

20

Re: Install Hangs while creating database

Confirmed, the old command ('eval ...') doesn't work on 12.1-RELEASAE-p10, it's now switched to:

openssl rand -base64 24

It uses 24 bytes, but after base64 encode, it's 32 characters.

Thank you very much for the report and help. smile