Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

postgresql wont start!

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
11 posts • Page 1 of 1
Author
Message
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

postgresql wont start!

  • Quote

Post by tranquilcool » Fri Jul 28, 2017 3:32 pm

for some reasons postgresql would not start.

Code: Select all

/etc/init.d/postgresql.10 start

/run/postgresql: correcting mode
 * Starting PostgreSQL 10 ...
su: Cannot make/remove an entry for the specified session

I even tried compiling without pam, but the result is the same.
any help!

[Moderator edit: added [code] tags to preserve output layout. -Hu]
this is a strange strange world.
Top
limn
l33t
l33t
Posts: 997
Joined: Fri May 13, 2005 8:08 pm

  • Quote

Post by limn » Fri Jul 28, 2017 6:37 pm

Maybe there is some problem with your postgres user.
See if su logged anything to /var/log/messages.
Top
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

  • Quote

Post by tranquilcool » Fri Jul 28, 2017 7:23 pm

limn wrote:Maybe there is some problem with your postgres user.
See if su logged anything to /var/log/messages.
nothing in /var/log/messages
this is a strange strange world.
Top
limn
l33t
l33t
Posts: 997
Joined: Fri May 13, 2005 8:08 pm

  • Quote

Post by limn » Fri Jul 28, 2017 8:23 pm

When it is successfully started on my box, messages has like this:

Code: Select all

Jul 25 06:46:45 gentoo su[10401]: Successful su for postgres by root
Jul 25 06:46:45 gentoo su[10401]: + /dev/pts/0 root:postgres
Jul 25 06:46:45 gentoo su[10401]: pam_unix(su:session): session opened for user postgres by limn(uid=0)
Jul 25 06:46:55 gentoo su[10401]: pam_unix(su:session): session closed for user postgres
dev-db/postgresql-10_beta2 is compiled with "ldap nls pam readline server ssl xml zlib" enabled.

Is sys-apps/shadow-4.5 compiled with pam on your box? Is pam a global use flag?

What happens if you

Code: Select all

su - postgres
Top
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

  • Quote

Post by tranquilcool » Fri Jul 28, 2017 8:51 pm

limn wrote:When it is successfully started on my box, messages has like this:

Code: Select all

Jul 25 06:46:45 gentoo su[10401]: Successful su for postgres by root
Jul 25 06:46:45 gentoo su[10401]: + /dev/pts/0 root:postgres
Jul 25 06:46:45 gentoo su[10401]: pam_unix(su:session): session opened for user postgres by limn(uid=0)
Jul 25 06:46:55 gentoo su[10401]: pam_unix(su:session): session closed for user postgres
dev-db/postgresql-10_beta2 is compiled with "ldap nls pam readline server ssl xml zlib" enabled.

Is sys-apps/shadow-4.5 compiled with pam on your box? Is pam a global use flag?

What happens if you

Code: Select all

su - postgres
su - postgress asks for password, and i haven't set one.

this is the contents of /etc/pam.d/postgresql-10

Code: Select all

auth    include         system-auth
account include         system-auth
session include         system-auth
contents of /etc/postgresql-10/pg_hba.conf

Code: Select all

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust
this is a line in /var/lib/postgresql/10/data/posmaster.log

Code: Select all

2017-07-28 22:49:45.958 CEST [24261] LOG:  worker process: logical replication launcher (PID 24269) exited with exit code 1

2017-07-28 22:49:45.958 CEST [24261] LOG:  received smart shutdown request
2017-07-28 22:49:46.014 CEST [24264] LOG:  shutting down
2017-07-28 22:49:46.363 CEST [24261] LOG:  database system is shut down
yes shadow is compiled with pam

update:
if i su - postgres as root, i can start the database with the command

Code: Select all

pg_ctl -D /var/lib/postgresql/10/data start
[Moderator edit: added [code] tags to preserve output layout. -Hu]
this is a strange strange world.
Top
limn
l33t
l33t
Posts: 997
Joined: Fri May 13, 2005 8:08 pm

  • Quote

Post by limn » Fri Jul 28, 2017 9:22 pm

Have you

Code: Select all

eselect postgresql set 10
so that pg_ctl is linked to /usr/lib/postgresql-10/bin/pg_ctl?
What happens if you run

Code: Select all

/usr/lib/postgresql-10/bin/postgres -D /etc/postgresql-10 --data-directory=/var/lib/postgresql/10/data --unix-socket-directories=/run/postgresql
as postgres? That is what the init script runs.
Top
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

  • Quote

Post by tranquilcool » Fri Jul 28, 2017 9:33 pm

limn wrote:Have you

Code: Select all

eselect postgresql set 10
so that pg_ctl is linked to /usr/lib/postgresql-10/bin/pg_ctl?
What happens if you run

Code: Select all

/usr/lib/postgresql-10/bin/postgres -D /etc/postgresql-10 --data-directory=/var/lib/postgresql/10/data --unix-socket-directories=/run/postgresql
as postgres? That is what the init script runs.
with su - postgres as root, the above commands start the database.
i am thinking maybe it's the init script
this is a strange strange world.
Top
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

  • Quote

Post by tranquilcool » Fri Jul 28, 2017 9:52 pm

yes, the problem was the init script.
i went for the postgresql.init file in the files directory with some corrections
and it worked.

thank you very much.
this is a strange strange world.
Top
limn
l33t
l33t
Posts: 997
Joined: Fri May 13, 2005 8:08 pm

  • Quote

Post by limn » Fri Jul 28, 2017 10:50 pm

De nada.
Top
red-0ne
n00b
n00b
Posts: 8
Joined: Fri Oct 23, 2009 2:07 pm

  • Quote

Post by red-0ne » Fri Sep 22, 2017 4:03 pm

tranquilcool wrote:yes, the problem was the init script.
i went for the postgresql.init file in the files directory with some corrections
and it worked.
I am having the same problem. Could you please indicate how you got it working?

Thank you
Top
tranquilcool
Veteran
Veteran
Posts: 1246
Joined: Fri Mar 25, 2005 1:16 pm

  • Quote

Post by tranquilcool » Sun Sep 24, 2017 5:01 pm

red-0ne wrote:
tranquilcool wrote:yes, the problem was the init script.
i went for the postgresql.init file in the files directory with some corrections
and it worked.
I am having the same problem. Could you please indicate how you got it working?

Thank you

Code: Select all

#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_started_commands="reload promote"

PG_CTL="/usr/lib64/postgresql-10/bin/pg_ctl"

description="PostgreSQL 10 -- the world's most advanced open source database --
${RC_SERVICE} is a wrapper around pg_ctl with additional administrative checks
and convenience"

get_config() {
    [ -f ${PGDATA%/}/postgresql.conf ] || return 1

    eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf \
        | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}

depend() {
    use net
    provide postgresql

    if [ "$(get_config log_destination)" = "syslog" ]; then
        use logger
    fi
}

configured_port=$(get_config port)
: ${configured_port:=${PGPORT}}
socket_path=$(get_config unix_socket_directory)
: ${socket_path:=/run/postgresql}

checkconfig() {
    # Check that DATA_DIR has been set
    if [ -z ${DATA_DIR} ] ; then
        eerror "DATA_DIR not set"
        eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-10"
        return 1
    fi

    # Check that DATA_DIR exists
    if [ ! -d ${DATA_DIR} ] ; then
        eerror "Directory not found: ${DATA_DIR}"
        eerror "HINT: Ensure that DATA_DIR points to the right path."
        eerror "HINT: Or perhaps you need to create the database cluster:"
        eerror "    emerge --config dev-db/postgresql:@SLOT@"
        return 1
    fi

    # Check for the existence of PostgreSQL's config files, and set the
    # proper mode and ownership.
    # Only three files should be checked as potentially other files
    # may be in PGDATA that should not be touched.
    local file
    for file in postgresql pg_hba pg_ident ; do
        file="${PGDATA%/}/${file}.conf"
        if [ -f ${file} ] ; then
            checkpath -f -m 0600 -o postgres:postgres ${file}
        else
            eerror "${file} not found"
            eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}"
            return 1
        fi
    done

    # Set the proper permission for the socket path and create it if
    # it doesn't exist.
    checkpath -d -m 1775 -o postgres:postgres ${socket_path}
    if [ -e ${socket_path%/}/.s.PGSQL.${configured_port} ] ; then
        eerror "Socket conflict."
        eerror "A server is already listening on:"
        eerror "    ${socket_path%/}/.s.PGSQL.${configured_port}"
        eerror "HINT: Change PGPORT to listen on a different socket."
        return 1
    fi
}

start() {
    checkconfig || return 1

    ebegin "Starting PostgreSQL"

    rm -f ${DATA_DIR%/}/postmaster.pid

    local extraenv
    local x
    for x in ${PG_EXTRA_ENV} ; do
        extraenv="${extraenv} --env ${x}"
    done

    start-stop-daemon --start \
        --user postgres \
        --env "PGPORT=${configured_port}" \
        ${extraenv} \
        --pidfile ${DATA_DIR%/}/postmaster.pid \
        --exec /usr/lib64/postgresql-10/bin/pg_ctl \
        -- start -s -w -t ${START_TIMEOUT} -l ${DATA_DIR%/}/postmaster.log \
                 -D ${PGDATA} -o "--data-directory=${DATA_DIR} ${PGOPTS}"
    local retval=$?

    if [ $retval -ne 0 ] ; then
        eerror "Check the log for a possible explanation of the above error. The log may be"
        eerror "    ${DATA_DIR%/}/postmaster.log"
        eerror "Or wherever you configured PostgreSQL @SLOT@ log messages to be sent."
        eend $retval
        return $retval
    fi

    eend $retval
}

stop() {
    local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
    ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"

    local retval
    local retries=SIGTERM/${NICE_TIMEOUT}

    if [ "${RUDE_QUIT}" != "NO" ] ; then
        einfo "RUDE_QUIT enabled."
        retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
    fi
    if [ "${FORCE_QUIT}" = "YES" ] ; then
        einfo "FORCE_QUIT enabled."
        ewarn "A recover-run might be executed on next startup."
        retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
    fi

    # Loops through nice, rude, and force quit in one go.
    start-stop-daemon --stop \
        --exec /usr/lib64/postgresql-10/bin/pg_ctl \
        --retry ${retries} \
        --pidfile ${DATA_DIR%/}/postmaster.pid

    eend
}

reload() {
    ebegin "Reloading PostgreSQL configuration"
    kill -HUP $(head -n1 ${DATA_DIR%/}/postmaster.pid)
    eend $?
}
this works for me.

[Moderator edit: added [code] tags to preserve output layout. -Hu]
this is a strange strange world.
Top
Post Reply

11 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic