-
Notifications
You must be signed in to change notification settings - Fork 806
How to fix the error invalid or negative modification date
Camila edited this page Feb 21, 2022
·
11 revisions
The bug was introduced in the Desktop client 3.4.0. Currently, all known issues are resolved with version 3.4.2, except for one issue that only occurs in combination with the community build of Nextcloud, version 23.
- If your systems have been affected by the invalid metadata issue in desktop client 3.4.0, the error might be visible on the desktop client interface and in the logs: Could not update metadata due to invalid modified time.
- You can find the affected files in your database using a SQL query:
SELECT COUNT(*) FROM oc_filecache WHERE mtime < 86400;
- Note that recovering the exact modification time requires restoring backups which may be impractical if the files have been modified already.
- You do not need to put the server in maintenance mode.
- You do not need to make a backup of your database, however backups are always recommended as a regular practice.
- Make sure to be running the latest desktop client.
- Please always use the latest version of the scripts.
We provide the following scripts to help with the recovery of the server state.
-
Script for server side fixing of invalid dates (
solvable_files.sh
)- Copy the file to the
nextcloud
folder on the server. chmod a+x solvable_files.sh
- Call it with the following arguments:
./solvable_files.sh <path to storage folder without trailing /> <mysql|pgsql> <database host> <database user> <database password> <database name> <list|fix> <noscan|scan>
- If you call it with the
list
argument: it will generate a list of the files with invalid modification date. - If you call it with the
fix
argument: it will fix all the files and the server database. - If you call it with the
scan
argument: it will automatically trigger a scan of each modified file. - As a last step it is necessary to scan the files on the storage (unless you used the
scan
argument):
sudo -u www-data php <path to nextcloud install>/occ files:scan --all
- If you call it with the
- Copy the file to the
If you use the group folders feature, we provide the following scripts to help with the recovery of the files located in group folders:
-
Script to scan files in the group folders (
scan_group_folders.sh
)- Copy the file to the
nextcloud
folder on the server. chmod a+x scan_group_folders.sh
- Run the script:
sudo -u <www-data|apache> ./scan_group_folders.sh
- Copy the file to the
-
- Copy the file to the
nextcloud
folder on the server. chmod a+x fix_group_folders.sh
- Call it with the following arguments:
./fix_group_folders.sh <path to storage folder> <mysql|pgsql> <database host> <database user> <database password> <database name>
- Copy the file to the
For files located in an external storage like S3, the fix is only necessary in the database by updating the mtime
to a valid value:
UPDATE oc_filecache SET mtime=1645452423, storage_mtime=1645452423 where mtime < 86400;