NC upgrade to 19.0.12 failed due to "music" module error!

Nextcloud version (eg, 20.0.5): Upgrade to 19.0.12 (from 19.0.3?)
Operating system and version (eg, Ubuntu 20.04): Debian 9.13
Apache or nginx version (eg, Apache 2.4.25): Do not find which version ?
PHP version (eg, 7.4): 7.4

I’m trying to upgrade form web upgrade but I have a problem with “music” module and the upgrade failed. Here is my French message:

Préparation de la mise à jour

Réglage du niveau de journalisation à “déboguage”

Mode de maintenance activé

Étape de réparation : Repair MySQL collation

Informations de réparation : All tables already have the correct collation → nothing to do

Étape de réparation : Repair SQLite autoincrement

Étape de réparation : Copy data from accounts table when migrating from ownCloud

Étape de réparation : Drop account terms table when migrating from ownCloud

Mise à jour du schéma de la base de données

Base de données mise à jour

Étape de réparation : Drop any incompatible music database entries

Étape de réparation : Remove any playlist files mistakenly added to music_tracks table

Étape de réparation : Combine multi-disk albums and store disk numbers per track

Étape de réparation : Set creation and update dates for the library entities without one

Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing ‘UPDATE oc_music_albums SET created = ? WHERE created IS NULL’ with params [“2021-06-30 11:13:05”]: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘created’ in ‘where clause’

So I tried to upgrade form a terminal with:

sudo -u www-data php occ upgrade

But it is the same problem:

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Updating …
Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing ‘UPDATE oc_music_albums SET created = ? WHERE created IS NULL’ with params [“2021-06-30 16:00:01”]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘created’ in ‘where clause’
Update failed
Maintenance mode is kept active
Reset log level

Finally, I’m locked in maintenance mode and no idea how to escape from this situation.

Any help will be really nice.
Regards,

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#maintenance-commands-label

@Larry_Boyd , your answer is not very explicit :frowning:

I already tried:

sudo -u www-data php occ maintenance:repair
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
 - Repair MySQL collation
     - All tables already have the correct collation -> nothing to do
 - Repair mime types
 - Clean tags and favorites
     - 0 tags of deleted users have been removed.
     - 0 tags for delete files have been removed.
     - 0 tag entries for deleted tags have been removed.
     - 0 tags with no entries have been removed.
 - Repair invalid shares
 - Move .step file of updater to backup location
 - Fix potential broken mount points
     - No mounts updated
 - Add log rotate job
 - Clear frontend caches
     - Image cache cleared
     - SCSS cache cleared
     - JS cache cleared
 - Clear every generated avatar on major updates
 - Add preview background cleanup job
 - Queue a one-time job to cleanup old backups of the updater
 - Cleanup invalid photocache files for carddav
 - Add background job to cleanup login flow v2 tokens
 - Remove potentially over exposing share links
     - No need to remove link shares.
 - Clear access cache of projects
 - Reset generated avatar flag
 - Repair DAV shares
 - Add background job to set the lookup server share state for users
 - Deduplicate shared bookmark folders
     - Removed 0 duplicate shares
 - Remove superfluous shared bookmark folders
     - Removed 0 superfluous shares
 - Remove orphaned bookmark shares
     - Removed 0 orphaned shares
     - Removed 0 orphaned public links
 - Remove orphaned bookmark tree items
     - Removed 0 orphaned bookmarks entries
     - Removed 0 orphaned folders entries
     - Removed 0 orphaned children entries
     - Removed 0 orphaned bookmark folders
     - Removed 0 orphaned bookmarks
 - Update bookmark group shares
     - Removed 0 users and added 0 users to 0 groups
     - Removed 0 shares
 - Update name of the stored view
 - Fix component of birthday calendars
     - 3 birthday calendars updated.
 - Regenerating birthday calendars to use new icons and fix old birthday events without year
     - Repair step already executed
 - Fix broken values of calendar objects
    0 [->--------------------------]
 - Registering building of calendar search index as background job
     - Repair step already executed
 - Registering background jobs to update cache for webcal calendars
     - Added 0 background jobs to update webcal calendars
 - Registering building of calendar reminder index as background job
     - Repair step already executed
 - Clean up orphan event and contact data
     - 0 events without a calendar have been cleaned up
     - 0 properties without an events have been cleaned up
     - 0 changes without a calendar have been cleaned up
     - 0 cached events without a calendar subscription have been cleaned up
     - 0 changes without a calendar subscription have been cleaned up
     - 0 contacts without an addressbook have been cleaned up
     - 0 properties without a contact have been cleaned up
     - 0 changes without an addressbook have been cleaned up
 - Remove activity entries of private events
     - Removed 0 activity entries
 - Fix the share type of guest shares when migrating from ownCloud
 - Copy the share password into the dedicated column
 - Set existing shares as accepted
 - Remove any playlist files mistakenly added to music_tracks table
 - Combine multi-disk albums and store disk numbers per track
 - Set creation and update dates for the library entities without one

