Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 1.70 database migration failed #1757

Closed
2 tasks done
Krandor1 opened this issue Jul 2, 2023 · 11 comments
Closed
2 tasks done

Upgrade to 1.70 database migration failed #1757

Krandor1 opened this issue Jul 2, 2023 · 11 comments
Labels
Area: Database Issue is related to the database Area: Db-migration Warning: DB Migration | Related to DB Migration Type: External Bug A third party app broke something, GHI is open for informational purposes

Comments

@Krandor1
Copy link

Krandor1 commented Jul 2, 2023

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Current Behavior

My prowlarr instance is set to auto-update to develop. Today it updated to 1.70 tried to migrate the database and crashed. In the event it was dabase corruption, restored DB manually from the updates folder prior to the upgrade and again from the scheduled backup from 6/28. Both still failed and crashed. Reverted to 1.63 and everything was fine.

NOTE : In the logs there is a permission error mentioned. I did fix this, delete DB, restore DB from backup and try again and it failed again. reverting to 1.63 with no DB changes worked fine.

Expected Behavior

1.70 database migration to work properly

Steps To Reproduce

  1. Upgrade to 1.70 via automatic upgrade

Environment

- OS: Ubuntu 22.04 LTS
- Prowlarr: 1.7.0.3623
- Docker Install: no
- Using Reverse Proxy: no
- Browser: Chrome (not relevant here)

What branch are you running?

Develop

Trace Logs?

2023-07-02 10:30:23.4|Info|InstallUpdateService|Downloading update 1.7.0.3623
2023-07-02 10:30:32.3|Info|InstallUpdateService|Verifying update package
2023-07-02 10:30:33.4|Info|InstallUpdateService|Update package verified successfully
2023-07-02 10:30:33.4|Info|InstallUpdateService|Extracting Update package
2023-07-02 10:30:41.2|Info|InstallUpdateService|Update package extracted successfully
2023-07-02 10:30:42.1|Info|BackupService|Starting Backup
2023-07-02 10:36:01.4|Info|InstallUpdateService|Preparing client
2023-07-02 10:36:08.3|Info|InstallUpdateService|Starting update client /tmp/prowlarr_update/Prowlarr.Update
2023-07-02 10:36:08.3|Info|InstallUpdateService|Prowlarr will restart shortly.
2023-07-02 10:36:42.6|Info|Bootstrap|Starting Prowlarr - /opt/Prowlarr/Prowlarr - Version 1.7.0.3623
2023-07-02 10:36:42.8|Info|AppFolderInfo|Data directory is being overridden to [/var/lib/prowlarr]
2023-07-02 10:36:42.8|Info|AppFolderInfo|Data directory is being overridden to [/var/lib/prowlarr]
2023-07-02 10:36:43.5|Info|AppFolderInfo|Data directory is being overridden to [/var/lib/prowlarr]
2023-07-02 10:36:43.7|Error|Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider|An error occurred while reading the key ring.

[v1.7.0.3623] System.UnauthorizedAccessException: Access to the path '/var/lib/prowlarr/asp/key-9e1c8380-693d-4645-acb0-fed67dbfed76.xml' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.File.OpenRead(String path) at Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.ReadElementFromFile(String fullPath) at Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.GetAllElementsCore()+MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.GetAllElements()
at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh)

2023-07-02 10:36:44.2|Info|MigrationController|*** Migrating data source=/var/lib/prowlarr/prowlarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
2023-07-02 10:36:44.5|Info|FluentMigrator.Runner.MigrationRunner|34: history_fix_data_titles migrating
2023-07-02 10:36:44.5|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Beginning Transaction
2023-07-02 10:36:44.5|Info|history_fix_data_titles|Starting migration of Main DB to 34
2023-07-02 10:36:44.5|Info|FluentMigrator.Runner.MigrationRunner|PerformDBOperation
2023-07-02 10:36:44.5|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Performing DB Operation
2023-07-02 10:39:04.6|Error|FluentMigrator.Runner.MigrationRunner|Specified cast is not valid.

[v1.7.0.3623] System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetString(Int32 i)
at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 33
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.b__1()
at FluentMigrator.Runner.StopWatch.Time(Action action)
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)

2023-07-02 10:39:05.0|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Rolling back transaction
2023-07-02 10:39:05.0|Fatal|Microsoft.AspNetCore.Hosting.Diagnostics|Application startup exception

[v1.7.0.3623] NzbDrone.Common.Exceptions.ProwlarrStartupException: Prowlarr failed to start: Error creating main database
---> System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetString(Int32 i)
at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 33
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.b__1()
at FluentMigrator.Runner.StopWatch.Time(Action action)
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection1 expressions) at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action2 getExpressions)
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement)
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement)
at FluentMigrator.Runner.MigrationRunner.MigrateUp()
at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/Migration/Framework/MigrationController.cs:line 79
at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 115
--- End of inner exception stack trace ---
at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 161
at NzbDrone.Core.Datastore.DbFactory.Create(MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 70
at NzbDrone.Core.Datastore.DbFactory.Create(MigrationType migrationType) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 58
at NzbDrone.Core.Datastore.Extensions.CompositionExtensions.<>c.b__0_0(IDbFactory f) in ./Prowlarr.Core/Datastore/Extensions/CompositionExtensions.cs:line 10
at DryIoc.Registrator.ToFuncWithObjParams[D1,TService](Func2 f, Object d1) in /_/src/DryIoc/Container.cs:line 7977 at DryIoc.Interpreter.TryInterpretFuncInvoke(IResolverContext r, MethodCallExpression e, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3680 at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3478 at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3129 at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry1 itemRef, Object& result) in //src/DryIoc/Container.cs:line 3058
at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /
/src/DryIoc/Container.cs:line 11017
at DryIoc.Factory.GetExpressionOrDefault(Request request) in //src/DryIoc/Container.cs:line 10936
at DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args) in /
/src/DryIoc/Container.cs:line 535
at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args) in //src/DryIoc/Container.cs:line 463
at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /
/src/DryIoc/Container.cs:line 3614
at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in //src/DryIoc/Container.cs:line 3141
at DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs) in /
/src/DryIoc/Container.cs:line 3424
at DryIoc.Interpreter.<>c__DisplayClass5_0.b__0() in /_/src/DryIoc/Container.cs:line 3323
at DryIoc.Interpreter.<>c__DisplayClass9_01.<ConvertFunc>b__0() in /_/src/DryIoc/Container.cs:line 3434 at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at System.Lazy1.get_Value() at NzbDrone.Host.Startup.Configure(IApplicationBuilder app, IStartupContext startupContext, Lazy1 mainDatabaseFactory, Lazy1 logDatabaseFactory, DatabaseTarget dbTarget, ISingleInstancePolicy singleInstancePolicy, InitializeLogger initializeLogger, ReconfigureLogging reconfigureLogging, IAppFolderFactory appFolderFactory, IProvidePidFile pidFileProvider, IConfigFileProvider configFileProvider, IRuntimeInfo runtimeInfo, IFirewallAdapter firewallAdapter, IEventAggregator eventAggregator, ProwlarrErrorPipeline errorHandler) in ./Prowlarr.Host/Startup.cs:line 235 at System.RuntimeMethodHandle.InvokeMethod(Object target, Span1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)

2023-07-02 10:39:05.2|Fatal|ConsoleApp|EPIC FAIL!

