Jump to content

Users db file corrupted


Recommended Posts

karldonteljames
Posted

Evening All,

Everytime there is an update recently emby refuses to work. I have to launch it from a restored shadow copy. The worst thing about this is that my library is HUGE, and even though i am using the backup/restore plugin and restore yesterdays configuration, it still scans the entire library again. WHY? surely if it is backing up, a restore should restore the config and the library to the state it was in yesterday. it takes around 20 hours to scan my library, but this also screws "newly added" as it scans the folders so that everything is new.

 

I've been using emby for years, and finally managed to save the money to become a supporter at Christmas, and I've had problems with every update since.

 

Can someone please help me get to the bottom of this.

 

Posted

Hi @@karldonteljames, I apologize for the issue. We are looking into it and it appears to only be affecting a small subset of users. We will be issuing a fix but you will need to run the library scan. Thanks.

karldonteljames
Posted (edited)

I'm unable to even get the emby service to start now.

 

This is my log file.

 

2018-02-28 21:40:20.846 Info Main: Application path: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system\EmbyServer.dll
2018-02-28 21:40:20.849 Info Main: Emby
Command line: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system\EmbyServer.dll
Operating system: Microsoft Windows NT 6.1.7601 Service Pack 1
64-Bit OS: True
64-Bit Process: True
User Interactive: True
Processor count: 12
Program data path: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\programdata
Application directory: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system
2018-02-28 21:40:20.982 Info Main: Tray icon path: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system\electron\embytray
2018-02-28 21:40:21.002 Info App: Application version: 3.3.0.0
2018-02-28 21:40:21.003 Info App: Loading assemblies
2018-02-28 21:40:21.015 Info App: Loading MBBackup, Version=1.1.9.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Channels.BlurN, Version=2.0.1.8, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Plugins.TuneIn, Version=1.1.9.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading statistics, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Surveillance, Version=1.0.0.5, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.WebDashboard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Controller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Photos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Server.Implementations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Server.MediaEncoding, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Dlna, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.LocalMetadata, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading MediaBrowser.XbmcMetadata, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Server.CinemaMode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Server.Connect, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.015 Info App: Loading Emby.Server.Sync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2018-02-28 21:40:21.133 Info SqliteUserRepository: Sqlite version: 3.22.0
2018-02-28 21:40:21.133 Info SqliteUserRepository: Sqlite compiler options: COMPILER=msvc-1500,ENABLE_COLUMN_METADATA,ENABLE_DBSTAT_VTAB,ENABLE_FTS3,ENABLE_FTS4,ENABLE_FTS5,ENABLE_JSON1,ENABLE_RTREE,MAX_TRIGGER_DEPTH=100,TEMP_STORE=1,THREADSAFE=1
2018-02-28 21:40:21.172 Error Main: UnhandledException
*** Error Report ***
Version: 3.3.0.0
Command line: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system\EmbyServer.dll
Operating system: Microsoft Windows NT 6.1.7601 Service Pack 1
64-Bit OS: True
64-Bit Process: True
User Interactive: True
Processor count: 12
Program data path: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\programdata
Application directory: C:\Users\woodsfamily\AppData\Roaming\Emby-Server\system
Corrupt: database disk image is malformed
SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
   at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, String& tail)
   at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.CreateConnection(Boolean isReadOnly)
   at Emby.Server.Implementations.Data.SqliteUserRepository.Initialize()
   at Emby.Server.Implementations.ApplicationHost.GetUserRepository()
   at Emby.Server.Implementations.ApplicationHost.RegisterResources()
   at Emby.Server.Implementations.ApplicationHost.Init()
   at EmbyServer.Program.RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, IEnvironmentInfo environmentInfo, StartupOptions options)
   at EmbyServer.Program.Main(String[] args)
SQLitePCL.pretty.SQLiteException
   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
   at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, String& tail)
   at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.CreateConnection(Boolean isReadOnly)
   at Emby.Server.Implementations.Data.SqliteUserRepository.Initialize()
   at Emby.Server.Implementations.ApplicationHost.GetUserRepository()
   at Emby.Server.Implementations.ApplicationHost.RegisterResources()
   at Emby.Server.Implementations.ApplicationHost.Init()
   at EmbyServer.Program.RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, IEnvironmentInfo environmentInfo, StartupOptions options)
   at EmbyServer.Program.Main(String[] args)
Edited by karldonteljames
Posted

What happens when you try to start it?

karldonteljames
Posted

The tray icon appears then disappears. if i try and start it as a service i gett he message: 

 

Error 1053: The service did not respond to the start or control request in a timely fashion.

Posted

Ok so maybe your issue is isolated here and not related to what I mentioned that we are looking into. 

 

Based on your log it appears you have a corrupted user database file, and you will need to rename this file:

C:\Users\woodsfamily\AppData\Roaming\Emby-Server\programdata\data\users.db

This is going to wipe out your users, but since you've been taking backups you can use the backup plugin to restore them.

 

As far as why this would happen, it is generally due to a sudden and abrupt  termination of the server process in the middle of an operation. Examples of that would be a power loss, abruptly turning off the machine, or abruptly killing the server process using windows task manager.

karldonteljames
Posted

so I've deleted the user DB file, and emby is now running. I've open the plugin backup/restore, and it only shows me the last five backups (which have been in the last hour trying to fix this.) It is set to retain the last 120 backups, how can i restore yesterdays backup? Also, how do i know when the restore is complete?

