Repository navigation
Description
Steps to reproduce
- Have a working installation of owncloud version 7.0.4.2 with files_encryption enabled.
- Attempt to upgrade to owncloud 8.0.0.7.
Expected behaviour
The upgrade should succeed.
Actual behaviour
The upgrade hangs. After disabling maintenance mode and trying again, it still hangs.
After disabling files_encryption through the occ console, the upgrade succeeded. However, encrypted files are not decrypted (and owncloud does not prompt users to decrypt their files). After re-enabling files_encryption, owncloud shows the upgrade-screen again. Upgrading still fails.
Server configuration
Operating system: Ubuntu 12.04
Web server: Apache 2.4.9
Database: MySQL
PHP version: 5.5.12
ownCloud version: 7.0.4.2=>8.0.0.7
Updated from an older ownCloud or fresh install: During upgrading
List of activated apps:
- files
- files_encryption
- files_external
- files_pdfviewer
- files_sharing
- files_texteditor
- files_trashbin
- files_versions
- files_videoviewer
- firstrunwizard
- gallery
- templateeditor
- updater
The content of config/config.php:
<?php
$CONFIG = array (
'instanceid' => 'oc2197ab4a5f',
'trusted_domains' =>
array (
0 => 'kepow.org',
),
'datadirectory' => '/www/kepow/owncloud_data',
'dbtype' => 'mysql',
'version' => '8.0.0.7',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_Thomas',
'installed' => true,
'forcessl' => true,
'mail_smtpmode' => 'php',
'mail_smtpname' => 'thomas',
'maintenance' => true,
'theme' => '',
);
Are you using external storage, if yes which one: No.
Are you using encryption: Yes.
Client configuration
Browser: Issue occurs on firefox and chrome
Operating system: Windows
Logs
Web server error log
No errors are logged during the upgrade process.
ownCloud log (data/owncloud.log)
First try:
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#282","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#283","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#284","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#287","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#288","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#289","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"PHP","message":"opendir(\/www\/kepow\/owncloud_data\/files_encryption\/keyfiles): failed to open dir: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#78","level":3,"time":"2015-02-09T20:51:06+00:00"}
{"reqId":"230bd67050902ddeb36c9af31787d650","remoteAddr":"84.85.215.83","app":"core","message":"unable to rename, file does not exists : files_encryption\/Jordi.private.key","level":3,"time":"2015-02-09T20:53:38+00:00"}
Retry:
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#282","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#283","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#284","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#287","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#288","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"Cannot modify header information - headers already sent at \/www\/kepow\/owncloud\/lib\/private\/user\/session.php#289","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"copy(\/www\/kepow\/owncloud_data\/owncloud_private_key): failed to open stream: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#211","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"copy(\/www\/kepow\/owncloud_data\/public-keys): failed to open stream: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#211","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"opendir(\/www\/kepow\/owncloud_data\/public-keys): failed to open dir: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#78","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"opendir(\/www\/kepow\/owncloud_data\/files_encryption\/keyfiles): failed to open dir: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#78","level":3,"time":"2015-02-09T20:55:39+00:00"}
{"reqId":"1637703e855ad9def0d8b34063f10a6e","remoteAddr":"84.85.215.83","app":"PHP","message":"opendir(\/www\/kepow\/owncloud_data\/owncloud_private_key): failed to open dir: No such file or directory at \/www\/kepow\/owncloud\/lib\/private\/files\/storage\/local.php#78","level":3,"time":"2015-02-09T20:55:39+00:00"}
Browser log
Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.min.js:1
Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery-migrate.min.js:3
Content Security Policy: The page's settings blocked the loading of a resource at self ("script-src https://kepow.org 'unsafe-eval'"). index.php
Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.min.js:5
Activity
MorrisJobke commentedon Feb 9, 2015
cc @schiesbn
doits commentedon Feb 9, 2015
I had the same "problem" with the hang but eventually the upgrade did not hang but instead was simply taking a really long time (> 30 minutes).
straceshowed the update process was opening each encrypted file (that's why I know it was doing something and therefore I did not abort it) and it was doing it at about 5 files per second ... so if you have a lot of number of files it can take some time. Maybe that's the cause here?Edit: The file the upgrade opened were all located in the subfolder
data/username/files_encryption/and ended with.keyorfileKeyor.shareKey- so I assume it encryption had to be updated.tomcur commentedon Feb 9, 2015
It's certainly a possibility. I've had the upgrader running for a while (~1 hour), and I don't have a large number of files per se. I'm currently running it again and am logging the system calls using strace. It's still going strong (and quick), but I am seeing some errors, such as:
I also noticed that a problem with the private key associated with the user Jordi was reported in the errors logged in owncloud.log for the first upgrade attempt.
schiessle commentedon Feb 9, 2015
The upgrade will rename all encryption keys. If you have a lot of files this can take some time. We needed to re-structure the way the keys are stored to avoid file name collisions for some rare username-filename combinations. Before the upgrade script starts to rename the encryption keys it creates a backup of all your keys. So nothing should be lost. If you know how the key where stored in OC7 you can restore the backup and try to run the migration again with the occ script.
If you are not sure how to restore the backup I can give you more details tomorrow.
tomcur commentedon Feb 9, 2015
I am not entirely sure how to restore the backup. Because of several upgrade attempts I now have a number of folders with names such as
encryption_migration_backup_2015-02-09_16-07-16. I believe the folders from the first attempt contain everything I need.Should I just copy the contents of all these folders from the first attempt back to their parent directories (i.e.,
cp -a ./ ../) and then remove the backup folders?kkretsch commentedon Feb 10, 2015
Having a similar problem I switched back to 704. I have nearly 10GB of encrypted media which seems to upgrade for such a long time OC9 might even be released befaore it finishes.
Any hints how to upgrade in a reasonable timeframe?
schiessle commentedon Feb 10, 2015
@Beskhue yes, take the backup from the first attempt because this should contain the state from OC7. Every user should have such a backup folder. Just that we don't lose any state I would make a manual backup from each users files_encryption folder in the current state, then delete the content of the files_encryption folder. Now copy the content of
encryption_migration_backup_<date>from the first attempt for each users to files_encryption folder.Also in
data/you should have a system wide 'files_encryption' folder for which also backups with the patternencryption_migration_backup_<date>should exists. Like for the users first backup the existing files_encryption folder and then copy the backup to the system wide files_encryption folder.Afterwards try to run the migration again
./occ encryption:migrate-keys. I would also suggest to stop your web server before you perform this steps, just to make sure that no update gets triggered somewhere in between or that any sync client tries to read some files etc.schiessle commentedon Feb 10, 2015
@kkretsch we need to rename all encryption keys, there is no way arround it. Depending on how many files you have and how often they are shared you have more or less keys we need to migrate. But the keys are quite small files, we don't touch the actual files. So the crucial factor is the number if files and how often they are shared, not the size of the files. Renaming the keys should be possible in a reasonable time, depending on you hard disc performance. I would suggest to shutdown your web server and trigger the update with the occ command line tool to avoid any timeouts.
inotriel commentedon Feb 10, 2015
Maybe this is the "problem" I mentioned here #13992 (comment)
I have about 7 oder 8 thousand files in my oc and the harddisk might not be the fastest in the world. So waiting for about 30 minutes maybe was just to little time.
Is there any chance to see if occ is still working or stuck?
schiessle commentedon Feb 10, 2015
You could monitor the files_encryption folder of your users the size of some of the folders should change from time to time if it still runs. Also the backup folders should appear over time for the users.
inotriel commentedon Feb 10, 2015
Good idea, thank you. I'll give it another try tonight!
24 remaining items
PVince81 commentedon Feb 27, 2015
Looks like it's spending time trying to propagate/calculate the folder sizes, even for "files_encryption" ?! That should be blocked and maybe rescanned at the end.
That might be what is causing the 255K database queries...
icewind1991 commentedon Feb 27, 2015
#14573 Should greatly reduce the time the migration takes, does anyone here with a large amount of encrypted data have the opportunity to retest the migration with that patch
PVince81 commentedon Feb 27, 2015
I also noticed that the keys are copied but not moved from the old "keyfiles" to the new "keys" folder. Maybe moving them (if possible) that could provide an additional boost.
I'll retest with that PR first.
PVince81 commentedon Feb 27, 2015
The PR works well, I also improved it further.
DeepDiver1975 commentedon Mar 2, 2015
too late for 8.0.1 -> 8.0.2
rjaeckel commentedon Mar 26, 2015
I also had the Issue that after the Timeout occured, the encryption-keys got currupted.
For anyone who needs to recove the previous keys as well, here is a script generating the actions to be made to recover the pre-update state
DeepDiver1975 commentedon Mar 30, 2015
the long execution time of the key migration will be fixed with 8.0.3
rsling commentedon May 13, 2015
Well, it was not fixed, at least not for me! I tried multiple times to upgrade from 7 to 8.0.3 on a Debian system. The installation has 5 users and 100GB total, some folders with many small files. After 4 days, I interrupted the procedure. strace showed that the updater kept working on tens of thousands of encryption keys. This is completely useless!
rjaeckel commentedon May 26, 2015
@DeepDiver1975
what about considering pcntl as an option? this would make it possible to use the whole computing power... there are several libraries here on github providing
php threadsthis way.hostingnuggets commentedon Sep 30, 2015
This issue has not been fixed, see #19319