Addons disappear when loaded from NAS


#1

I currently have to reboot my Pi on a daily basis as all addons keep disappearing. This summer has been horrible for the sd-cards in the Pi with a lot of power outages causing me to move the entire ~/.kodidirectory to my NAS. Everything has been working great, until recently when all addons started disappearing at a regular basis.

//10.1.1.9/homes/osmc/kodi   /home/osmc/.kodi   cifs   vers=1.0,hard,credentials=/home/osmc/.credentials,iocharset=utf8,sec=ntlm,noperm,x-systemd.automount,noauto 0 0

I suspect this has to do with the drive in the NAS going to sleep (which is why I tried adding the hard mount option to no avail) and Kodi/OSMC being impatient when scanning the addons. Lines like this come in big batches in the log:

19:48:24.791 T:1290793728   ERROR: SQL: [Addons27.db] Some kind of disk I/O error occurred
                                        Query: SELECT * FROM installed
19:48:24.791 T:1290793728   ERROR: GetInstalled failed
19:48:24.795 T:1290793728   ERROR: SQL: [Addons27.db] Some kind of disk I/O error occurred
                                        Query: SELECT * FROM installed
19:48:24.795 T:1290793728   ERROR: GetInstalled failed
19:48:24.800 T:1290793728   ERROR: SQL: [Addons27.db] Some kind of disk I/O error occurred
                                        Query: SELECT * FROM installed
19:48:24.800 T:1290793728   ERROR: GetInstalled failed

Any ideas for a solution or workaround? Everything else mounted in the same way from the same NAS is working.


#2

Using CIFS will probably give you permission problems.

However, here the issue is that SQLite requires that the underlying filesystem implements locking correctly. I do not believe you have this guarantee with CIFS. This will mean that the queries are no longer ACID compliant.


#3

Ah that kinda makes sense. I haven’t had any problems with permissions tho, which is the reason why I’m using CIFS over NFS (which sent OSMC it into a bootloop.) The other databases are in MySQL on the NAS as well, configured in advancedsettings.xml. Is there any way to have all databases in MySQL, or to override the location of the Addons#.db file to be outside of the ~/.kodi directory? Or better to give NFS another go? :slight_smile:


#4

You can start using symlinks. But a good quality SD card shouldn’t be failing. I’d suspect a problematic power supply if this keeps happening


#5

I have mostly Sandisk cards if I’m not mistaken, and the power supply should be good. If anything the USB cable from the supply to the Pi might be the weak link, I’ve been planning to replace that one for a while now. I will try symlinking the databases back onto the SD card, fingers crossed :slight_smile:

Thanks for the quick and helpful response :slight_smile:


#6

If the root cause of your problem is that the NAS disks are hibernating, you’re unlikely to fix this with a symlink.


#7

Nothing else is causing issues, including the kodi.log that I can tail via the mount on my laptop. The only thing that is problematic is the Addons#.db file. I will try to move the Database dir to say ~/.kodidata and symlink it to ~/.kodi/userdata/Database. Or do you have a better idea?

It seems Kodi tries reading the addon list quite a few times and then give up, before the disks have had time to spin back up. Hopefully symlinking the directory will make the locking work and resolve the issue. Not sure why it has to be re-read all the time, but I’ll give the symlink idea a shot and hope for the best :slight_smile:


#8

I never fully understood why you only moved ~/.kodi to the NAS, since if the NAS is protected by a UPS (and the Pi isn’t), I’d have thought moving the whole root file system, using nfsroot, would have made more sense.

As a Plan B, and if the NAS allows it, you’d do a lot better if MySQL ran on the NAS.

Good luck with your symlinking. :slight_smile:


#9

I have MySQL running on the NAS, and it is already used for the video and audio library :slight_smile: I would prefer having all the databases in MySQL, but that doesn’t seem to be a possibility at this time (I asked about it earlier in this thread). The reason for just moving ~/.kodi over was because the primary goal was to let me quickly get a clean setup back on track without having to reconfigure everything if the card failed again, and also to reduce the write-related wear on the card (from logs and cache etc). That said, I agree that nfsroot probably is a better option, and I’m going to look into it further. Thanks for the tip!

I did however move the databases back to the SD and symlinked the directory which fixed the issue with the addons. I also swapped the power supply, which got rid of the occasional undervoltage warnings :slight_smile:

Again, thank you for the help! :slight_smile:


#10

Looking at the Kodi documentation here, it says:

Please Note: Don’t create the MySQL databases on your server . Simply set up the MySQL server itself, as Kodi will create the specific databases by itself.

And just to be clear, since MySQL is running on your NAS, it will normally create the database files on the NAS, not on the Pi. The database files in .kodi/userdata/Database are normally sqlite files and are not used by MySQL. Kodi will only use MySQL if MySQL has been defined in advancedsettings.xml.


#11

That’s exactly the setup I am using :slight_smile: Addons#.db and a few others are still created in the .kodi/userdata/Database directory however. I guess that’s because they are unique to each client while the media library can be shared. It would still be neat to have the option to be able to have all databases in MySQL tho :slight_smile: