Bug. Backup fails pg_dump needs PostgreSQL port

Backup fails due to pg_dump error. PostgreSQL is running on nonstandard port, and the port is correctly specified in webmin postgresql config page.

Steps to reproduce:

  1. Install Odoo 8 (Python/PostgreSQL). Change PostgreSQL port from standard 5432 to 5433 as in the standard Odoo 8 install steps. Note, Odoo uses PostgreSQL on port 5433 this to avoid possibly conflicting with an already running postgresql running on the server standard port 5432. Similar to running Apache to listen on a different port.

  2. Create the Vmin virtual subserver by Importing the Odoo 8 directory via the Virtualmin web console.

  3. Specify nonstandard port 5433 in the webmin postgresql module "PostgreSQL port to connect to".

  4. Add the postgresql database manually to the vmin subserver so that it'll be part of the backup data. Virtualmin gives success message because it detects the PostgreSQL server and database

  5. Create a backup job by using the Vmin web console. Daily full backup of all virtual servers and all data, save to remote FTP server.

  6. Let Vmin run the backup job at the scheduled time.

  7. Return and look at backup log.

Backup has failed !?

It seems Virtualmin is failing to pass the nonstandard port parameter to the pg_dump script.

Exact error message:

Dumping PostgresSQL database xxxx .. .. dump failed! pg_dump: [archiver (db)] connection to database "xxxx" failed: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Status: 
Active

Comments

Thanks for pointing this out - it will be fixed in the next Webmin release.

Cheers Jamie. Any idea when the next webmin release might be.

Should be in a week or two. Actually, I just released a 1.733 development version today that will include this fix, if you want to get it sooner - see http://www.webmin.com/devel.html

The new version is taking the correct non-default port number from the config.

However it's still failing the backup....

Dumping PostgresSQL database shop ..
    .. dump failed! pg_dump: server version: 9.1.14; pg_dump version: 8.4.21
pg_dump: aborting because of server version mismatch
$ find / -name pg_dump -type f
/usr/lib/postgresql/9.1/bin/pg_dump
/usr/lib/postgresql/8.4/bin/pg_dump

How would you recommend clearing up this error?

Should Virtualmin/Webmin handle choosing the correct version of pg_dump ??

or should the older version of pg_dump be removed, and if so, how would you best recommend doing that.

Do you perhaps have multiple versions of the pg_dump command installed? You can configure the path Webmin uses at Webmin -> Servers -> PostgreSQL Database -> Module Config.

That was it. 2 copies of postgresql were installed.

The commands listed in the Webmin module config for Postgresql are the symboli links to scripts that find and run the binaries for whichever version it deems appropriate, and that is somewhat arbitrary.

Commands to fix it.

su - postgres
pg_dumpall > dump.sql
exit
cp ~postgres/dump.sql /root/
aptitude purge postgresql-8.4
aptitude install postgresql-9.1
service postgresql restart
su - postgres
psql < dump.sql
sudo apt-get remove postgresql-client-8.4
mv /usr/lib/postgresql/8.4 /usr/lib/postgresql/8.4-old
rm -R /usr/lib/postgresql/8.4-old

OK now this has uncovered another bug. It seems that 18 of the 19 servers in the full backup complete OK, but on the "View Backup" screen. The status shows:

Final status Failed

The one server with an error:

Creating backup for virtual server pm.mydomain.com ..
    Copying virtual server configuration ..
    .. done

    Copying records in DNS domain ..
    .. done

    Saving mail aliases ..
    .. done

    Saving mail and FTP users ..
    .. done

    Backing up mail and FTP user Cron jobs ..
    .. none to backup

    Copying Apache virtual host configuration ..
    .. done

    Copying Apache log files ..
    .. done

    Copying Webalizer configuration files ..
    .. no logging directive found in webserver configuration!
   
        Saving Virtualmin configuration ..
        .. done

        Saving templates and plans ..
        .. done

        Saving email templates ..
        .. done

        Saving custom fields, links, categories and shells ..
        .. done

        Saving custom script installers ..
        .. done

        Saving scheduled backups ..
        .. done

        Saving FTP directory restrictions ..
        .. done

        Saving DKIM settings ..
        .. done

        Saving greylisting settings ..
        .. done

        Save mail rate limiting configuration ..
        .. done

        Saving mail server configuration ..
        .. done

    .. done

Any suggestion how to fix this no logging directive found in webserver configuration! ?

Check the Apache <Virtualhost> configuration for that domain - if it is missing a CustomLog or TransferLog line, then you will get this error. That should only happen if the config was edited manually though..

Thanks jamie. You're close! The conf file for the server /etc/apache2/sites-available/pm.mydomain.com.conf was missing AccessLog and ErrorLog

The reason for the missing apache log lines from the conf file seems to be because this is a 3rd party PHP web app that installed itself via its own shell script, and created this conf file and home directory for itself in /opt.

Because this PHP app installed itself in a location that doesn't fit Virtualmin's expected /home/servername structure. It installed itself into /opt/processmaker/ with its own conf file in its own etc folder, /opt/processmaker/etc/pmos.conf.

Virtualmin complains about missing folders /home/servername/domains/mydomain/cgi-bin, /home/servername/domains/mydomain/logs, and /home/servername/domains/mydomain/homes, so had to create those manually, set proper ownership, and then the Validate Virtual Servers finally showed clean results, with no errors in the virtual servers.

However this app (virtual server) is still running off the wrong conf file, so it fails to actually run in the browser, you just get a blank screen, because the conf file in /home is empty, Virtualmin expects the code and conf to be located in the /home folder but it's really installed in /opt.

Yeah, the way Virtualmin installs suexec will prevent PHP scripts from running outside of /home - we can't really support other install methods like this.