skip to Main Content

I added some files to systemed folder on my CentOS, after that postgresql service can not start with the error –
Job for postgresql-14.service failed because the control process exited with error code. See "systemctl status postgresql-14.service" and "journalctl -xe" for details.

systemctl status - 

Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: Starting PostgreSQL 14 database server...
Feb 08 20:47:38 82-166-106-208.barak-online.net postmaster[2525]: 2023-02-08 20:47:38.805 IST [2525] LOG:  redirecting log output to logging collector process
Feb 08 20:47:38 82-166-106-208.barak-online.net postmaster[2525]: 2023-02-08 20:47:38.805 IST [2525] HINT:  Future log output will appear in directory "log".
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: postgresql-14.service: main process exited, code=exited, status=1/FAILURE
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: Failed to start PostgreSQL 14 database server.
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: Unit postgresql-14.service entered failed state.
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: postgresql-14.service failed.


journalctl -xe

-- Unit postgresql-14.service has begun starting up.
Feb 08 20:47:38 82-166-106-208.barak-online.net postmaster[2525]: 2023-02-08 20:47:38.805 IST [2525] LOG:  redirecting log output to logging collector process
Feb 08 20:47:38 82-166-106-208.barak-online.net postmaster[2525]: 2023-02-08 20:47:38.805 IST [2525] HINT:  Future log output will appear in directory "log".
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: postgresql-14.service: main process exited, code=exited, status=1/FAILURE
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: Failed to start PostgreSQL 14 database server.
-- Subject: Unit postgresql-14.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-14.service has failed.
--
-- The result is failed.
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: Unit postgresql-14.service entered failed state.
Feb 08 20:47:38 82-166-106-208.barak-online.net systemd[1]: postgresql-14.service failed.
Feb 08 20:47:38 82-166-106-208.barak-online.net polkitd[774]: Unregistered Authentication Agent for unix-process:2512:147782 (system bus name :1.40, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_IN
lines 2104-2163/2163 (END)

2

Answers


  1. try this:

    sudo /etc/init.d/postgresql stop

    du -sh /var/lib/postgresql/8.4/main/pg_xlog/ ( this is your main data folder)

    84G /var/lib/postgresql/8.4/main/pg_xlog/

    /usr/lib/postgresql/8.4/bin/pg_controldata /var/lib/postgresql/8.4/main/

    Latest checkpoint’s NextXID: 0/385464
    Latest checkpoint’s NextOID: 159836

    sudo -u postgres /usr/lib/postgresql/8.4/bin/pg_resetxlog -o 159836 -x 385464 -f /var/lib/postgresql/8.4/main/

    Remember to put the correct NextOID NExtXID, don’t just copy paste this command, you should get response:
    Transaction log reset

    du -sh /var/lib/postgresql/8.4/main/pg_xlog/
    17M /var/lib/postgresql/8.4/main/pg_xlog/

    sudo /etc/init.d/postgresql start

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search