v21 Automatic update broke shared library and is unable to play videos
#1
Setup: Nokia Streaming Box Lan connected
MariaDB container running Synology. Advancedsettings.xml and sources.xml present.

Today Kodi in my Nokia Streaming Box 8010 updated to Omega. Had the database migration screen. After that my library was empty. Went to files section where still all the added folders were visible. Changed the content, however no scan starts. When looking 'set content' nothing changed. Exiting Kodi and starting Kodi same results. Even worse, trying to open a video results in a return to home page of the Nokia box.

Uninstalled Kodi and start again. Was able to build the library. After that, copied the advanced.xml to Kodi. Library gone and unable to build. So v21 is unable to work with my advancedsettings.xml to build the library externally which have worked for me for
years. What has changed in v21 and needs to be done to fix this? Below my xml file.

<advancedsettings>
   <videodatabase>
       <type>mysql</type>
       <host>My Synology IP</host>
       <port>3306</port>
       <user>kodi</user>
       <pass>password for mariadb</pass>
      <name>kodi1_Video</name>    
    </videodatabase>
    
    <musicdatabase>
       <type>mysql</type>
       <host>My synology IP</host>
       <port>3306</port>
       <user>kodi</user>
       <pass>password for mariadb</pass>
      <name>kodi1_Music</name>
    </musicdatabase>
<videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>
Kodi v20.1,Nokia Streaming BOX 8000 & 8010 , Synology DS920+, Polestar 2. Amsterdam, Netherlands
Reply
#2
I had the same problem:
Library in MySQL DB connected via advancedsettings.xml, media lies on SMB share, Nvidia Shield TV Android box, after auto update yesterday from v20 to v21 Kodi was broken. Library was empty, starting playback on a manually selected file instantly crashed Kodi. The log doesn't contain anything about the crash but there were many lines with database errors that suggest Kodi couldn't migrate the database to the new version. I checked with MySQL Workbench and the tables with the new version are present and filled with data but I suspected the database update didn't complete, like also mentioned by another user in this thread. The new databases myvideos131 and mymusic83 didn't contain any views.

Here's what I did to fix this:
I deleted the new databases myvideos131 and mymusic83, installed Kodi 20 on my Windows machine, launch once and close again so that the user folders are created (c:\users\username\appdata\roaming\kodi), copied advancedsettings.xml, sources.xml and mediasources.xml from my Shield Box to my userdata folder on the Windows machine, launch Kodi again and check if you have your video library and if playback works. As a precaution I did a maual library export as separate files in Kodi, just in case I would have to go the route to delete the whole database. After that update Kodi on Windows to v21, launch, Database was migrated successfully, everything worked on the Shield TV again without changing a single thing on the Shield. It was just the faulty database migration.

As mentioned in the other thread: after the Kodi update on the Shield the new databases were missing the views. After my described steps above and updating Kodi on Windows the new databases had the views. So I suspect the database migration script in the Android build might be buggy.
Reply
#3
Interesting. I'll try this tomorrow. For the time being I installed 20.5. I'll post the results.
Kodi v20.1,Nokia Streaming BOX 8000 & 8010 , Synology DS920+, Polestar 2. Amsterdam, Netherlands
Reply
#4
@TyKH
can you please try to run mysql_upgrade before the migration attempt?

Code:
/ # mysql_upgrade
This installation of MariaDB is already upgraded to 10.11.4-MariaDB.
There is no need to run mysql_upgrade again for 10.11.6-MariaDB.
You can use --force if you still want to run mysql_upgrade
/ #

i just had a succesful migration from MyVideos121 (Nexus) to MyVideos131 (Omega) on 10.11.6-MariaDB Alpine Linux

hope this helps
Reply
#5
@howie-f

Would an update of the MariaDB container do the same?
Kodi v20.1,Nokia Streaming BOX 8000 & 8010 , Synology DS920+, Polestar 2. Amsterdam, Netherlands
Reply
#6
(2024-04-27, 19:26)TyKH Wrote: @howie-f

Would an update of the MariaDB container do the same?
i don't think so. updating MariaDB container would probably only update the mariadb-server-software, but the mysql_upgrade utility will upgrade the databases itself to the newest versions.
after this is done please try migration of kodi's databases again

