1

Topic: No db structure created when installing PG as backend iredmail 0.9.3

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.3
- Linux/BSD distribution name and version: Debian 8.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? no
- Related log if you're reporting an issue:
====
Hi!
Just installed fresh iredmail 0.9.3 and found issue that no tables are created in databases: vmail, roundcubemail, amavisd, iredadmin, iredapd.
Example:
$ psql vmail
psql (9.4.5)
Type "help" for help.

vmail=# \d
No relations found.

----

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

2

Re: No db structure created when installing PG as backend iredmail 0.9.3

*) Any error on console during iRedMail installation?
*) Any error in file iRedMail-0.9.3/runtime/install.log?

3

Re: No db structure created when installing PG as backend iredmail 0.9.3

ZhangHuangbin wrote:

*) Any error on console during iRedMail installation?

No errors
********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Create self-signed SSL certification files (2048 bits).
[ INFO ] Generate a strong, unique Diffie Hellman Group with openssl, please wait.

[ INFO ] Create required system account: vmail, iredadmin, iredapd.
[ INFO ] Configure Apache web server.
[ INFO ] Configure PHP.
[ INFO ] Configure PostgreSQL database server.
[ INFO ] Setup daily cron job to backup PostgreSQL databases with /hosting/mail/backup/backup_pgsql.sh
[ INFO ] Configure Postfix (Message Transfer Agent).
[ INFO ] Configure Dovecot (pop3/imap/managesieve server).
[ 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).
[ INFO ] Configure iRedAdmin (official web-based admin panel).
[ INFO ] Configure Fail2ban (authentication failure monitor).
[ INFO ] Configure Roundcube webmail.
[ INFO ] Configure Awstats (logfile analyzer for mail and web server)

********************************************************************

ZhangHuangbin wrote:

*) Any error in file iRedMail-0.9.3/runtime/install.log?

Yep, tried to grep out useful info:

ALTER ROLE
+ < DEBUG > Import postfix virtual hosts/users: /usr/local/src/iRedMail-0.9.3/runtime/pgsql_init.pgsql.
CREATE ROLE
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
psql:/var/lib/postgresql/9.4/main/init.sql:14: \connect: FATAL:  Peer authentication failed for user "vmailadmin"
+ < DEBUG > Import Amavisd database and privileges.
CREATE DATABASE
CREATE ROLE
ALTER DATABASE
psql: FATAL:  Peer authentication failed for user "amavisd"
psql: FATAL:  Peer authentication failed for user "amavisd"
+ < DEBUG > Import iRedAPD database template.
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
psql: FATAL:  Peer authentication failed for user "iredapd"
+ < DEBUG > Import iRedAdmin database template.
CREATE ROLE
CREATE DATABASE
ALTER DATABASE
psql: FATAL:  Peer authentication failed for user "iredadmin"
+ < DEBUG > Import SQL database and privileges for Roundcubemail.
psql: FATAL:  Peer authentication failed for user "roundcube"

4

Re: No db structure created when installing PG as backend iredmail 0.9.3

*) Did you install iRedMail on a FRESH/CLEAN/NEW server OS?
*) What's the content in file "~postgres/.pgpass"? Can you login to PostgreSQL with any of them?

5 (edited by ksb 2016-01-26 03:46:09)

Re: No db structure created when installing PG as backend iredmail 0.9.3

ZhangHuangbin wrote:

*) Did you install iRedMail on a FRESH/CLEAN/NEW server OS?

Crystal clear system

ZhangHuangbin wrote:

*) What's the content in file "~postgres/.pgpass"? Can you login to PostgreSQL with any of them?

localhost:*:*:postgres:<pass_hash>
localhost:*:*:vmail:<pass_hash>
localhost:*:*:vmailadmin:<pass_hash>
localhost:*:*:iredapd:<pass_hash>
localhost:*:*:iredadmin:<pass_hash>
localhost:*:*:sogo:<pass_hash>
localhost:*:*:roundcube:<pass_hash>
localhost:*:*:amavisd:<pass_hash>

Can login with all of them, except "sogo", but Sogo was probably not installed.

6

Re: No db structure created when installing PG as backend iredmail 0.9.3

No clear idea yet. Would you mind giving iRedMail-0.9.4 a try?

7

Re: No db structure created when installing PG as backend iredmail 0.9.3

Ok, i will try and let You know about results.

8

Re: No db structure created when installing PG as backend iredmail 0.9.3

Tested again with 0.9.3 and also 0.9.4
Noticed that postgres peer authentication actually fails immediately after setup. After reboot it works fine. Now we need to find what happens after reboot... May be some environment vars?

9

Re: No db structure created when installing PG as backend iredmail 0.9.3

*) Did you have correct databases/tables with iRedMail-0.9.4?
*) What do you mean "fails immediately after setup"? iRedMail restarts PostgreSQL service immediately after updating pg_hba.conf, so the peer authentication should work during iRedMail installation.

10 (edited by ksb 2016-01-28 03:10:30)

Re: No db structure created when installing PG as backend iredmail 0.9.3

Found where the problem is.
+ < DEBUG > Service control: restart postgresql.
/usr/local/src/iRedMail-0.9.3/conf/core: line 293: systemctl: command not found
I'm using prebuilt debian 8.0 image (LXC) which I upgrade to 8.3 before installing iRedMail.
It contains no systemd installed. And for now, I need to figure out how to make systemd working inside LXC, but that's another topic. May be another way of restarting services for those without systemd?
service <srv_name> restart?

11

Re: No db structure created when installing PG as backend iredmail 0.9.3

Please re-download iRedMail-0.9.4 and try again:
http://www.iredmail.org/download.html

I fixed this issue moment ago and repacked iRedMail-0.9.4:
https://bitbucket.org/zhb/iredmail/comm … 6e62394afd

iRedMail will detect whether systemd is available.

12

Re: No db structure created when installing PG as backend iredmail 0.9.3

It's fine now, thank you!