Postgresql server wont start, data corrupted

My YunoHost server

Hardware: Raspberry Pi at home
YunoHost version: 4.1.8
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : just some tiny and mail conf mods

Description of my issue

After a (user-caused) failed backup, my postgresql server will not start.

Currently, the postgres logs give this on an attempted start up:

LOG:  invalid record length at 0/2282A70: wanted 24, got 0
LOG:  invalid primary checkpoint record
PANIC:  could not locate a valid checkpoint record
 LOG:  startup process (PID 22561) was terminated by signal 6: Aborted

and from around the time of the failure:

 LOG:  database system was interrupted; last known up at XYZ
 LOG:  database system was not properly shut down; automatic recovery in progress'
 LOG:  redo starts at 0/22828E8'
 LOG:  invalid record length at 0/22829C8: wanted 24, got 0'
 LOG:  redo done at 0/2282990'

Re the failed backup:

  • I tried to do a backup from the webadmin backup section, with everything ticked, which to my surprise meant a 20+gb backup (it was doing things like including existing backup files, because they are in /home/). i had never done it before, so didn’t know how it works. i manually stopped it, maybe from the cli, i cannot remember how, my bad my bad. :confused:

Question 1: what is postgresql actually used for? my apps work fine, admin works fine unless i enter the backups section.

Question 2 (depends on q1): do i need to worry about repairing it very carefully?

Looking online at pgql troubleshooting, things don’t look too good. / I’m not sure how to run postgresql server commands, i see only client commands in bash, and i also don’t have a ‘postgres’ command available, which are the two things i have seen used for troubleshooting. i copied the corrupt pgql data dir to work on it, but not sure how to get started.

i managed to get postgresql to start again
by switching to user postgres:

sudo su postgres

then running

/usr/lib/postgresql/11/bin/pg_resetwal /var/lib/postgresql/11/main/

and then moving

/var/lib/postgresql/11/main/pg_logical/replorigin_checkpoint 

out of the way and starting the service.

postgres is happy but when i try to enter the backups section of the admin panel nothing appears and it breaks the admin panel until i restart yunohost-api from cli.

perhaps someone knows what the permissions should be for backup files and the yunohost.backup/archives dir? currently both dir and backup files are owned by admin:root.

i moved the archives folder and all is well.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.