pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
11+ messages / 6 participants
[nested] [flat]

* Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 08:57  W.P. <laurentp@wp.pl>
  0 siblings, 1 reply; 11+ messages in thread

From: W.P. @ 2022-04-06 08:57 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi there,

I had a problem with disconnecting USB disc with PG database on my OPi3.

PG is 11.

Now base refuses to start, with problem reported in log (see attached file).

But I don't have replication configured!

Is it possible to repair this?


Laurent

Attachments:

postgresql-11-main_2022-06-04.log (text/x-log, 1.6K) download 2022-04-05 20:53:38.892 CEST [12022-04-06 08:30:33.359 CEST [11834] LOG: listening on IPv4 address "0.0.0.0", port 5432 2022-04-06 08:30:33.360 CEST [11834] LOG: listening on IPv6 address "::", port 5432 2022-04-06 08:30:33.406 CEST [11834] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2022-04-06 08:30:33.586 CEST [11835] LOG: database system was interrupted; last known up at 2022-04-05 20:55:49 CEST 2022-04-06 08:30:34.369 CEST [11835] PANIC: replication checkpoint has wrong magic 1346542039 instead of 307747550 2022-04-06 08:30:34.371 CEST [11834] LOG: startup process (PID 11835) was terminated by signal 6: Aborted 2022-04-06 08:30:34.371 CEST [11834] LOG: aborting startup due to startup process failure 2022-04-06 08:30:34.374 CEST [11834] LOG: database system is shut down 2022-04-06 08:32:26.775 CEST [11873] LOG: listening on IPv4 address "0.0.0.0", port 5432 2022-04-06 08:32:26.776 CEST [11873] LOG: listening on IPv6 address "::", port 5432 2022-04-06 08:32:26.811 CEST [11873] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2022-04-06 08:32:26.980 CEST [11874] LOG: database system was interrupted; last known up at 2022-04-05 20:55:49 CEST 2022-04-06 08:32:27.668 CEST [11874] PANIC: replication checkpoint has wrong magic 1346542039 instead of 307747550 2022-04-06 08:32:27.669 CEST [11873] LOG: startup process (PID 11874) was terminated by signal 6: Aborted 2022-04-06 08:32:27.670 CEST [11873] LOG: aborting startup due to startup process failure 2022-04-06 08:32:27.673 CEST [11873] LOG: database system is shut down
^ permalink raw reply [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 10:37  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: W.P. <laurentp@wp.pl>
  0 siblings, 1 reply; 11+ messages in thread

From: Laurenz Albe @ 2022-04-06 10:37 UTC (permalink / raw)
  To: W.P. <laurentp@wp.pl>; pgsql-general@lists.postgresql.org

On Wed, 2022-04-06 at 10:57 +0200, W.P. wrote:
> Is it possible to repair this?

Not unless you tell us what exactly you did, command by command.

Yours,
Laurenz Albe






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 16:41  W.P. <laurentp@wp.pl>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 3 replies; 11+ messages in thread

From: W.P. @ 2022-04-06 16:41 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

W dniu 06.04.2022 o 12:37, Laurenz Albe pisze:
> On Wed, 2022-04-06 at 10:57 +0200, W.P. wrote:
>> Is it possible to repair this?
> Not unless you tell us what exactly you did, command by command.
>
> Yours,
> Laurenz Albe
>
>
>
That was not a "command". PG was working ok, DB on encrypted (LUKS on 
LVM2, ext4) USB drive.

Then simply I disconnected cable by accident.

After OPi restart, with filesystem on USB mounted again and fsck'ed 
first, PG refuses to start. With a message about replication error in log.

But I did not configured relication.


Thats all.


Laurent






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 16:54  Ron <ronljohnsonjr@gmail.com>
  parent: W.P. <laurentp@wp.pl>
  2 siblings, 1 reply; 11+ messages in thread

From: Ron @ 2022-04-06 16:54 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 4/6/22 11:41, W.P. wrote:
> W dniu 06.04.2022 o 12:37, Laurenz Albe pisze:
>> On Wed, 2022-04-06 at 10:57 +0200, W.P. wrote:
>>> Is it possible to repair this?
>> Not unless you tell us what exactly you did, command by command.
>>
>> Yours,
>> Laurenz Albe
>>
>>
>>
> That was not a "command". PG was working ok, DB on encrypted (LUKS on 
> LVM2, ext4) USB drive.
>
> Then simply I disconnected cable by accident.
>
> After OPi restart, with filesystem on USB mounted again and fsck'ed first, 
> PG refuses to start. With a message about replication error in log.
>
> But I did not configured relication.

The disk got corrupted, and one part that got corrupted is where 
Postgresql's replication (or not) is configured.

Delete the data/ directory and restore from backups (including config files).

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 17:20  Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
  parent: W.P. <laurentp@wp.pl>
  2 siblings, 1 reply; 11+ messages in thread

From: Laura Smith @ 2022-04-06 17:20 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On Wednesday, April 6th, 2022 at 17:41, W.P. <laurentp@wp.pl> wrote:


> That was not a "command". PG was working ok, DB on encrypted (LUKS on
> LVM2, ext4) USB drive.
>


I mean, why ?

If there was ever a "setting yourself up to fail" scenario, it would be this.  Just because you can do it, doesn't mean you should.

I suspect you will have to file this under "learnt the hard way"





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 18:04  W.P. <laurentp@wp.pl>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: W.P. @ 2022-04-06 18:04 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

W dniu 06.04.2022 o 18:54, Ron pisze:
> On 4/6/22 11:41, W.P. wrote:
>> W dniu 06.04.2022 o 12:37, Laurenz Albe pisze:
>>> On Wed, 2022-04-06 at 10:57 +0200, W.P. wrote:
>>>> Is it possible to repair this?
>>> Not unless you tell us what exactly you did, command by command.
>>>
>>> Yours,
>>> Laurenz Albe
>>>
>>>
>>>
>> That was not a "command". PG was working ok, DB on encrypted (LUKS on 
>> LVM2, ext4) USB drive.
>>
>> Then simply I disconnected cable by accident.
>>
>> After OPi restart, with filesystem on USB mounted again and fsck'ed 
>> first, PG refuses to start. With a message about replication error in 
>> log.
>>
>> But I did not configured relication.
>
> The disk got corrupted, and one part that got corrupted is where 
> Postgresql's replication (or not) is configured.
>
> Delete the data/ directory and restore from backups (including config 
> files).
>
I know about restoring backup. I just don't have one (at least with 
reasonnable age), as it is experimental installation. (Didn't ever been 
thinking about locating production DB on USB drive :) ).

