Legacy-format does not complete scan -- error message with file id appears

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): ‘20.0.8’
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 10 (buster)
Apache or nginx version (eg, Apache 2.4.25): Apache 2
PHP version (eg, 7.4): PHP 7.4.13 (cli)

The issue you are facing:
legacy-format does not complete scan – error message with file id appears

Is this the first time you’ve seen this error? (Y/N): (Y)

Steps to replicate it:

  1. Running the “sudo -u www-data php occ encryption:scan:legacy-format” on updated machine with “old” encryption enabled
  2. Success message does not apear

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

{ "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "datadirectory": "***REMOVED SENSITIVE VALUE***", "debug": false, "dbtype": "mysql", "version": "20.0.8.1", "installed": true, "session_keepalive": false, "session_lifetime": 300, "maintenance": false, "loglevel": 0, "log_type": "owncloud", "log_authfailip": true, "forcessl": true, "theme": "", "maxZipInputSize": 0, "allowZipDownload": true, "check_for_working_htaccess": true, "check_for_working_webdav": true, "log_rotate_size": 5242880, "updatechecker": true, "has_internet_connection": true, "mail_smtpmode": "smtp", "mail_smtpauthtype": "LOGIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "ssl", "enable_previews": true, "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "forceSSLforSubdomains": true, "appstore.experimental.enabled": true, "trashbin_retention_obligation": "auto", "auth.bruteforce.protection.enabled": true, "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "htaccess.RewriteBase": "\/owncloud", "updater.release.channel": "stable", "memcache.local": "\\OC\\Memcache\\APCu", "twofactor_enforced": "false", "twofactor_enforced_groups": [ "admin" ], "data-fingerprint": "f21ac21ee9facefa0b6fe4b992f44100", "mysql.utf8mb4": true, "app_install_overwrite": [ "calendar" ], "mail_sendmailmode": "smtp", "encryption.legacy_format_support": true, "encryption.key_storage_migrated": false, "updater.secret": "***REMOVED SENSITIVE VALUE***" } } 

When doing the encryption step I get following error message

sudo -u www-data php occ encryption:scan:legacy-format
Scanning all files for legacy encryption
Scanning all files for user1
Scanning all files for user2
Scanning all files for user3

In FailedStorage.php line 70:

File with id “14” has not been found.

In View.php line 1768:

File with id “14” has not been found.

encryption:scan:legacy-format
grafik

Hello!

I’m not quite sure if the error message indicates that just a file with the id 14 is missing, or a whole user/storage cannot be found.

You could try to look for some remnants (if you’re using LDAP Backend) and delete them:

  1. occ ldap:show-remnants
  2. occ user:delete userid

if you don’t have any remnants (or you just don’t use LDAP Backend) you could just to try to rescan your Users files:

  1. occ files:scan

After that, just retry the occ encryption:scan:legacy-format command

Hope this helps you a little bit.

Hello Stefam!

Thanks for your swift reply. I do not use LDAP Backend and after using

sudo -u www-data php occ files:scan --all

Starting scan for user 1 out of 6 (user1)
Starting scan for user 2 out of 6 (user2)
Starting scan for user 3 out of 6 (user3)
Starting scan for user 4 out of 6 (user4)
Starting scan for user 5 out of 6 (user5)
Starting scan for user 6 out of 6 (user6)
±--------±-------±-------------+
| Folders | Files | Elapsed time |
±--------±-------±-------------+
| 152686 | 213181 | 05:07:36 |
±--------±-------±-------------+

And afterwards
sudo -u www-data php occ encryption:scan:legacy-format

I still get

Scanning all files for legacy encryption
Scanning all files for user1
Scanning all files for user2
Scanning all files for user3

In FailedStorage.php line 70:
File with id "14" has not been found.
In View.php line 1768:
File with id "14" has not been found.
encryption:scan:legacy-format

What should I do? How can I determine which file it is? Should I delete it?
If I access the mysql database and check the content of id 14 I get following
select * from oc_filecache where fileid=“14”;

| fileid | storage | path | path_hash| parent | name | mimetype | mimepart | size | mtime | storage_mtime | encrypted | unencrypted_size | etag | permissions | checksum |

|14|7| appdata_5140a4eb8729a/end_to_end_encryption/public-keys |Some Value|9| public-keys |1|2|0|1522010115|1522010115|0|0|Some Value|31| |

Hello @baumimwald

Sorry for the delay, i didn’t get any notification that you answered me.

As i can see, your fileid 14 is located in the appdata.
You could try to rescan the appdata also with the occ command: occ files:scan-app-data
and after that again a occ encryption:scan:legacy-format

I’m not quite sure if you can safely delete the public key from the end_to_end_encryption.
Do you have the end-to-end encryption enabled?