FreeNAS Migration from Plugin Jail to Docker

I just upgraded my FreeNAS installation from 9.10 to Corral. Part of this migration is their removal for support of plugins or jails. I am attempting to restore a backup from my plugin jail to a new container, but after copying over the nzbdrone.db and config files the website refused to load. The initial creation of the container does work and loads a fresh copy of Sonarr.

[v2.0.0.4645] NzbDrone.Core.Datastore.CorruptDatabaseException: Database file: /config/nzbdrone.db is corrupt, restore from backup if available. See: https://github.com/Sonarr/Sonarr/wiki/FAQ#
i-am-getting-an-error-database-disk-image-is-malformed —> System.Data.SQLite.SQLiteException: file is encrypted or is not a database
file is encrypted or is not a database
at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, UInt32 timeoutMS, System.String& strRemain)
<0x41b17000 + 0x00cc3> in :0
at System.Data.SQLite.SQLiteCommand.BuildNextCommand () <0x41b067b0 + 0x00239> in :0
— End of inner exception stack trace —
at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x00121] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core
\Datastore\DbFactory.cs:116
at NzbDrone.Core.Datastore.DbFactory.Create (MigrationType migrationType) [0x00000] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core\Datastore\DbFactory.cs:56
at NzbDrone.Core.Datastore.DbFactory.RegisterDatabase (IContainer container) [0x00000] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core\Datastore\DbFactory.cs:36
at NzbDrone.Host.Bootstrap.Start (ApplicationModes applicationModes, NzbDrone.Common.EnvironmentInfo.StartupContext startupContext) [0x0003d] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDr
one.Host\Bootstrap.cs:73
at NzbDrone.Host.Bootstrap.Start (NzbDrone.Common.EnvironmentInfo.StartupContext startupContext, IUserAlert userAlert, System.Action`1 startCallback) [0x00075] in M:\BuildAgent\work\b69c1fe1
9bfc2c38\src\NzbDrone.Host\Bootstrap.cs:40
at NzbDrone.Console.ConsoleApp.Main (System.String[] args) [0x0000e] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Console\ConsoleApp.cs:20

I think what is going on is that I am having issues getting Sonarr to shutdown in the container. Shutting down at the website is not working, nor is killing the PID (it just restarts).

Any help would be greatly appreciated.

I am convinced that the DB is being corrupted because I can’t stop the service. If I delete my restored DB, a new DB is instantly created and Sonarr is back to it’s out of box experience.

It’s because you’re not following proper backup&restore procedures, you’re not copying the database, just one part of it. See https://github.com/Sonarr/Sonarr/wiki/Backup-and-Restore

I have followed this. In the docker container, I am having issues shutting down Sonarr. When running ps -aux I see the mono process, and if I kill the process, it instantly restarts. If I try to shutdown Sonarr from the web GUI, it immediately restarts. I need to know how to kill the Sonarr process in the Docker container.

The container is doing what is supposed to. You should mount the config file outside of the container and then you can stop the container, restore the database and then start the container again. Storing it outside the container also means it will persist the data if you need to rebuild the container.

Perfect, this is exactly what I needed and Sonarr is now working. Thank you!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.