Error while creating backup

Hello,

I have been struggling with creating backups since a while. I’m currently at version:
hassos: “14.1”
homeassistant: 2025.5.0
hostname: homeassistant
logging: info
machine: generic-x86-64
operating_system: Home Assistant OS 14.1
state: running
supervisor: 2025.04.1

but it started a while ago (I don’t know at which version, but I made quite a jump from a 2-3 year old version to current one about 5 months ago). What would happen is that I would start the backup creation, but it would fail after some time, and hours later I would see the backup is there, but it only has a size of 10kb.

My steps to solve this were:

delete all previous backups

create new backup: ha backups new --name “My Full Backup”

i get this error:
“An error occurred while making backup, check job ‘1e5cc755fb61488aa2ad4269c38b680a’ or supervisor logs for details”

check the error:
“ha jobs info 1e5cc755fb61488aa2ad4269c38b680a”

error output:
"errors:

  • message: ‘Preparing backup of Home Assistant Core failed. Failed to inform HA
    Core: Unsuccessful websocket message - {’‘id’‘: 227, ‘‘type’’: ‘‘result’’, ‘‘success’’:
    False, ‘‘error’’: {’‘code’‘: ‘‘pre_backup_actions_failed’’, ‘‘message’’: ‘‘Error
    during pre-backup: Could not lock database within 30 seconds.’’}}.’
    stage: home_assistant
    type: HomeAssistantBackupError
    name: backup_manager_partial_backup
    progress: 0
    reference: e0896ea0
    stage: home_assistant
    uuid: c9d7a90a746f400cbf344db59eeb877c
  • child_jobs:
    • child_jobs:
      created: “2025-05-05T15:59:31.676114+00:00”
      done: true
      errors:
      • message: ‘Preparing backup of Home Assistant Core failed. Failed to inform HA
        Core: Unsuccessful websocket message - {’‘id’‘: 202, ‘‘type’’: ‘‘result’’,
        ‘‘success’’: False, ‘‘error’’: {’‘code’‘: ‘‘pre_backup_actions_failed’’, ‘‘message’’:
        ‘‘Error during pre-backup: Could not lock database within 30 seconds.’’}}.’
        stage: null
        type: HomeAssistantBackupError
        name: backup_store_homeassistant
        progress: 0
        reference: a8e44eae
        stage: null
        uuid: 9bbf828712fe4a0483d96d3ffe6ae803
        created: “2025-05-05T15:58:36.658793+00:00”
        done: true
        errors:
    • message: ‘Preparing backup of Home Assistant Core failed. Failed to inform HA
      Core: Unsuccessful websocket message - {’‘id’‘: 202, ‘‘type’’: ‘‘result’’, ‘‘success’’:
      False, ‘‘error’’: {’‘code’‘: ‘‘pre_backup_actions_failed’’, ‘‘message’’: ‘‘Error
      during pre-backup: Could not lock database within 30 seconds.’’}}.’
      stage: home_assistant
      type: HomeAssistantBackupError
      name: backup_manager_partial_backup
      progress: 0
      reference: a8e44eae
      stage: home_assistant
      uuid: 384783c7d407436597f6be08bf76cdd9

remove db file:
rm /config/home-assistant_v2.db

restart core:
ha core restart

create backup again:
ha backups new --name ‘Clean Test Backup’

it’s done. Hope this helps

For thos repeating the steps: deleting the database means losing all history, including long term statistics. That my be needed if the database is corrupt. But if the block is caused by some other application accessing the database, it might not be needed.

Thanks for the comment. Unfortunately my backups were corrupting every couple of days. So I switched to Maria DB. I’m observing it. If it will be ok over a long period of time, SQL Lite just got overwhelmed, plus it was also running on a pend drive. Might have been ok on SSD as I have moved the installation to an SSD and moved to Maria DB at the same time, so it will be harder to tell the exact root cause. AND if the DB will still get corrupted after a while, I have a suspicion about a Sonoff POW reporting power usage that is not reporting data correctly, but I couldn’t be bothered to find the 15 minutes it takes to get it out of the equation.