Sidehistorik
...
Kodeblok |
---|
sudo docker run -d --restart on-failure --name="home-assistant" -v /home/bnp/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --net=host 93627847dd60 |
Broken Database
I got this in the logs
Kodeblok |
---|
csqlite3.DatabaseError: database disk image is malformed
2020-06-06T14:53:15.012416986Z sqlalchemy.exc.InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.DatabaseError) database disk image is malformed
2020-06-06T14:53:15.012430430Z [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (?, ?, ?, ?, ?, ?, ?)]
2020-06-06T14:53:15.012443081Z [parameters: ('state_changed', '{"entity_id": "sensor.hue_dimmer_switch_1_battery_level", "old_state": {"entity_id": "sensor.hue_dimmer_switch_1_battery_level", "state": "85", "attr ... (573 characters truncated) ... :00", "last_updated": "2020-06-06T14:53:14.119122+00:00", "context": {"id": "5ab6a95ba76548ea9d3833e194cce998", "parent_id": null, "user_id": null}}}', 'LOCAL', '2020-06-06 14:53:14.119249', '2020-06-06 14:53:14.138770', '5ab6a95ba76548ea9d3833e194cce998', None)]
2020-06-06T14:53:15.012461907Z (Background on this error at: http://sqlalche.me/e/4xp6) (Background on this error at: http://sqlalche.me/e/7s2a) |
Fixed by this
Kodeblok |
---|
docker stop "home-assistant"
apt-get install sqlite3
sqlite3 ./home-assistant_v2.db “.dump” | sqlite3 ./home-assistant_v2.db.fix
mv ./home-assistant_v2.db ./home-assistant_v2.db.broken
mv ./home-assistant_v2.db.fix ./home-assistant_v2.db
docker start "home-assistant"
docker logs --tail 50 --follow --timestamps "home-assistant" |
No Errors in the logs
MQTT
Start a MQTT Docker instance
...