Posted

Just click on the latest backup and it will take you to a screen where you can choose what to restore. I would uncheck everything except for the users.

 

Then click Restore. You'll know when it's done because it will tell you that the server needs to restart.

karldonteljames
Posted

I've managed to restore my users, and using Volume shadow copy, I've restored the library.db from yesterday, and it has restored my library. Upon restoring all of the users, it doesn't seem to have restored their pictures, can this be rectified? or does each user need to re-add their picture?

 

Thanks.

 

Karl

karldonteljames
Posted

Thank you for your help this evening. Is it possible to have the backup restore plugin take a copy of the library.db file so that when a restore happens the library state is kept at all?

 

Off topic, but how do I remove cameras from the surveillance plugin?

 

If I click the recycle bin icon, the next time the page loads it is there again. Thanks for your help this evening.

Posted

Thank you for your help this evening. Is it possible to have the backup restore plugin take a copy of the library.db file so that when a restore happens the library state is kept at all?

 

It doesn't do this because the backups could get extremely large. But it is always something that could be considered for the future.

Posted

 

 

Off topic, but how do I remove cameras from the surveillance plugin?

 

I don't know the answer to this as I've never used the plugin, you may want to ask the developer @@chef.

karldonteljames
Posted

Thanks. Having the library file backup as an option I think would be a great idea. or have it so just backs up the library file once a week. - Anyway thanks again.

Can I restore the user images? It looks like they are in the folder C:\Users\woodsfamily\AppData\Roaming\Emby-Server\programdata\config\users (in seperate folders as "folder.jpg") but not being picked up by emby.

 

Thanks. 

Posted

It doesn't do this because the backups could get extremely large. But it is always something that could be considered for the future.

 

It also would potentially make back-ups incompatible with new versions.  The way the backup plugin works it is independent of any database structure changes that may occur in the system.

 

Therefore, I don't think this would really be a good idea.

  • Like 1
karldonteljames
Posted

It also would potentially make back-ups incompatible with new versions.  The way the backup plugin works it is independent of any database structure changes that may occur in the system.

 

Therefore, I don't think this would really be a good idea.

 

That is a shame, The biggest issue I have is when the entire library needs a rebuild and my latest media is media I added five / six years ago. It's very frustrating. I restored my library file from a shadow copy and kicked off a library scan, now it is showing "no items" in all my libraries. surely a backup and restore should put it back to the point it was at, and not slightly like it? 

 

would it not be possible to have emby "live convert" any existing library when an update is completed? i.e. 

  • "library3.3.0.0"
  • "library.3.2.7.0"

or is that not possible? it seems a shame to 'lose' an entire library because an update didn't quite work. 

 

My library consists of around 22000 episodes and around 2000 Movies, so it takes a while to scan, and leaves me without access for a while.

 

Thanks again for your help luke, and if i can, I'm happy to try and help with developments where I can but I'm an IT manager in a school, not a programmer.

 

@@chef, Thanks, I'll keep an eye out for the update.

Posted

The backup plugin is designed to back up the server configuration (hence the name :)).  Not metadata nor library content nor even your library data.  If you wish to take snapshot backups there are plenty of tools available to do that.  You could even just have a full backup of the entire emby-server folder if you wish.

 

If you save metadata with your media, these rebuilds can be much faster usually but, of course, it is unfortunate that a rebuild is necessary at all.

karldonteljames
Posted

I'll start taking backups of the emby server folder.

My images and metadata is already stored in the media folder, and I currently backup the metadata folder, is there any point in doing this, as it looks like emby creates new id's for each item it finds.

 

Is there a way to "clear orphaned data" from the cache and metadata folder?

 

@@chef the update that applied this morning allowed me to remove the test cameras I had connected. Thanks.

karldonteljames
Posted

I guess I have to log in to each account to restore the account pictures is that correct, no way of doing it from server manager?

Posted

I guess I have to log in to each account to restore the account pictures is that correct, no way of doing it from server manager?

 

In the user page in the dashboard on each user there is a link at the top that says "Edit this users profile image and personal preferences".  Click that.

moviefan
Posted (edited)

The biggest issue I have is when the entire library needs a rebuild and my latest media is media I added five / six years ago. It's very frustrating. I restored my library file from a shadow copy and kicked off a library scan, now it is showing "no items" in all my libraries. surely a backup and restore should put it back to the point it was at, and not slightly like it? 

 

I just noticed the date added on all my movies is updated to yesterday now as well.

 

Why would it overwrite the date added value in the local XML?

 

EDIT:  Nevermind, I think what has happened is that the XML plugin has been updated to a version that's no longer compatible with the .27 version I downgraded back to after my DB was wiped.  Local XML still contains the correct values, but I don't think it's being read.

Edited by moviefan
Posted

I just noticed the date added on all my movies is updated to yesterday now as well.

 

What is your setting for the treatment of date added set to?  Library->Advanced

moviefan
Posted

It looks like the first 20 hour scan yesterday didn't quite work.

 

I did another Scan Media Library task and it is taking a long time again.  Probably just didn't grab all the dates yet.

moviefan
Posted

Okay so now I did a full scan.  Uninstalled and reinstalled the XML plugin several times with different versions.  Multiple full rescans.  And many items still show a date added which is different than the one contained in the movie.xml file.

 

Any thoughts?

karldonteljames
Posted

Thanks. User pictures are now all sorted.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...