-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with upgrading files_encryption from OC 7 => OC 8 #14012
Comments
cc @schiesbn |
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). Edit: The file the upgrade opened were all located in the subfolder |
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. |
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. |
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 Should I just copy the contents of all these folders from the first attempt back to their parent directories (i.e., |
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? |
@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 Also in Afterwards try to run the migration again |
@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. |
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? |
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. |
Good idea, thank you. I'll give it another try tonight! |
I'm running the occ upgrade cmd now for 3h !!! I have something about 5GB total. I didn't have such an issue before with the encryption enabled. The process runs with about 3 to 8% CPU usage and I would like to know what he's doing.... oh wait. It just finished ... lol. I think it's definately a good idea to shut down the apache server. That's what I just did and the process finished right after... Could that be correlated? |
After removing two old entries in the Database that "local::/..." stuff with old path not existing any more I reran it on a clean version 7 restore using the command line and after under an hour it went thru without any error. The machine was using it2 100% cpu for that task, but there where still some spare cores left :-) |
If have about 135k (not including the files_encrytion folder) files that use about 75GB. I started the ./occ upgrade 12 hours ago and it is still running on an idle pc. As a rough calculation I expect the renaming process per file to be way faster than 50ms. With respect to the number of files it should not exceed 2 hours total. So in my opinion there is something broken. I don't find any other usefull information in my logs. |
If you want to see what it is doing (which files operating and how fast), use
For me it was about 3 file per second only. |
I have a very similar issue. However, the key migration stopped after two or three minutes. After restoring the key backup as explained by @schiesbn, I tried to restart the migration using ./occ encryption:migrate-keys, but that gives a InvalidArgumentException: "There are no commands defined in the "encryption" namespace." Not sure how to proceed now. |
Finished. It took me 22 hours to complete my 135k files upgrade. Sync clients are syncing again on all platforms but my webinterface stays blank. No idea why but i guess this is a seperate issue ... |
OMG. So if that is a point of reference I should wait some hours. We are using oc in a productive environment so ... well, it will be a little bit complicated. |
I ran into a similar issue: My library is about 60 GB including lots of small files, so I expect the process to take quite long. However, the update process stops with an fatal error after short time (1h).
Errors were slightly different for consecutive executions of the same command:
Any advice? [EDIT] I could not find this limitation of 3600 seconds for my php configuration. In php.ini the default value for max_execution_time is 30 seconds, in the owncloud directories I could not find anything that overwrites the default. |
Running ./occ upgrade does complete successfully (after 2 hours). However, after doing so I get the message "Encryption App is enabled but your keys are not initialized, please log-out and log-in again". In the log it says "Session does not contain a private key, maybe your login password changed" and "private key exists but public key is missing". I definitely did not change any password. Could something have gone wrong because the database schema update was run again on an already updated database? |
+1 |
What is your recommendation for users on shared hosting solutions? They often won't have ssh-access and no execution times of several hours. Wait for OC 8.0.1? |
@schiesbn |
My solution if you run into the 3600 second timeouts: Go to the file: "/var/www/owncloud/lib/base.php" and change the 3600 second timeout settings to 0. After that, the upgrade went through without any errors and all encrypted files are available again in the updated owncloud version without further issues. For me it took about 2 hours. The real pain is that parameters for php can be configured in various places which is irritating. Potential places which I checked first were the following, where I found settings which eventually were overwritten:
|
I finally managed to finish the upgrade. I misunderstood the explanation by @schiesbn: there should be no system wide files_encryption folder in /data; rather should the back up of system-wide folders (like public keys) be placed directly in /data. And ./occ encryption:migrate-keys is only available after a previous upgrade to 8 was completed, otherwise run ./occ upgrade. This was definitely one of the rougher owncloud upgrades, taking two hours on a small scale server. I doubt there's any reasonable application of this upgrade for large scale servers. |
@armaccloud Before running |
Many thanks to you both; I have managed to run the script. However it only performed the action on some files, the majority was not executed. Only the following couple of folders have been created and they are not complete by far; The following errors are appearing in the logs;
This might have to do with the folder path, which in the above example is the following: Also, the folder Makes it strange though, why e.g. the folders |
I ran the upgrade process again (thank Zeus for Thanks for your help, everyone! |
I have the same problem. I upgraded by running:
Env:
and now? |
Hello, I've managed to complete the upgrade. I'm using owncloud on a shared hosting and I had to mirror the installation on my local machine, do the upgrade, and redeploy. The update script ran around 12 hours and used more than 7 gigs of memory. With these requirements, I think there should be a warning on the upgrade page. I documented my process here: http://memin.tk/informatics/2015/02/22/Upgrading-to-Owncloud-8.html |
@icewind1991 can you please have a look at the encryption migration - https://github.com/owncloud/core/blob/master/apps/files_encryption/lib/migration.php ? The migration is using files view which is know to be performance intensive compared to using the storage directly - might this help here as well? The high memory consumption is a bit frightening as well 🙊 |
5 files a second ?! How can it be that slow ? |
If I remember well, some keys are cached within a single PHP call to speed up the upgrade and some file operations. If run during the upgrade, I wonder if that cache's size is increasing when there are many files. That cache should probably be adapted to have invalidation logic. |
I tried an upgrade with 1600 files, here is the result: https://blackfire.io/profiles/b07deb06-7a94-4e67-9479-a9e9798f2867/graph |
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... |
#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 |
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. |
The PR works well, I also improved it further. |
too late for 8.0.1 -> 8.0.2 |
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 #!/bin/bash
### !!! needs to be run as webserver-user
### !!! EDIT this pattern to match all user directories in OC data directory
userpattern='^(.{5}|cloud-administration-user)$'
# recover user keys
for username in $(ls -1tr|egrep -o $userpattern); do
backup=$(ls -1tr $username|egrep '^encryption_migration_backup'|head -n1)
if [ "x" != "x$backup" ]; then
# echo "$username --> $backup"
# create backup of broken state, just in case
echo "mv $username/files_encryption $username/files_encryption.broken"
# recreate the renamed folder
echo "mkdir -p $username/files_encryption"
# recover the pre-update state
echo "cp -r $username/$backup/* $username/files_encryption"
fi
done
# recover global encryption directories
globbackup=$(ls -1tr|egrep '^encryption_migration_backup'|head -n1)
for bu in $(ls -1 $globbackup); do
echo "mv $bu $bu.broken"
echo "cp -r $globbackup/$bu $bu"
done
|
the long execution time of the key migration will be fixed with 8.0.3 |
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! |
@DeepDiver1975 |
This issue has not been fixed, see #19319 |
Steps to reproduce
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:
The content of config/config.php:
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:
Retry:
Browser log
The text was updated successfully, but these errors were encountered: