meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[SUPPORT] 4.6.1 on Raspbian baremetal

Open kokoshell opened this issue 6 months ago • 4 comments

Image

kokoshell avatar May 19 '26 14:05 kokoshell

Thanks for the report! I can see the error from your screenshot.

Root Cause

Your SQLite database file is corrupted (SQLITE_CORRUPT). The exact error is:

SqliteError: database disk image is malformed
code: 'SQLITE_CORRUPT'

This is triggered when MeshMonitor 4.6.1 tries to run migration 059 (telemetry_source_node_type_ts_index) against your existing database. The database itself is damaged — not the migration. On Raspberry Pi / Raspbian this is very commonly caused by:

  • SD card failure or wear (most common cause)
  • Unexpected power loss during a write operation
  • File system errors on the SD card

Immediate Fix

To get MeshMonitor running again:

# 1. Stop MeshMonitor first, then:

# Back up the corrupted database (optional but recommended)
cp /path/to/meshmonitor.db /path/to/meshmonitor.db.bak

# Delete the corrupted database
rm /path/to/meshmonitor.db

# Restart MeshMonitor — it will create a fresh database automatically

The default database path is typically /root/meshmonitor/data/meshmonitor.db or wherever your DATA_DIR is configured.

Historical node/message data will be lost, but the app will be fully functional again. If you want to attempt recovery of the data, the sqlite3 CLI tool has a .recover command that can sometimes salvage rows from a corrupt database.

What We're Fixing in MeshMonitor

Currently the app crashes with a raw Node.js stack trace when SQLITE_CORRUPT is detected. A fix is being prepared that will instead print a clear, actionable error message with the exact database path and recovery steps before exiting cleanly. This will be much more helpful for Raspberry Pi users who hit this issue.


Generated by Claude Code

Yeraze avatar May 19 '26 14:05 Yeraze

Where is that database actually located ?? Because is NOT in the meshmonitor main dir !

kokoshell avatar May 19 '26 14:05 kokoshell

On a baremetal Raspbian + Node.js setup with no environment overrides, MeshMonitor will try to use /data/meshmonitor.db.

That's hardcoded in src/server/config/environment.ts:

value: process.env.DATABASE_PATH || '/data/meshmonitor.db',

There's no platform-specific or NODE_ENV-based branching — the default is /data/meshmonitor.db regardless of whether you're in Docker or baremetal. So on Raspbian without Docker, the process needs either:

  1. /data/ to exist and be writable by the user running node (unusual on Raspbian), or
  2. DATABASE_PATH=/home/pi/meshmonitor/data/meshmonitor.db (or similar) set in the environment before launch.

That /data default is almost certainly what's tripping up a baremetal user who hasn't set DATABASE_PATH.


Generated by Claude Code

Yeraze avatar May 19 '26 19:05 Yeraze

GREAT now I now where the database is , case closed fixed it !

kokoshell avatar May 19 '26 20:05 kokoshell