In AbstractMySQLDriver.php line 60:

  An exception occurred while executing 'UPDATE `oc_music_albums` SET `created` = ? WHERE `created` IS NULL' with params ["2021-06-30 21:46:4
  9"]:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created' in 'where clause'


In PDOStatement.php line 119:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created' in 'where clause'


In PDOStatement.php line 117:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created' in 'where clause'


maintenance:repair [--include-expensive]

And I already tried:

sudo -u www-data php occ maintenance:mode --off
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled

But the webpage still ask me to perform the upgrade!

I found this issue (Cannot upgrade to latest version, Undefined table: 7 ERROR: relation "oc_music_albums" does not exist · Issue #868 · owncloud/music · GitHub) but I do not understand how to type this command:

delete from oc_migrations where app='music';

Hi @jujukeke

I’m not a database expert and I don’t know Postgresql… But as I understand it, you have to run this command from the command line of your database. With a quick Google search I found the following…

https://alvinalexander.com/blog/post/postgresql/log-in-postgresql-database/

https://stackoverflow.com/questions/19674456/run-postgresql-queries-from-the-command-line

…which brings me to the conclusion, that you either should log into the command line of your database:

psql -d dbname -U dbuser

…and then run the command from there:

delete from oc_migrations where app='music';

or directly from the Linux command line, like this:

psql -U username -d mydatabase -c delete from oc_migrations where app='music';

Hope that helps.

Hi,
You are not an expert in database, but I’m a total newbie. For my nextcloud installation, I only install MariaDB. Do you have an idea of commands needed in the case, or I need to install PostgreSQL ?
Regards

I found, I finish my Starcraft2 session and I will explained all after :slight_smile:

So, I finally managed to upgrade it, postgresql and mysql commands seem to be the same but the only command:

delete from oc_migrations where app='music';

was not enough for me!

I decided to add the missing columns in the database as required. But finaly several columns were missing !

I found the command “ALTER TABLE” to add the missing columns in differents tables, and the following command were used:

ALTER TABLE oc_music_albums ADD created datetime;
ALTER TABLE oc_music_albums ADD updated datetime;
ALTER TABLE oc_music_artists ADD updated datetime;
ALTER TABLE oc_music_artists ADD created datetime;
ALTER TABLE oc_music_genres ADD created datetime;
ALTER TABLE oc_music_genres ADD updated datetime;
ALTER TABLE oc_music_playlists ADD updated datetime;
ALTER TABLE oc_music_tracks ADD created datetime;
ALTER TABLE oc_music_tracks ADD updated datetime;

Then the upgrade process perfectly works :slight_smile:

Thanks AGAIN @bb77 ! I learnt how to edit a database.

3 Likes

I am very eager to know because I seem to have the same problem now:

How and where did you enter this?

Hi Nightcobe,

First in the Nextcloud folder start mysql by opening the Nextcloud database called “nextclouddb” with “nextcloud” user:

/var/www/nextcloud$ sudo mysql -u nextcloud -p nextclouddb

The password is asked!

To list column named description of the “oc_music_albums” table:

desc oc_music_albums;

To add in the table, the column named field “upaded” of type “datetime”

ALTER TABLE oc_music_albums ADD updated datetime;

To quit mysql:

quit;

I hope now, it is more easy to understand.
Regards

I just get this error message:

ERROR 1045 (28000): Access denied for user ‘nextcloud’@‘localhost’ (using password: YES)

I tried to find a solution to this but to no avail. Thank you for the kind help provided.

Thank you for trying to help. If on a Nextcloud Docker image, this solution worked for me: