Database malformed: Error: cannot open "/storage/dump_all.sql"

Hello,

i’m trying to restore corrupted db. Reading official storj FAQ on how to fix, but stuck at this part:


  • You will see a prompt from sqlite3 . Run this SQL script:

.mode insert
.output /storage/dump_all.sql
.dump
.exit

And then i do these commands while “sudo su” and

SQLite version 3.37.2 2022-01-06 13:25:41
Enter “.help” for usage hints.
sqlite> .mode insert
sqlite> .output /storage/dump_all.sql
Error: cannot open “/storage/dump_all.sql”
Error: cannot write to “/storage/dump_all.sql”
sqlite>

How to fix this?
Thank you.

Hello @node1 ,

Did you run it in docker?
If not, then you need to have a /storage directory exist or you need to replace this path to the existing location, like your data location.

if you run this in the docker container, your actual storage location should be bind to /storage inside the container, so check your binding (--mount option).

1 Like

Thank you, with your help, i’ve managed this step. But already stuck for 30 min at the next step:

cat /storage/dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >/storage/dump_all_notrans.sql

i get this:

cat /dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >/storage/dump_all_notrans.sql
bash: /storage/dump_all_notrans.sql: No such file or directory
bash: cat /dump_all.sql: No such file or directory
grep -v TRANSACTION: command not found
grep -v ROLLBACK: command not found

tried many options with full path in both places like this:

cat /home/user/storj/storage/dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >/home/user/storj/storage/dump_all_notrans.sql
bash: cat /home/user/storj/storage/dump_all.sql: No such file or directory
grep -v ROLLBACK: command not found
grep -v TRANSACTION: command not found
1 user@user:~/storj/storage$ cd /home/user/storj/storage/
user@user:~/storj/storage$ ls
bandwidth.db dump_all.sql info.db orders.db-wal piece_spaced_used.db satellites.db storage-dir-verification trash
bandwidth.db-shm dump_all_notrans.sql notifications.db piece_expiration.db pieceinfo.db satellites.db-shm storage_usage.db used_serial.db
bandwidth.db-wal garbage orders.db piece_expiration.db-shm pricing.db satellites.db-wal temp
blobs heldamount.db orders.db-shm piece_expiration.db-wal reputation.db secret.db test.txt
user@user:~/storj/storage$

have no idea, the path is exact :slight_smile: when i copy/paste the path from error, and use with “cd” i go there and see needed file, but the script can’t find.

(no docker, plain sqlite3)

thank you.

also very strange, that it can’t see the file “dump_all.sql”.
As you can see i’m running this command inside “storage/” folder. And after “ls” dump_all.sql is visible here. Why the command “cat” can’t see it ?

user@user:~/storj/storage$ cat dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >/home/user/storj/storage/dump_all_notrans.sql
cat dump_all.sql: command not found
grep -v ROLLBACK: command not found
grep -v TRANSACTION: command not found
1 user@user:~/storj/storage$ ls
bandwidth.db dump_all.sql info.db orders.db-wal piece_spaced_used.db pieceinfo.db-shm satellites.db storage-dir-verification trash
bandwidth.db-shm dump_all_notrans.sql notifications.db piece_expiration.db piece_spaced_used.db-shm pieceinfo.db-wal satellites.db-shm storage_usage.db used_serial.db
bandwidth.db-wal garbage orders.db piece_expiration.db-shm piece_spaced_used.db-wal pricing.db satellites.db-wal temp
blobs heldamount.db orders.db-shm piece_expiration.db-wal pieceinfo.db reputation.db secret.db test.txt
user@user:~/storj/storage$

Seems your system doesn’t have grep command?

grep --help

If it doesn’t exist, you need to install it.
Check the same for cat, is it exist in your system?

cat --help

Try

cat ./dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >/home/user/storj/storage/dump_all_notrans.sql

They both, exist :expressionless:

grep --help
Output control:
-m, --max-count=NUM stop after NUM selected lines
-b, --byte-offset print the byte offset with output lines

cat --help
Usage: cat [OPTION]… [FILE]…
Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

Maybe this problem because of the latest ubuntu?

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

No, unlikely. More like there is some extra spaces or unknown symbols.
Please try to execute the command

1 Like

Thank you! this worked out!!
Situation got better, but not in full.

I don’t see more errors in the log, as well web dash board, shows green and online. But bandwidth utilization and total earned is gone…



it’s just a display error, if you resize the browser page, the statistics come back

No, it’s not about resize.

You need to check databases again. Seems at least another one is broken.

Looks like…
Can apply same repair technology on all db’s ?

Yes, of course. This guide is made to help to fix any of the sqlite database.

1 Like