Key Storage is not ready

possible_bug
help

#1

user@host:/gel_backups$ sudo -u www-data php /var/www/owncloud/occ encryption:change-key-storage-root ../gel_backups/keys/
Change key storage root from default storage location to ../gel_backups/keys/
Start to move keys:
985 [============================]
Key storage root successfully changed to ../gel_backups/keys/
rsaour@CS-TEST-OWNCLOUD-WEB-01:/gel_backups$ sudo -u www-data php /var/www/owncloud/occ encryption:show-key-storage-root
An unhandled exception has been thrown:
exception 'OC\ServiceUnavailableException' with message 'Key Storage is not ready' in /var/www/owncloud/lib/private/Encryption/Manager.php:113
Stack trace:

0 /var/www/owncloud/apps/encryption/appinfo/app.php(27): OC\Encryption\Manager->isReady()


#2

Please report this to the bugtracker and fill out the template shown when creating a new issue:


#3

Had the same problem here.
To fix it, I did this:
1) in the database, fix the encryption_key_storage_root:
update oc_appconfig set configvalue = '/home/owncloud/data' where configkey = 'encryption_key_storage_root';
(my directory was moved from the default, if you are using the default, just leave it blank - configvalue = ' ')

2) touch .oc_key_storage (in the directory that's supposed to be your root key storage). That file should be there for Owncloud to recognize that directory as a Storage Key Root.

3) sudo -u apache php occ maintenance:singleuser --off (to turn singleuser off)

4) if this don't work, and you are sure that the path on the configkey encryption_key_storage_root is %100 right, edit /var/www/html/owncloud/lib/private/Encryption/Manager.php , and change the line 280:
original:

275 // check if key storage is mounted correctly
276 if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) {
277 return true;
278 }
279
280 return false;
281 }

changed:

5 // check if key storage is mounted correctly
276 if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) {
277 return true;
278 }
279
280 return true;
281 }

that allowed me to access the data, and get everything back. After recovering the data, I've reinstalled the server.
Of course, I was sure that the encryption keys (files_encryption directories) were under /home/owncloud/data (in my example).
Hope it helps!