If it is not possible to get rid ("somehow") of this "replication 
error", I will do a "logic restore" -> I have similar database on my 
laptop, so I'll get a pg_dumpall from this one, then recreate fresh DB 
on OPi and restore from SQL.


It looks that DATA in PG DB is protected by various mechanisms very 
well, but "dictionary data" (in this case replication data) is not (as 
much). And in my case ext4 recovery mechanisms failed.

This makes me logical replication more appealing.


Laurent






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 18:06  Ray O'Donnell <ray@rodonnell.ie>
  parent: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
  0 siblings, 0 replies; 11+ messages in thread

From: Ray O'Donnell @ 2022-04-06 18:06 UTC (permalink / raw)
  To: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>; pgsql-general@lists.postgresql.org

On 06/04/2022 18:20, Laura Smith wrote:
> On Wednesday, April 6th, 2022 at 17:41, W.P. <laurentp@wp.pl> wrote:
>> That was not a "command". PG was working ok, DB on encrypted (LUKS
>> on LVM2, ext4) USB drive.
> 
> I mean, why ?
> 
> If there was ever a "setting yourself up to fail" scenario, it would
> be this.  Just because you can do it, doesn't mean you should.

That was my thought too, but not being an expert I didn't want to jump 
straight in... The OP might have a good reason for doing this, but 
trying to run a database off a USB stick strikes me as asking for trouble.

> I suspect you will have to file this under "learnt the hard way"

Heh - I have a lot of stuff filed there myself. :-)

Ray.


-- 
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-06 18:09  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: W.P. <laurentp@wp.pl>
  0 siblings, 1 reply; 11+ messages in thread

From: Adrian Klaver @ 2022-04-06 18:09 UTC (permalink / raw)
  To: W.P. <laurentp@wp.pl>; pgsql-general@lists.postgresql.org

On 4/6/22 11:04 AM, W.P. wrote:
> W dniu 06.04.2022 o 18:54, Ron pisze:

> I know about restoring backup. I just don't have one (at least with 
> reasonnable age), as it is experimental installation. (Didn't ever been 
> thinking about locating production DB on USB drive :) ).
> 
If it is experimental you could try pg_resetwal:

https://www.postgresql.org/docs/11/app-pgresetwal.html

Read all the way through for the ifs/ands/buts.

> If it is not possible to get rid ("somehow") of this "replication 
> error", I will do a "logic restore" -> I have similar database on my 
> laptop, so I'll get a pg_dumpall from this one, then recreate fresh DB 
> on OPi and restore from SQL.
> 
> 
> It looks that DATA in PG DB is protected by various mechanisms very 
> well, but "dictionary data" (in this case replication data) is not (as 
> much). And in my case ext4 recovery mechanisms failed.
> 
> This makes me logical replication more appealing.
> 
> 
> Laurent
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-07 06:23  W.P. <laurentp@wp.pl>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 11+ messages in thread

From: W.P. @ 2022-04-07 06:23 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

W dniu 06.04.2022 o 20:09, Adrian Klaver pisze:
> On 4/6/22 11:04 AM, W.P. wrote:
>> W dniu 06.04.2022 o 18:54, Ron pisze:
>
>> I know about restoring backup. I just don't have one (at least with 
>> reasonnable age), as it is experimental installation. (Didn't ever 
>> been thinking about locating production DB on USB drive :) ).
>>
> If it is experimental you could try pg_resetwal:
>
> https://www.postgresql.org/docs/11/app-pgresetwal.html
>