[v1.7.0.3623] NzbDrone.Common.Exceptions.ProwlarrStartupException: Prowlarr failed to start: Error creating main database
---> System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetString(Int32 i)
at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 33
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.b__1()
at FluentMigrator.Runner.StopWatch.Time(Action action)
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection1 expressions) at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action2 getExpressions)
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement)
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement)
at FluentMigrator.Runner.MigrationRunner.MigrateUp()
at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/Migration/Framework/MigrationController.cs:line 79
at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 115
--- End of inner exception stack trace ---
at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 161
at NzbDrone.Core.Datastore.DbFactory.Create(MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 70
at NzbDrone.Core.Datastore.DbFactory.Create(MigrationType migrationType) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 58
at NzbDrone.Core.Datastore.Extensions.CompositionExtensions.<>c.b__0_0(IDbFactory f) in ./Prowlarr.Core/Datastore/Extensions/CompositionExtensions.cs:line 10
at DryIoc.Registrator.ToFuncWithObjParams[D1,TService](Func2 f, Object d1) in /_/src/DryIoc/Container.cs:line 7977 at DryIoc.Interpreter.TryInterpretFuncInvoke(IResolverContext r, MethodCallExpression e, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3680 at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3478 at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3129 at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry1 itemRef, Object& result) in //src/DryIoc/Container.cs:line 3058
at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /
/src/DryIoc/Container.cs:line 11017
at DryIoc.Factory.GetExpressionOrDefault(Request request) in //src/DryIoc/Container.cs:line 10936
at DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args) in /
/src/DryIoc/Container.cs:line 535
at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args) in //src/DryIoc/Container.cs:line 463
at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /
/src/DryIoc/Container.cs:line 3614
at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in //src/DryIoc/Container.cs:line 3141
at DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs) in /
/src/DryIoc/Container.cs:line 3424
at DryIoc.Interpreter.<>c__DisplayClass5_0.b__0() in /_/src/DryIoc/Container.cs:line 3323
at DryIoc.Interpreter.<>c__DisplayClass9_01.<ConvertFunc>b__0() in /_/src/DryIoc/Container.cs:line 3434 at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at System.Lazy1.get_Value() at NzbDrone.Host.Startup.Configure(IApplicationBuilder app, IStartupContext startupContext, Lazy1 mainDatabaseFactory, Lazy1 logDatabaseFactory, DatabaseTarget dbTarget, ISingleInstancePolicy singleInstancePolicy, InitializeLogger initializeLogger, ReconfigureLogging reconfigureLogging, IAppFolderFactory appFolderFactory, IProvidePidFile pidFileProvider, IConfigFileProvider configFileProvider, IRuntimeInfo runtimeInfo, IFirewallAdapter firewallAdapter, IEventAggregator eventAggregator, ProwlarrErrorPipeline errorHandler) in ./Prowlarr.Host/Startup.cs:line 235 at System.RuntimeMethodHandle.InvokeMethod(Object target, Span1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at NzbDrone.Host.Bootstrap.Start(String[] args, Action`1 trayCallback) in ./Prowlarr.Host/Bootstrap.cs:line 79
at NzbDrone.Console.ConsoleApp.Main(String[] args) in ./Prowlarr.Console/ConsoleApp.cs:line 43

Trace Logs have been provided as applicable. Reports may be closed if the required logs are not provided.

  • I have read and followed the steps in the wiki link above and provided the required trace logs - the logs contain trace - that are relevant and show this issue.
@Krandor1 Krandor1 added Status: Needs Triage New Issue needing triage Type: Bug Issue is a bug labels Jul 2, 2023
@Krandor1
Copy link
Author

Krandor1 commented Jul 2, 2023

This looks to be to be the main place of the issue in the logs I have.

2023-07-02 10:36:44.2|Info|MigrationController|*** Migrating data source=/var/lib/prowlarr/prowlarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
2023-07-02 10:36:44.5|Info|FluentMigrator.Runner.MigrationRunner|34: history_fix_data_titles migrating
2023-07-02 10:36:44.5|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Beginning Transaction
2023-07-02 10:36:44.5|Info|history_fix_data_titles|Starting migration of Main DB to 34
2023-07-02 10:36:44.5|Info|FluentMigrator.Runner.MigrationRunner|PerformDBOperation
2023-07-02 10:36:44.5|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Performing DB Operation
2023-07-02 10:39:04.6|Error|FluentMigrator.Runner.MigrationRunner|Specified cast is not valid.

[v1.7.0.3623] System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)

@mynameisbogdan
Copy link
Contributor

Your history is broken somewhere. Delete all history before updating again.

@bakerboy448 bakerboy448 added Area: Database Issue is related to the database Area: Db-migration Warning: DB Migration | Related to DB Migration labels Jul 3, 2023
@mynameisbogdan
Copy link
Contributor

@Krandor1 I'll need some info from you.

If you're on linux go to your config directory or even by using a backup, run sqlite3 prowlarr.db in the directory with the prowlarr.db file. Type .schema History and provide the output here. To exit sqlite cli type .quit.

@mynameisbogdan mynameisbogdan added the Status: Waiting for OP Action Required from OP label Jul 3, 2023
@mynameisbogdan
Copy link
Contributor

And you'll have to fix this as well:

2023-07-02 10:36:43.7|Error|Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider|An error occurred while reading the key ring.

[v1.7.0.3623] System.UnauthorizedAccessException: Access to the path '/var/lib/prowlarr/asp/key-9e1c8380-693d-4645-acb0-fed67dbfed76.xml' is denied.
---> System.IO.IOException: Permission denied

@Krandor1
Copy link
Author

Krandor1 commented Jul 3, 2023

the "Access to the path '/var/lib/prowlarr/asp/key-9e1c8380-693d-4645-acb0-fed67dbfed76.xml'" thing I did fix and then restored db from backup and ran it again and the same errors below still occurred..

I will past the history stuff in shortly.

@mynameisbogdan
Copy link
Contributor

mynameisbogdan commented Jul 3, 2023

While you're doing that, also tell me the sqlite version shown in System > Status.

@Qstick
Copy link
Contributor

Qstick commented Jul 3, 2023

@Krandor1 if you could join Discord that may be helpful. We would like to get to the bottom of this and may need some additional info from you on your DB

https://prowlarr.com/discord

@mynameisbogdan
Copy link
Contributor

@Krandor1 any news?

@mynameisbogdan mynameisbogdan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2023
@zx900930
Copy link

Have the same problem during the migrations to version 1.7.4.3769
trace logs:

[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support the app dev(s) visit:
Prowlarr: https://opencollective.com/prowlarr
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
[custom-init] No custom files found, skipping...
[Info] Bootstrap: Starting Prowlarr - /app/prowlarr/bin/Prowlarr - Version 1.7.4.3769 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Debug] Bootstrap: Console selected 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] MigrationController: *** Migrating data source=/config/prowlarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 *** 
[Info] FluentMigrator.Runner.MigrationRunner: 34: history_fix_data_titles migrating 
[Info] NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor: Beginning Transaction 
[Info] history_fix_data_titles: Starting migration of Main DB to 34 
[Info] FluentMigrator.Runner.MigrationRunner: PerformDBOperation  
[Info] NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor: Performing DB Operation 
[Error] FluentMigrator.Runner.MigrationRunner: database disk image is malformed
database disk image is malformed 
[v1.7.4.3769] code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed
database disk image is malformed
   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 28
   at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
   at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
   at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1()
   at FluentMigrator.Runner.StopWatch.Time(Action action)
   at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)
[Info] NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor: Rolling back transaction 
[Fatal] Microsoft.AspNetCore.Hosting.Diagnostics: Application startup exception 
[v1.7.4.3769] NzbDrone.Core.Datastore.CorruptDatabaseException: Prowlarr failed to start: Database file: code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed
database disk image is malformed
   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 28
   at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
   at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
   at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1()
   at FluentMigrator.Runner.StopWatch.Time(Action action)
   at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)
   at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action`2 getExpressions)
   at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp()
   at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/Migration/Framework/MigrationController.cs:line 79
   at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 115 is corrupt, restore from backup if available. See: https://wiki.servarr.com/prowlarr/faq#i-am-getting-an-error-database-disk-image-is-malformed
   at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 126
   at NzbDrone.Core.Datastore.DbFactory.Create(MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 70
   at NzbDrone.Core.Datastore.DbFactory.Create(MigrationType migrationType) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 58
   at NzbDrone.Core.Datastore.Extensions.CompositionExtensions.<>c.<AddDatabase>b__0_0(IDbFactory f) in ./Prowlarr.Core/Datastore/Extensions/CompositionExtensions.cs:line 10
   at DryIoc.Registrator.ToFuncWithObjParams[D1,TService](Func`2 f, Object d1) in /_/src/DryIoc/Container.cs:line 7977
   at DryIoc.Interpreter.TryInterpretFuncInvoke(IResolverContext r, MethodCallExpression e, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3680
   at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3478
   at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3129
   at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry`1 itemRef, Object& result) in /_/src/DryIoc/Container.cs:line 3058
   at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /_/src/DryIoc/Container.cs:line 11017
   at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 10936
   at DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args) in /_/src/DryIoc/Container.cs:line 535
   at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args) in /_/src/DryIoc/Container.cs:line 463
   at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3614
   at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3141
   at DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs) in /_/src/DryIoc/Container.cs:line 3424
   at DryIoc.Interpreter.<>c__DisplayClass5_0.<TryInterpretNestedLambda>b__0() in /_/src/DryIoc/Container.cs:line 3323
   at DryIoc.Interpreter.<>c__DisplayClass9_0`1.<ConvertFunc>b__0() in /_/src/DryIoc/Container.cs:line 3434
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at NzbDrone.Host.Startup.Configure(IApplicationBuilder app, IStartupContext startupContext, Lazy`1 mainDatabaseFactory, Lazy`1 logDatabaseFactory, DatabaseTarget dbTarget, ISingleInstancePolicy singleInstancePolicy, InitializeLogger initializeLogger, ReconfigureLogging reconfigureLogging, IAppFolderFactory appFolderFactory, IProvidePidFile pidFileProvider, IConfigFileProvider configFileProvider, IRuntimeInfo runtimeInfo, IFirewallAdapter firewallAdapter, IEventAggregator eventAggregator, ProwlarrErrorPipeline errorHandler) in ./Prowlarr.Host/Startup.cs:line 235
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
[Fatal] ConsoleApp: EPIC FAIL! 
[v1.7.4.3769] NzbDrone.Core.Datastore.CorruptDatabaseException: Prowlarr failed to start: Database file: code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed
database disk image is malformed
   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NzbDrone.Core.Datastore.Migration.history_fix_data_titles.MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran) in ./Prowlarr.Core/Datastore/Migration/034_history_fix_data_titles.cs:line 28
   at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(PerformDBOperationExpression expression)
   at FluentMigrator.Expressions.PerformDBOperationExpression.ExecuteWith(IMigrationProcessor processor)
   at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1()
   at FluentMigrator.Runner.StopWatch.Time(Action action)
   at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)
   at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action`2 getExpressions)
   at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement)
   at FluentMigrator.Runner.MigrationRunner.MigrateUp()
   at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/Migration/Framework/MigrationController.cs:line 79
   at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 115 is corrupt, restore from backup if available. See: https://wiki.servarr.com/prowlarr/faq#i-am-getting-an-error-database-disk-image-is-malformed
   at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 126
   at NzbDrone.Core.Datastore.DbFactory.Create(MigrationContext migrationContext) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 70
   at NzbDrone.Core.Datastore.DbFactory.Create(MigrationType migrationType) in ./Prowlarr.Core/Datastore/DbFactory.cs:line 58
   at NzbDrone.Core.Datastore.Extensions.CompositionExtensions.<>c.<AddDatabase>b__0_0(IDbFactory f) in ./Prowlarr.Core/Datastore/Extensions/CompositionExtensions.cs:line 10
   at DryIoc.Registrator.ToFuncWithObjParams[D1,TService](Func`2 f, Object d1) in /_/src/DryIoc/Container.cs:line 7977
   at DryIoc.Interpreter.TryInterpretFuncInvoke(IResolverContext r, MethodCallExpression e, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3680
   at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3478
   at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3129
   at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry`1 itemRef, Object& result) in /_/src/DryIoc/Container.cs:line 3058
   at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /_/src/DryIoc/Container.cs:line 11017
   at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 10936
   at DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args) in /_/src/DryIoc/Container.cs:line 535
   at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args) in /_/src/DryIoc/Container.cs:line 463
   at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3614
   at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /_/src/DryIoc/Container.cs:line 3141
   at DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs) in /_/src/DryIoc/Container.cs:line 3424
   at DryIoc.Interpreter.<>c__DisplayClass5_0.<TryInterpretNestedLambda>b__0() in /_/src/DryIoc/Container.cs:line 3323
   at DryIoc.Interpreter.<>c__DisplayClass9_0`1.<ConvertFunc>b__0() in /_/src/DryIoc/Container.cs:line 3434
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at NzbDrone.Host.Startup.Configure(IApplicationBuilder app, IStartupContext startupContext, Lazy`1 mainDatabaseFactory, Lazy`1 logDatabaseFactory, DatabaseTarget dbTarget, ISingleInstancePolicy singleInstancePolicy, InitializeLogger initializeLogger, ReconfigureLogging reconfigureLogging, IAppFolderFactory appFolderFactory, IProvidePidFile pidFileProvider, IConfigFileProvider configFileProvider, IRuntimeInfo runtimeInfo, IFirewallAdapter firewallAdapter, IEventAggregator eventAggregator, ProwlarrErrorPipeline errorHandler) in ./Prowlarr.Host/Startup.cs:line 235
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at NzbDrone.Host.Bootstrap.Start(String[] args, Action`1 trayCallback) in ./Prowlarr.Host/Bootstrap.cs:line 79
   at NzbDrone.Console.ConsoleApp.Main(String[] args) in ./Prowlarr.Console/ConsoleApp.cs:line 43
