ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 897 forks source link

Failed to replicate query: database disk image is malformed #6027

Open AngeloMetal opened 1 year ago

AngeloMetal commented 1 year ago

When I start up lightningd with sudo systemctl start lightningd, no error is returned.

When I run sudo journalctl -f -u lightningd, I get this:

$ sudo journalctl -f -u lightningd
-- Journal begins at Tue 2023-01-31 10:49:40 EET. --
Feb 11 14:24:44 raspibolt systemd[1]: Started Core Lightning daemon.
Feb 11 14:25:54 raspibolt sh[184030]: Failed to replicate query: database disk image is malformed: database disk image is malformed: DELETE FROM blocks WHERE height > 775495
Feb 11 14:25:54 raspibolt systemd[1]: lightningd.service: Main process exited, code=exited, status=1/FAILURE
Feb 11 14:25:54 raspibolt systemd[1]: lightningd.service: Killing process 184047 (node) with signal SIGKILL.
Feb 11 14:25:54 raspibolt systemd[1]: lightningd.service: Failed with result 'exit-code'.
Feb 11 14:25:54 raspibolt systemd[1]: lightningd.service: Consumed 3.860s CPU time.
Feb 11 14:26:24 raspibolt systemd[1]: lightningd.service: Scheduled restart job, restart counter is at 3417.
Feb 11 14:26:24 raspibolt systemd[1]: Stopped Core Lightning daemon.
Feb 11 14:26:24 raspibolt systemd[1]: lightningd.service: Consumed 3.860s CPU time.
Feb 11 14:26:24 raspibolt systemd[1]: Started Core Lightning daemon.

Lightning daemon isn't running:

$ lightning-cli getinfo
lightning-cli: Connecting to 'lightning-rpc': Connection refused

Do you know what's the fault?

Extra information that might be helpful: Verification progress is 99.9993% in my Bitcoin node.

GitterDone221 commented 10 months ago

Something similar happened to me, and was related to the back-up lightning.sqlite3 which was being stored on a mounted USB stick. The memory stick was going bad, and the backup plug-in was failing to write to it - "... disk image is malformed ...". Try swapping the back-up medium, and your problem might go away.

ghost commented 6 months ago

Thanks @GitterDone221 your suggestions solved the issue for me.