postgresql-common 154ubuntu1 checks for existence of /var/run/postgresql and terminates before it has change to create via 'start' function in /usr/share/postgresql-common/init.d-functions

Bug #1647453 reported by Shaun Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
postgresql-common (Ubuntu)
New
Undecided
Unassigned

Bug Description

The init script /etc/init.d/postgresql in Ubuntu 14.04 Trusty Tahr has check:

    start|stop|restart|reload)
    if [ -z "`pg_lsclusters -h`" ]; then
        log_warning_msg 'No PostgreSQL clusters exist; see "man pg_createcluster"'
        exit 0
    fi

pg_lsclusters -h command will return an empty string (to STDOUT) if /var/run/postgresql does not exist.

/var/run/postgresql does not get initialized however until the init script can reach a call to 'start' from /usr/share/postgresql-common/init.d-functions:

start() {
    # create socket directory
    if [ -d /var/run/postgresql ]; then
    chmod 2775 /var/run/postgresql
    else
    install -d -m 2775 -o postgres -g postgres /var/run/postgresql
    [ -x /sbin/restorecon ] && restorecon -R /var/run/postgresql || true
    fi

    do_ctl_all start "$1" "Starting PostgreSQL $1 database server"
}

/var/run is a volatile file system by default in Trusty - so on reboot /var/run/postgresql will not exist.

Essentially, postgresql will fail to start on reboot.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.