Press enter to exit...
Non-recoverable failure, waiting for user intervention...

And I found the History table are full of null values.
image

and drop the History table return SQLite Database Disk Image is Malformed error.

I have to:

  1. Export the old database without History table.
  2. Delete the old database and recreate a new one.
  3. Import the backup with a empty History table:
    CREATE TABLE "History" ("Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "IndexerId" INTEGER NOT NULL, "Date" DATETIME NOT NULL, "Data" TEXT NOT NULL, "EventType" INTEGER, "DownloadId" TEXT, "Successful" INTEGER NOT NULL DEFAULT 1);

In order to make it work again.

@mynameisbogdan
Copy link
Contributor

I managed to recover from a corrupted db using these sqlite commands.

sqlite> delete from history;
sqlite> delete from commands;
sqlite> VACUUM;
sqlite> .recover
sqlite> VACUUM;
sqlite> .quit

@mynameisbogdan mynameisbogdan pinned this issue Jul 27, 2023
@bakerboy448 bakerboy448 removed Status: Waiting for OP Action Required from OP Status: Needs Triage New Issue needing triage labels Jul 27, 2023
@mynameisbogdan mynameisbogdan added the Type: External Bug A third party app broke something, GHI is open for informational purposes label Jul 27, 2023
@bakerboy448 bakerboy448 removed the Type: Bug Issue is a bug label Jul 27, 2023
@uvejota
Copy link

uvejota commented Aug 1, 2023

The previous commands did not work for me, but I managed to fix it by following the recommendations in stackoverflow:

$ sqlite3 prowlarr.db ".recover" |  sqlite3 new.db
$ mv prowlarr.db prowlarr.bck
$ mv new.db prowlarr.db

And then restarting the service/container.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Database Issue is related to the database Area: Db-migration Warning: DB Migration | Related to DB Migration Type: External Bug A third party app broke something, GHI is open for informational purposes
Projects
None yet
Development

No branches or pull requests

6 participants