Found this, had to use -f (program hint), but no luck. Same error.

Is there anything else?

[BTW my "logical restore" runs already 9h... still making indexes, DB is 
not very large, on i386 ~50GB]


Laurent


> Read all the way through for the ifs/ands/buts.
>
>> If it is not possible to get rid ("somehow") of this "replication 
>> error", I will do a "logic restore" -> I have similar database on my 
>> laptop, so I'll get a pg_dumpall from this one, then recreate fresh 
>> DB on OPi and restore from SQL.
>>
>>
>> It looks that DATA in PG DB is protected by various mechanisms very 
>> well, but "dictionary data" (in this case replication data) is not 
>> (as much). And in my case ext4 recovery mechanisms failed.
>>
>> This makes me logical replication more appealing.
>>
>>
>> Laurent
>>
>>
>>
>
>






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-07 06:48  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: W.P. <laurentp@wp.pl>
  2 siblings, 0 replies; 11+ messages in thread

From: Laurenz Albe @ 2022-04-07 06:48 UTC (permalink / raw)
  To: W.P. <laurentp@wp.pl>; pgsql-general@lists.postgresql.org

On Wed, 2022-04-06 at 18:41 +0200, W.P. wrote:
> W dniu 06.04.2022 o 12:37, Laurenz Albe pisze:
> > On Wed, 2022-04-06 at 10:57 +0200, W.P. wrote:
> > > Is it possible to repair this?
> > Not unless you tell us what exactly you did, command by command.
> > 
> > Yours,
> > Laurenz Albe
> > 
> > 
> > 
> That was not a "command". PG was working ok, DB on encrypted (LUKS on 
> LVM2, ext4) USB drive.
> 
> Then simply I disconnected cable by accident.
> 
> After OPi restart, with filesystem on USB mounted again and fsck'ed 
> first, PG refuses to start. With a message about replication error in log.
> 
> But I did not configured relication.

I see.  If you have no backup, you will need an expert to try and recover what
is possible.  Even so, there are chances that enough data are lost that
nothing can be salvaged.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection)
@ 2022-04-08 17:18  W.P. <laurentp@wp.pl>
  parent: W.P. <laurentp@wp.pl>
  0 siblings, 0 replies; 11+ messages in thread

From: W.P. @ 2022-04-08 17:18 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

 > If it is experimental you could try pg_resetwal:
>>
>> https://www.postgresql.org/docs/11/app-pgresetwal.html
>>
>
> Found this, had to use -f (program hint), but no luck. Same error.
>
> Is there anything else?
>
Problem stille here: during restore (from pg_dumpall on 11 on i386) 
server on OPi crashed during CREATE INDEX phase. Some indexes and 
triggers are missing.

SQL file has 16GB...

How can I prevent this in future (1), and (2) how to repair (maybe doing 
dump/restore again?) the "slave" database?

I'd like to have a replica of my DB on laptop, especially after seeing 
unrecoverable crash on OPi...


Laurent



> [BTW my "logical restore" runs already 9h... still making indexes, DB 
> is not very large, on i386 ~50GB]
>
>
> Laurent
>
>
>> Read all the way through for the ifs/ands/buts.
>>
>>> If it is not possible to get rid ("somehow") of this "replication 
>>> error", I will do a "logic restore" -> I have similar database on my 
>>> laptop, so I'll get a pg_dumpall from this one, then recreate fresh 
>>> DB on OPi and restore from SQL.
>>>
>>>
>>> It looks that DATA in PG DB is protected by various mechanisms very 
>>> well, but "dictionary data" (in this case replication data) is not 
>>> (as much). And in my case ext4 recovery mechanisms failed.
>>>
>>> This makes me logical replication more appealing.
>>>
>>>
>>> Laurent
>>>
>>>
>>>
>>
>>
>
>
>






^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2022-04-08 17:18 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 08:57 Problem with PG 11 database on OrangePi3 (ARMBIAN, ARM64) after disk disrupion (problem with USB disk connection) W.P. <laurentp@wp.pl>
2022-04-06 10:37 ` Laurenz Albe <laurenz.albe@cybertec.at>
2022-04-06 16:41   ` W.P. <laurentp@wp.pl>
2022-04-06 16:54     ` Ron <ronljohnsonjr@gmail.com>
2022-04-06 18:04       ` W.P. <laurentp@wp.pl>
2022-04-06 18:09         ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-04-07 06:23           ` W.P. <laurentp@wp.pl>
2022-04-08 17:18             ` W.P. <laurentp@wp.pl>
2022-04-06 17:20     ` Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
2022-04-06 18:06       ` Ray O'Donnell <ray@rodonnell.ie>
2022-04-07 06:48     ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox