owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.39k stars 2.05k forks source link

Can't migrate encryption keys from cli #16928

Closed redhell closed 9 years ago

redhell commented 9 years ago

Hi, on my test installation i installed the newest master revision and activated the server side encryption module. (oC 8.1 latest master, php 5.6.10, mariaDB 10.0) In my logs this warning rises: Warning no app in context Installation is in transit between the old Encryption (ownCloud <= 8.0) and the new encryption. Please enable the "Default encryption module" and run 'occ encryption:migrate'

I followed the warning: sudo -u USER /path/to/occ encryption:migrate

The cli got following output: Reorganize system folder structure PHP Fatal error: Call to a member function getRelativePath() on a non-object in /path/to/apps/files_trashbin/lib/storage.php on line 123

UH-Nerion commented 9 years ago

Hello,

I restore from backup where update to owncloud 8.1 was not done. After that I disabled trashbin and run yum update. After that I run sudo -u apache ./occ encryption:migrate And got the same error message again with

[Doctrine\DBAL\Exception\UniqueConstraintViolationException] An exception occurred while executing 'UPDATE oc_appconfig SET appid = ? WHERE appid = ?' with params ["encryption", "files_encryption"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-installed_version' for key 'PRIMARY'

pgrzywacz commented 9 years ago

After replacing the two files @schiesbn mentioned and performing the steps of @twouters , I run migrate - it works for the admin user, but then stops on first ldap user slowly consuming more and more memory until it eats everything. When that is done, it gets killed and running migrate again failes with message Could not obtain lock type 1 on "/var/www/owncloud/data/admin/files_encryption/admin.privateKey".

Restoring the admin folder from backup allows me to start over and to run out of memory again.

alexboss commented 9 years ago

Dear owncloud users / developers... I'm stuck with a similar problem here. I did the upgrade of owncloud from 8.0.4-1 to 8.1.0-1 using the debian package. There was a dependency problem during the install

dpkg: owncloud-app-files-encryption: dependency problems, but removing anyway as you requested:
 owncloud-server depends on owncloud-app-files-encryption (= 8.0.4-1); however:
  Package owncloud-app-files-encryption is to be removed.

But it wen through anyway.

As I was already using encryption with the past versions, I followed the instructions displayed on https://doc.owncloud.org/server/8.1/admin_manual/configuration_files/encryption_configuration.html but now I can't migrate keys.

Output of occ encryption:status

 - enabled: true
 - defaultModule:

Output of occ encryption:enable

Encryption is already enabled
No encryption module is loaded

Output of occ encryption:list-modules

(empty)

Output of occ encryption:migrate

Reorganize system folder structure
PHP Fatal error:  Call to a member function getRelativePath() on a non-object in /var/www/owncloud/apps/files_trashbin/lib/storage.php on line 123

Reading the comments published on this thread, it looks like other issues will happen (Integrity constraint violation, etc.).

My questions:

  1. Why is the list-modules empty ?
  2. What module id should I use with the command occ encryption:set-default-module ?
  3. Would you have any solution at this point to fix this issue ?

Thanks a lot for your help and hope there's a solution to this issue.

Alexandre 8)

johan-smits commented 9 years ago

Migrating stops after 2 ldap users. And without any error message. I have updated the 2 files (fix for the trashbin issue is here: #17474, combining this fix together with #17473). And disabled the trashbin (had done that before). When I trigger the upgrade of a key manually I get this in the error:

{"reqId":"1lrXbla...","remoteAddr":"","app":"PHP","message":"fopen(\/mnt\/data\/web\/cloud-data\/files_encryption\/public_keys\/cc9084......1923f1.publicKey): failed to open stream: No such file or directory at \/mnt\/data\/web\/cloud.8.1.0\/lib\/private\/files\/storage\/local.php#257","level":3,"time":"2015-07-08T12:46:24+02:00"}
{"reqId":"1lrXbla...","remoteAddr":"","app":"PHP","message":"fclose() expects parameter 1 to be resource, boolean given at \/mnt\/data\/web\/cloud.8.1.0\/lib\/private\/files\/storage\/wrapper\/encryption.php#511","level":3,"time":"2015-07-08T12:46:24+02:00"}
jtoloe commented 9 years ago

@alexboss I had the exact same problem as you. I was able to fix it by doing what is suggested in the comments but it was quite involved. Unless it is really critical for you to get it working I suggest to wait until there is a proper fix.

jtoloe commented 9 years ago

@alexboss I think I had to disable then re-enable the encryption app for the default module to become available, but I'm not entirely sure. You could try:

php occ encryption:set-default-module OC_DEFAULT_MODULE

Kevinsky86 commented 9 years ago

Same issue. I manage two owncloud installations on remote VPSses. The first one I just went ahead and ran sudo -u www-data php occ encryption:migrate which gave me the fatal error. After disabling trashbin I got the SQL errors.

[Doctrine\DBAL\Driver\PDOException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encr yption-installed_version' for key 'PRIMARY'

[PDOException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encr yption-installed_version' for key 'PRIMARY'

On the second installation I disabled the trashbin plugin before running the migrate command and that immediately spawned the two SQL errors. So now I have two broken owncloud installations...

Is there any risk of auto sycing the now broken files to the computer using the sync app? This would be a major problem...

alexboss commented 9 years ago

Thanks @jtoloe for your help and feedback.

I tried to disable and enable the encryption app, but there is still no default module available.

I tried to force the OC_DEFAULT_MODULE but it generates error

PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /var/www/owncloud/lib/private/config.php on line 201
An unhandled exception has been thrown:
exception 'Exception' with message 'Could not acquire a shared lock on the config file /var/www/owncloud/config/config.php' in /var/www/owncloud/lib/private/config.php:202
Stack trace:
#0 /var/www/owncloud/lib/private/config.php(61): OC\Config->readData()
#1 /var/www/owncloud/lib/base.php(134): OC\Config->__construct('/var/www/ownclo...')
#2 /var/www/owncloud/lib/base.php(524): OC::initPaths()
#3 /var/www/owncloud/lib/base.php(1115): OC::init()
#4 /var/www/owncloud/console.php(41): require_once('/var/www/ownclo...')
#5 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#6 {main}

When I try to access some of the file through the GUI, the message displayed is

"Module with id: OC_DEFAULT_MODULE does not exist. Please enable it in your apps settings or contact your administrator."

Just like you mentioned it, let's wait for a proper fix... hope it won't be too long, fingers crossed x

Alexandre 8)

schiessle commented 9 years ago

Please don't repeat the same bug report again if you don't have anything to add. The fix is here: https://github.com/owncloud/core/issues/16928#issuecomment-119523578 and a manual solution is also described in the issue, e.g. here https://github.com/owncloud/core/issues/16928#issuecomment-119503329

The LDAP issue seems to be something new, we have to check this.

schiessle commented 9 years ago

cc @blizzz there seems to be some issues specific to LDAP. Can you try to combine these two patches https://github.com/owncloud/core/pull/17474 https://github.com/owncloud/core/pull/17473 and run the upgrade process with some LDAP users? Thanks!

pgrzywacz commented 9 years ago

@schiesbn I'm sorry to tell you that neither of these solutions worked for me.

schiessle commented 9 years ago

@alexboss I created a seperate issue for the dependency problem, please follow up here https://github.com/owncloud/core/issues/17487

schiessle commented 9 years ago

@pgrzywacz I saw your earlier comment, this seems to be LDAP specific as mentioned here https://github.com/owncloud/core/issues/16928#issuecomment-119567515, at least I can't re-produce it with local users... we will look into it

schiessle commented 9 years ago

@alexboss

  1. Why is the list-modules empty ?

that's OK. As long as the migration isn't finished we don't load the encryption module -> no modules in the list

  1. What module id should I use with the command occ encryption:set-default-module ?

You don't have to do anything if you enabled the "default encryption module" app and enabled server-side-encryption in the admin settings the default module will be set automatically.

  1. Would you have any solution at this point to fix this issue ?

Try to apply these two patches to your system and run occ encryption:migrate

AndyMcSchopf commented 9 years ago

Hi, like phjr up there I have the Problem, that after using the 2 updated files I get the following error: "PHP Fatal error: Class 'OCA\Encryption\Migration' not found in /var/www/owncloud/apps/encryption/command/migratekeys.php on line 80" Any ideas about that?

Kevinsky86 commented 9 years ago

I've installed the two modified files referenced earlier. It now spawns a whole bunch of html code and in the end it says:

PHP Fatal error: Class 'OCA\Encryption\Migration' not found in /var/www/owncloud/apps/encryption/command/migratekeys.php on line 80

Edit:

The error about updating the encryption keys in the owncloud interface now seem to have disappeared, though files remain inaccessable.

schiessle commented 9 years ago

@AndyMcSchopf @AlphaBootis are you sure that you copied the file to the right location, overwrite the existing one and make sure that the file has the correct permission so that your server can read/execute it. Compare the permission and ownership of the files with other files in the same directory. Both permission and owner/group needs to be the same. The namespace and name of the class didn't change, if your system no longer find it there is most likely something wrong with either the location or maybe the permission.

Also double check the files you copied. Depending how you copied it, e.g. copy&paste from your browser it might be possible that you copied some characters which doesn't belong to the file like line numbers, etc.

Kevinsky86 commented 9 years ago

I checked that before I replied. I've noticed they seem to be owned by root, which I think is a bit weird, but surrounding untouched files are also owned by root. The write/read permissions are also identical.

I'm used to things in the www directory beeing owned by www-data (apache user) but then again I installed owncloud from the repository so everything should be standard.

Edit:

I have just now checked it at the second server I have which I haven't touched since the SQL errors and the file permissions are the same.

fersingb commented 9 years ago

I ran the encryption migration after replacing the migration.php file with the new one, and now I'm getting "Can't read file" when I try to open/download a file.

Kevinsky86 commented 9 years ago

I feel like a bit of a tit but I just right clicked and told my browser to download the .php file. When I actually opened and interpreted the files I actually noticed it downloaded the github page instead of something that looked like an owncloud component.

It is doing something now, how long should this procedure take? This depends on the amount of files stored?

fersingb commented 9 years ago

@AlphaBootis , If you're talking about the "Migrating keys for users on backend.." stuff, it took few minutes/user for me.

schiessle commented 9 years ago

@AlphaBootis If you go to the files I mentioned here https://github.com/owncloud/core/issues/16928#issuecomment-119523578 you will see a "raw" button, click on it and your browser will open the raw file, now save this page with your browser, double-check that it only contain the raw content, move it to the right location and re-run the migration script

schiessle commented 9 years ago

@fersingb maybe the same problem like described by @redhell ? Please provide more information, what do you see in your apache error log and/or owncloud.log ?

orson74 commented 9 years ago

@schiesbn same problem here, "can't read file" where should i do the logs ?

{"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Example.odt","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Acquired read lock for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Example.odt","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Example.odt","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Acquired read lock for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Acquired read lock for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"} {"reqId":"1bKNQiLl\/esb5nbkINFL","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Example.odt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T15:41:43+02:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/download.php?dir=%2FDokumente&files=Example.odt"}

schiessle commented 9 years ago

Just try to read a file and then enter the last few lines here, typically the log message also have a timestamp so it should be relatively easy to decide what is related to the last read operation.

fersingb commented 9 years ago

I can't find anything in the nginx logs

fersingb commented 9 years ago

But I got some errors in the admin panel:

Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6): Directory not empty at /var/www/owncloud/lib/private/helper.php#472 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6/news): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6/news/vendor): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6/news/vendor/bin): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP unlink(): No such file or directory at /var/www/owncloud/lib/private/helper.php#468 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_DcWMX1-folder): Directory not empty at /var/www/owncloud/lib/private/helper.php#472 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_DcWMX1-folder/news): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_DcWMX1-folder/news/vendor): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_DcWMX1-folder/news/vendor/bin): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:53:38+00:00 Error PHP unlink(): No such file or directory at /var/www/owncloud/lib/private/helper.php#468 2015-07-08T13:53:38+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6): Directory not empty at /var/www/owncloud/lib/private/helper.php#472 2015-07-08T13:51:56+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6/news): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:51:56+00:00 Error PHP rmdir(/tmp/oc_tmp_dce9c8010e90c7d05f5fedef698d16e6/news/vendor): Directory not empty at /var/www/owncloud/lib/private/helper.php#466 2015-07-08T13:51:56+00:00

fersingb commented 9 years ago

On the admin panel I see that the server side encryption is not enabled. Shouldn't it be enabled?

What will happen if I enable encryption now? Encryption was already enabled before the migration. I don't want to make a mistake and encrypt my files twice or something like that.

schiessle commented 9 years ago

@fersingb yes you need to enable it

schiessle commented 9 years ago

@fersingb and then logout and login again, just to make sure that your encryption keys are initialized.

fersingb commented 9 years ago

Ok, after enabling the encryption the files seem to be definitely broken now. The few files I was able to access in my notes are now blank :(

orson74 commented 9 years ago

all working now

i copied the my private key from encryyption_migration_backup to files_encryption/OC_DEFAULT_MODULE

Kevinsky86 commented 9 years ago

The encryption migration procedure has beeing running for a good 45 minutes now. There's probably somewhere in the area of 60 to 80 gigabytes of data on this owncloud installation. Is this normal or is something hanging?

schiessle commented 9 years ago

@AlphaBootis we don't touch the files but only rename the encryption keys. So it depends more on the number of files, users and how extensive the files are shared. If you don't see a error I would keep it running. You should get a notification every time the migration moves on to the next user as a indicator that something happens.

Kevinsky86 commented 9 years ago

Theres only one user but the librairy of files on it is quite extentive. So i'll just wait for a bit more then. Thanks for the feedback.

schiessle commented 9 years ago

Ok, after enabling the encryption the files seem to be definitely broken now. The few files I was able to access in my notes are now blank :(

Try to open the encrypted file directly on your server with a text editor. Is the file really empty?

fersingb commented 9 years ago

No the file is not empty. But it looks like that file is not encrypted. When I try to open som other files that are encrypted on the disk, I get a message "An error occurred"

schiessle commented 9 years ago

@fersingb then it is probably just a decryption issue. Maybe this would also work for you: https://github.com/owncloud/core/issues/16928#issuecomment-119594965

Make sure that you logout/login after copying the keys

orson74 commented 9 years ago

Problem with Windowsclient and Uploading Document from Browser -> new File is empty and change in browsereditor will not saved.

{"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Write lock requested for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Write lock succeeded on \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 2 count for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Acquired read lock for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/fileKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"PASS: Acquired read lock for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Incrementing lock type 1 count for \/var\/www\/owncloud\/data\/denis\/files_encryption\/keys\/files\/Dokumente\/Neues Textdokument.txt\/OC_DEFAULT_MODULE\/denis.shareKey","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"INFO: Read lock requested for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part","level":0,"time":"2015-07-08T16:33:35+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"files_locking","message":"FAIL: Failed to acquire read lock for \/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part","level":0,"time":"2015-07-08T16:33:37+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"} {"reqId":"IupuQE3GzGomARIOlGEu","remoteAddr":"XXX.XXX.XXX.XXX","app":"webdav","message":"Exception: {\"Message\":\"Could not obtain lock type 1 on \"\/var\/www\/owncloud\/data\/denis\/files\/Dokumente\/Neues Textdokument.txt.ocTransferId1142697688.part\".\",\"Code\":0,\"Trace\":\"#0 \/var\/www\/owncloud\/apps\/files_locking\/lib\/lockingwrapper.php(45): OCA\Files_Locking\Lock->addLock(1, Resource id #389)\n#1 \/var\/www\/owncloud\/apps\/files_locking\/lib\/lockingwrapper.php(172): OCA\Files_Locking\LockingWrapper->getLock('files\/Dokumente...', 1, Resource id #389)\n#2 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(622): OCA\Files_Locking\LockingWrapper->fopen('files\/Dokumente...', 'r')\n#3 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(642): OC\Files\Storage\Wrapper\Encryption->getHeader('files\/Dokumente...')\n#4 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(218): OC\Files\Storage\Wrapper\Encryption->getEncryptionModule('files\/Dokumente...')\n#5 \/var\/www\/owncloud\/lib\/private\/connector\/sabre\/file.php(149): OC\Files\Storage\Wrapper\Encryption->unlink('files\/Dokumente...')\n#6 \/var\/www\/owncloud\/lib\/private\/connector\/sabre\/directory.php(113): OC\Connector\Sabre\File->put(Resource id #227)\n#7 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1053): OC\Connector\Sabre\Directory->createFile('Neues Textdokum...', Resource id #227)\n#8 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(513): Sabre\DAV\Server->createFile('Dokumente\/Neues...', Resource id #227, NULL)\n#9 [internal function]: Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#10 \/var\/www\/owncloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#11 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(469): Sabre\Event\EventEmitter->emit('method:PUT', Array)\n#12 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#13 \/var\/www\/owncloud\/apps\/files\/appinfo\/remote.php(83): Sabre\DAV\Server->exec()\n#14 \/var\/www\/owncloud\/remote.php(132): require_once('\/var\/www\/ownclo...')\n#15 {main}\",\"File\":\"\/var\/www\/owncloud\/apps\/files_locking\/lib\/lock.php\",\"Line\":257}","level":4,"time":"2015-07-08T16:33:37+02:00","method":"PUT","url":"\/remote.php\/webdav\/Dokumente\/Neues%20Textdokument.txt"}

=#=#=# Syncrun started 2015-07-08T16:35:20 until 2015-07-08T16:35:23 (3241 msec)

|0|Dokumente/Neues Textdokument.txt|INST_NEW|Up|1436366118||0||2|Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/Dokumente/Neues Textdokument.txt - server replied: Internal Server Error (Could not obtain lock type 1 on "/var/www/owncloud/data/denis/files/Dokumente/Neues Textdokument.txt.ocTransferId1142697688.part".)|0|0|0|||INST_NONE| |0|ownCloudUserManual.pdf|INST_SYNC|Down|1436346717|25f99b2fd2e130dcdf1e1b17422d61fc|1747761|00000046oc08zr6b6a8w|6|Das Element ist aufgrund vorheriger Fehler nicht synchronisiert: Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/ownCloudUserManual.pdf - server replied: Internal Server Error|0|1747761|1427365134|81187cc0e7fe3ca1bb2a5066577b4610||INST_NONE|

=#=#=# Syncrun started 2015-07-08T16:44:57 until 2015-07-08T16:45:00 (2744 msec)

|0|Dokumente/Neues Textdokument.txt|INST_NEW|Up|1436366118||0||2|Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/Dokumente/Neues Textdokument.txt - server replied: Internal Server Error (Could not obtain lock type 1 on "/var/www/owncloud/data/denis/files/Dokumente/Neues Textdokument.txt.ocTransferId608471394.part".)|0|0|0|||INST_NONE| |0|Dokumente/Test|INST_SYNC|Down|1436366347|559d360cd1714|0|00013665oc08zr6b6a8w|0||0|0|1436365089|559d30bb89b80||INST_NONE| 14:43:12|222|Dokumente/Test/msbuild.txt|INST_NEW|Down|1436366500|1c0550ec1e737c21ff91ed57569783a0|0|00013694oc08zr6b6a8w|4||0|0|0|||INST_NONE| |0|ownCloudUserManual.pdf|INST_SYNC|Down|1436346717|25f99b2fd2e130dcdf1e1b17422d61fc|1747761|00000046oc08zr6b6a8w|2|Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/ownCloudUserManual.pdf - server replied: Internal Server Error|0|1747761|1427365134|81187cc0e7fe3ca1bb2a5066577b4610||INST_NONE|

=#=#=# Syncrun started 2015-07-08T16:45:03 until 2015-07-08T16:45:04 (1110 msec)

|0|Dokumente/Neues Textdokument.txt|INST_NEW|Up|1436366118||0||6|Das Element ist aufgrund vorheriger Fehler nicht synchronisiert: Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/Dokumente/Neues Textdokument.txt - server replied: Internal Server Error (Could not obtain lock type 1 on "/var/www/owncloud/data/denis/files/Dokumente/Neues Textdokument.txt.ocTransferId608471394.part".)|0|0|0|||INST_NONE| |0|ownCloudUserManual.pdf|INST_SYNC|Down|1436346717|25f99b2fd2e130dcdf1e1b17422d61fc|1747761|00000046oc08zr6b6a8w|6|Das Element ist aufgrund vorheriger Fehler nicht synchronisiert: Error downloading https://XXX.XXX.XXX.XXX/remote.php/webdav/ownCloudUserManual.pdf - server replied: Internal Server Error|0|1747761|1427365134|81187cc0e7fe3ca1bb2a5066577b4610||INST_NONE|

schiessle commented 9 years ago

@orson74 This no longer looks like a upgrade issue but more like a issue of locking and encryption in general. Please open a new issue for it. This issue is already large enough.

Kevinsky86 commented 9 years ago

Having the same can't read file issue after the procedure completed.

fersingb commented 9 years ago

@schiesbn The file structure has changed right?

In my data folder I have thos encryption folders:

drwxr-xr-x 5 www-data www-data 4096 Feb 9 15:24 encryption_migration_backup_2015-02-09_20-24-40 drwxr-xr-x 3 www-data www-data 4096 Jul 7 16:29 encryption_migration_backup_2015-07-07_20-29-33 drwxr-xr-x 3 www-data www-data 4096 Jul 7 16:31 encryption_migration_backup_2015-07-07_20-31-00 drwxr-xr-x 3 www-data www-data 4096 Jul 7 16:32 encryption_migration_backup_2015-07-07_20-32-18 drwxr-xr-x 3 www-data www-data 4096 Jul 8 09:14 encryption_migration_backup_2015-07-08_13-14-59 drwxr-xr-x 3 www-data www-data 4096 Jul 7 16:31 files_encryption

and in my users data folders I have those encryption folders:

drwxr-xr-x 4 www-data www-data 4096 Feb 9 15:24 encryption_migration_backup_2015-02-09_20-24-41 drwxr-xr-x 4 www-data www-data 4096 Jul 8 09:15 encryption_migration_backup_2015-07-08_13-15-00 drwxr-xr-x 14 www-data www-data 4096 Jul 8 09:32 files drwxr-xr-x 4 www-data www-data 4096 Jul 8 09:15 files_encryption

Could you tell what I need to copy and where? Do I need to rename some files? I have multiple backup dirs for the last 2 days in the data root, is that because of the failed migrations? Which folder should I copy the keys from?

Thanks

orson74 commented 9 years ago

@fersingb after i copied the key from the first backupfolder to the new folder "/files_encryption/OC_DEFAULT_MODULE/" (backup before) i can access the old files

wallenium commented 9 years ago

Just a hint, not sure if i should open a bug Report for that: https://doc.owncloud.org/server/8.1/admin_manual/configuration_files/encryption_configuration.html?highlight=encryption#upgrading

is it occ encryption:migrate or occ encryption:migrate-keys? Think last one seems to be wrong...

I had the same Problem. Not sure if the Migration worked. but cant read the files. Sucks a bit. will replace the two files later.

{"reqId":"Fw+2Gl3\/8bjDgXrZq3+n","remoteAddr":"194.77.12.2","app":"PHP","message":"fread(): Length parameter must be greater than 0 at \/srv\/www\/owncloud\/3rdparty\/icewind\/streams\/src\/Wrapper.php#67","level":3,"time":"2015-07-08T14:47:10+00:00"} {"reqId":"Fw+2Gl3\/8bjDgXrZq3+n","remoteAddr":"194.77.12.2","app":"no app in context","message":"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.","level":3,"time":"2015-07-08T14:47:11+00:00"} {"reqId":"qTATBwpghylRH+jV8xUI","remoteAddr":"194.77.12.2","app":"PHP","message":"Call to a member function isReadable() on a non-object at \/srv\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php#288","level":3,"time":"2015-07-08T14:47:11+00:00"} {"reqId":"3ISbIZIBoIG7bFsgwRm+","remoteAddr":"194.77.12.2","app":"PHP","message":"Array to string conversion at \/srv\/www\/owncloud\/lib\/private\/template\/functions.php#36","level":3,"time":"2015-07-08T14:47:18+00:00"}

schiessle commented 9 years ago

@walllenium "migrate" is the right one "migrate-keys" should no longer exists, it was the command from the old app. I will update the documentation

wallenium commented 9 years ago

same on the link (occ comands)

orson74 commented 9 years ago

created a new issue for 0 byte files #17496

AndyMcSchopf commented 9 years ago

I checked it. It was part of the probelm (the header of the file missed the sign). after that the migration seemed to go through. BUT no user, even admin, cannot read there files. So something went still wrong.

Update: With: orson74s fix: "i copied the my private key from encryyption_migration_backup to files_encryption/OC_DEFAULT_MODULE"

it is working now!

alexboss commented 9 years ago

Thanks for your feedback @schiesbn concerning

Try to apply these two patches to your system and run occ encryption:migrate

The command now executes nicely with the following output

Reorganize system folder structure
Migrating keys for users on backend Database
   owncloud.username

Nevertheless, when I connect to the owncloud GUI afterwards, I still have the message

You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run 'occ encryption:migrate' or contact your administrator

When I access a file, still the message

Module with id: OC_DEFAULT_MODULE does not exist. Please enable it in your apps settings or contact your administrator.

Running the command SELECT * FROMoc_appconfig WHEREappidLIKE '%encryption%' LIMIT 0 , 30 outputs

appid               configkey               configvalue
encryption          enabled                 yes
encryption          installed_version       1.0.0
encryption          publicShareKeyId        pubShare_76...
encryption          types                   filesystem
files_encryption    installed_version       0.7.1

Output of occ encryption:status

 - enabled: true
 - defaultModule:

Output of occ encryption:enable

Encryption is already enabled
No encryption module is loaded

Output of occ encryption:list-modules

(empty)

So problems still persists apparently.

fersingb commented 9 years ago

@orson74 Which one? The one in your own folder or the one in your data root?