EDIT:
not sure how to run mysql_update in a container on synology, but i guess you'd need to ssh into the nas and execute

admin@syno:/usr/local/mariadb10/bin$ ./mysql_upgrade -uroot -p on the shell
Reply
#7
had a chance to try it, TyKH?
would be interesting to know if mysql_update can resolve the migration issue or this is just a dead end Wink
Reply
#8
Are there any other suggestions to fix this? I have the same problem. I tried the conversion through the windows kodi version as suggested above but that doesn't work. I run my MariaDB version 10.5.8 on the QNAP NAS I have. Problem is that it's integrated with the system and I can't upgrade to a higher version. The update command for mysql doesn't exist on the system. How can I get this database migrated in the right way?
Reply
#9
Small additional test update: Tried to let my linux Kodi machine migrate the database but the exact same issue occurs with the database: No views created. In the xbmc_video121 I can browse "Tables" and "Views" thorugh phpMyAdmin but with the newly created database there is only a list of things like actor, bookmark, art etc. which normally resides under the Tables view.

Conclusion is that at least in my case it is not only Android build giving problems but also Windows and Linux builds.
Reply
#10
Good news, the mysql upgrade was the solution!

Synology offers a terminal login for each container. I still had to find the right commands as I'm not a developer by heart. When accessing the logs I found this:
 An upgrade is required on your databases.           #
2024-04-28T20:14:14.106374589Z #                                                               #
2024-04-28T20:14:14.106403797Z #         Stop any services that are accessing databases        #
2024-04-28T20:14:14.106438946Z #          in this container, and then run the command          #
2024-04-28T20:14:14.106475085Z #                                                               #
2024-04-28T20:14:14.106499773Z #             mariadb-upgrade -u root -p<PASSWORD>              #

1. Used the mariadb-upgrade -u root -p command and then followed with the root password.
2. Upgrade was succesful, no error messages.
3. Updated Kodi. Looked liked it hanged on the Omega splash screen but after a few minutes the menu shows. I didn't see a database migration progressing message. 
4. Database is all and well. Some settings were clearly reset and also all menu items were present (some of which I had hide). Videos are playing fine!
5. Updated Kodi in my bedroom, also a nokia streaming 8010. Kodi booted right up into the menu with all settings preserved, also the hid menu items.
Kodi v20.1,Nokia Streaming BOX 8000 & 8010 , Synology DS920+, Polestar 2. Amsterdam, Netherlands
Reply
#11
@mdvries the problem is in your database / database engine.
mysql_upgrade may be called mariadb-upgrade instead.
Those command don't upgrade mariadb to a higher version. They convert existing (older) databases to work with the currently installed version.
docker containers are a good way to have access to up to date versions that the NAS vendor doesn't provide.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#12
That helped in executing the upgrade. I succeeded running mariadb-upgrade with sudo /share/CACHEDEV1_DATA/.qpkg/MariaDB10/bin/mariadb-upgrade -S /var/run/mariadb10.sock -u root -p[PASSWORD] command. Every thing went ok. I got lines like this:

xbmc_video121.tvshowlinkpath                       OK
xbmc_video121.uniqueid                             OK

When I run the command a second time it says: This installation of MariaDB is already upgraded to 10.5.8-MariaDB, use --force if you still need to run mysql_upgrade

So far so good but regretfully when I run Kodi 21 again and I get the Migration database message it still shows empty movies. The music database seems to be migrated ok beacuse I see all my music but for the movies everything is empty. Looking with phpMyAdmin to the newly created xbmc_video131 I see only the tables, no views. 

So for me this didn't work. What else can I do?
Reply
#13
That's progress but looks like you have multiple problems. New debug log of upgrade from 121 to 131 please. Double-check that your v20 db works fine first.
If the music db is good leave it alone.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply
#14
Thanks.

The v20.5 Kodi works fine with the xbmc_video121 database. No problem at all. I see all the movies in version 20.5 on all my systems in the house. I tried Kodi v21.0 with Android, MacOS, Windows 11 and linux and all same problem.

I found how to get Kodi debug. Result related to this I found:

