Update not working and all kind of issues: SD toasted?

I have HA on a RPi4, it’s been working without issues for a couple of years since I last resintalled everything, but lately it’s been acting up.

I have two updates (HA Core 2024.4.2 => 2024.4.2 and HA OS 12.1 => 12.2) and when I update, it doesn’t seem to work. The machine will go away for a while, then when I can access it again, the updates are still available.

I have a zigbee2mqtt that I reload at regular schedule (to avoid issues with a specific device I’m using with it), but now sometimes when it reboots, I get an error:

Can’t create container from addon_45df7312_zigbee2mqtt: 409 Client Error for http+docker://localhost/v1.43/containers/create?name=addon_45df7312_zigbee2mqtt: Conflict (“Conflict. The container name “/addon_45df7312_zigbee2mqtt” is already in use by container “0037b5402a73cf7b5558a1a8463c92c6a8e6a1b02ea4542b5e9289a19b0278a3”. You have to remove (or rename) that container to be able to reuse that name.”)

I have all sorts of other errors in the logs that don’t look good:

  • Failed to to call /host/info -
  • Failed to to call /backups -
  • Failed to to call /addons -

Unrecoverable sqlite3 database corruption detected: (sqlite3.DatabaseError) database disk image is malformed [SQL: SELECT anon_1.metadata_id, anon_1.state, anon_1.last_updated_ts, anon_1.last_changed_ts, anon_1.attributes FROM (SELECT anon_2.metadata_id AS metadata_id, anon_2.state AS state, anon_2.last_updated_ts AS last_updated_ts, anon_2.last_changed_ts AS last_changed_ts, anon_2.attributes AS attributes FROM (SELECT states.metadata_id AS metadata_id, states.state AS state, ? AS last_updated_ts, ? AS last_changed_ts, CASE WHEN (state_attributes.shared_attrs IS NULL) THEN states.attributes ELSE state_attributes.shared_attrs END AS attributes FROM states JOIN (SELECT states.metadata_id AS max_metadata_id, max(states.last_updated_ts) AS max_last_updated FROM states WHERE states.last_updated_ts >= ? AND states.last_updated_ts < ? AND states.metadata_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) GROUP BY states.metadata_id) AS anon_3 ON states.metadata_id = anon_3.max_metadata_id AND states.last_updated_ts = anon_3.max_last_updated LEFT OUTER JOIN state_attributes ON states.attributes_id = state_attributes.attributes_id WHERE states.last_updated_ts >= ? AND states.last_updated_ts < ? AND states.metadata_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) AS anon_2 UNION ALL SELECT anon_4.metadata_id AS metadata_id, anon_4.state AS state, anon_4.last_updated_ts AS last_updated_ts, anon_4.last_changed_ts AS last_changed_ts, anon_4.attributes AS attributes FROM (SELECT states.metadata_id AS metadata_id, states.state AS state, states.last_updated_ts AS last_updated_ts, states.last_changed_ts AS last_changed_ts, CASE WHEN (state_attributes.shared_attrs IS NULL) THEN states.attributes ELSE state_attributes.shared_attrs END AS attributes FROM states LEFT OUTER JOIN state_attributes ON states.attributes_id = state_attributes.attributes_id WHERE states.metadata_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) AND states.last_updated_ts > ? AND states.last_updated_ts < ?) AS anon_4) AS anon_1 ORDER BY anon_1.metadata_id, anon_1.last_updated_ts] [parameters: (0, 0, 1713131334.899448, 1713147899.999999, 3415, 3414, 3514, 3602, 3603, 5438, 5439, 1186, 1187, 1188, 1189, 1219, 1220, 1221, 1222, 1178, 1947, 1180, 1181, 3194, 3195, 3196, 3197, 1195, 1196, 1197, 1198, 1170, 1171, 1172, 1173, 1203, 1204, 1205, 1206, 1089, 1090, 1091, 1092, 1211, 1212, 1213, 1214, 1097, 1098, 1099 … 241 parameters truncated … 3606, 3607, 3208, 3209, 3210, 3211, 3213, 3242, 3243, 3244, 3215, 3245, 3246, 3247, 3217, 3219, 3221, 3223, 3225, 3227, 3229, 3231, 3233, 3235, 3237, 3239, 3241, 3254, 3255, 3256, 3257, 3259, 3260, 3261, 3262, 3264, 3265, 3266, 3267, 5695, 3270, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 1713147899.999999, 1713148200.0)] (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

Any idea what to do to diagnose and/or fix ?

EDIT: 100% sure my sd card is done, now. I tried reinstalling HA to it, and the verification at the end failed, saying what’s on it is different from what was written.

Lots of random potentially disk related errors on an SD card Pi that’s been in service over 12 mo.?

Yeah odds are the SD is toast. Good opportunity it move to SSD.

I was looking at that and what’s the best option ? SSD via USB adapter ? Or going all the way and switching to a second hand NUC or similar machine ?

That’s two completely different not mutually exclusive options there… :smiley:

That said, I used to run on a Pi4B8G /256g SSD.

I now run a NUC with 16G and the same SSD and the performance is night and day better.

You get the SSD because it won’t wear like an SD and you’re not replacing them every year… You get the nuc because you don’t like your current performance.

Bonus question: if I go from rpi to nuc, would a backup from the rpi install work to restore on the NUC or would I have to reconfigure everything ?

Backup and restore will work. Don’t forget to reboot after the restore, or you will have problems with your add-ons.

1 Like

looking at my backup folder, I think it doesn’t have my node red flows. I can however access my sd card and backup about everything, including node red config folder, so I can probably recover it later on. Hopefully nothing is corrupted…

The location the flows stored moved last year (look for the threads discussing NR 16.x you’ll find them it was a nightmare) if you’re on current (16.x or better) your flows are now stored in your node red backup. If you were on versions before that change you need both a full backup AND a NR backup to make sure you had your flows.