A few days ago my Backup job stopped working, when going to the live Verbose log all I could find is:
Failed to read local db C:\Windows\system32\config\systemprofile\AppData\Local\Duplicati\ZYEDFWQRGR.sqlite, error: database is locked database is locked
{"errorCode":"Busy","ClassName":"System.Data.SQLite.SQLiteException","Message":"database is locked\r\ndatabase is locked","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" en System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)\r\n en System.Data.SQLite.SQLiteDataReader.NextResult()\r\n en System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)\r\n en System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)\r\n en Duplicati.Library.Main.Database.ExtensionMethods.ExecuteScalarInt64(IDbCommand self, Boolean writeLog, String cmd, Int64 defaultvalue, Object[] values)\r\n en Duplicati.Library.Main.Database.LocalDatabase..ctor(IDbConnection connection, String operation)\r\n en Duplicati.Library.Main.Operation.RepairHandler.Run(IFilter filter)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nStep\nSystem.Data.SQLite, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139\nSystem.Data.SQLite.SQLite3\nBoolean Step(System.Data.SQLite.SQLiteStatement)","HResult":-2147481681,"Source":"System.Data.SQLite","WatsonBuckets":null}
I am running Duplicati as a service:
I did some digging and I saw that it was Duplicati itself the one locking the database. I didn’t know what to do, so I tried this:
- Forcefully kill all Duplicati processes
- Renaming the database in
C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati
to<database name>.sqlite.bak
- Relaunching the service
- Going to the web GUI and launch a Repair job
Same error appears.
The next thing I saw was that, for some reason, when launching the service, then there’s two "Duplicati.WindowsService.exe"
executables, from:
"C:\Program Files\Duplicati 2"
"C:\Program Files\Duplicati 2\updates\2.0.7.1"
meanwhile, "Duplicati.Server.exe"
is being launched from:
"C:\Program Files\Duplicati 2\updates\2.0.7.1"
I suspect one of them is locking the database. I test this by killing the one in "C:\Program Files\Duplicati 2"
(the one that is executed as a service) while letting the other one running, and indeed, now Duplicati can rebuild the database without an issue.
This seems weird to me, if the service runs the executable inside the main folder, why does it execute a “mirror” from the update folder? if that’s not wrong behaviour, why does it block access to the database?
Why is this happening?
How do I prevent this from happening again in the future? (for instance, whenever I reboot the computer, it will presumably happen again)
shouldn’t the Duplicati update be applied to the base folder instead of being in a subfolder?
Thank you for your time and assistance