---
Start of Migration
---
2024-04-29 17:15:41.593 T:331061 info <general>: Old database found - updating from version 121 to 131
2024-04-29 17:15:43.445 T:331061 debug <general>: connect replacing configured host 192.168.0.100 with resolved host 192.168.0.100
2024-04-29 17:15:43.457 T:331061 info <general>: Attempting to update the database xbmc_video131 from version 121 to 131
2024-04-29 17:15:43.457 T:331061 debug <general>: Mysql Start transaction
2024-04-29 17:15:44.861 T:331061 debug <general>: Mysql commit transaction
2024-04-29 17:15:44.863 T:331061 debug <general>: Mysql Start transaction
2024-04-29 17:15:44.863 T:331061 debug <general>: Mysql execute: CREATE TABLE videoversiontype (id INTEGER PRIMARY KEY auto_increment , name TEXT, owner INTEGER) CHARACTER SET utf8 COLLATE utf8_general_ci
2024-04-29 17:15:44.870 T:331061 debug <general>: Mysql Start transaction
2024-04-29 17:15:44.871 T:331061 debug <general>: Mysql execute: INSERT INTO videoversiontype (id, name, owner) VALUES(40400, 'Standard Edition', 0)
2024-04-29 17:15:44.871 T:331061 debug <general>: Mysql execute: INSERT INTO videoversiontype (id, name, owner) VALUES(40401, 'Extended Edition', 0)

---

Then a lot of lines follow with INSERT INTO command. Here the final few of those INSERT INTO's and the part where a exception is reported:

---
Exception part
---
2024-04-29 17:15:44.999 T:331061 debug <general>: Mysql execute: INSERT INTO videoversiontype (id, name, owner) VALUES(40799, '', 0)
2024-04-29 17:15:44.999 T:331061 debug <general>: Mysql execute: INSERT INTO videoversiontype (id, name, owner) VALUES(40800, '', 0)
2024-04-29 17:15:45.000 T:331061 debug <general>: Mysql commit transaction
2024-04-29 17:15:45.001 T:331061 debug <general>: Mysql execute: CREATE TABLE videoversion (idFile INTEGER PRIMARY KEY auto_increment , idMedia INTEGER, mediaType TEXT, itemType INTEGER, idType INTEGER) CHARACTER SET utf8 COLLATE utf8_general_ci
2024-04-29 17:15:45.009 T:331061 debug <general>: Mysql execute: INSERT INTO videoversion SELECT idFile, idMovie, 'movie', '0', '40400' FROM movie
2024-04-29 17:15:45.011 T:331061 error <general>: SQL: [xbmc_video131] Undefined MySQL error: Code (1062)
Query: INSERT INTO videoversion SELECT idFile, idMovie, 'movie', '0', '40400' FROM movie


2024-04-29 17:15:45.011 T:331061 error <general>: Exception updating database xbmc_video131 from version 121 to 131
2024-04-29 17:15:45.011 T:331061 error <general>: Error updating database xbmc_video131 from version 121 to 131
2024-04-29 17:15:45.012 T:331061 debug <general>: Mysql rollback transaction

2024-04-29 17:15:45.012 T:331061 debug <general>: connect replacing configured host 192.168.0.100 with resolved host 192.168.0.100
2024-04-29 17:15:45.019 T:331061 error <general>: Unable to open database: xbmc_video120 [1049](Unknown database 'xbmc_video120')
---


So the lines in bold indicate something goes wrong but I can't see what exactly.

So next I ran the query that failed in the Kodi log manually through phpMyAdmin and that gives a little bit more info. This is what I get back:

#1062 - Dubbele ingang '104' voor zoeksleutel 'PRIMARY'

It's in Dutch but it means "Duplicate entry '104' for key PRIMARY"



What should I do / try next?
Reply
#15
So you have problem #2, multiple movies in the library for the same file in your v20 database. Somehow you ended up with multiple lines in the movie table sharing the same idFile value. That's not valid and the migration fails.
Easiest way to fix is probably a query to identify the duplicates and then with v20 use "remove from library" on one of the copies.
Alternatively, export library / remove all video database versions to start from scratch / import library should take care of it too.
Always read the Kodi online-manual, the FAQ and search the forum before posting.
Do not e-mail Kodi Team members directly asking for support. Read/follow the forum rules (wiki).
For troubleshooting and bug reporting please make sure you read this first.
Reply

Logout Mark Read Team Forum Stats Members Help
Automatic update broke shared library and is unable to play videos0