Skip to content
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

[10.0] Moving home folder to new data dir breaks due to absolute path in DB #27693

Closed
PVince81 opened this issue Apr 20, 2017 · 7 comments
Closed

Comments

@PVince81
Copy link
Contributor

Steps

  1. Setup OC
  2. Create a user "user1"
  3. Login as "user1" once
  4. Log out
  5. Change the data dir in the config.php to another path "/somewhereelse/ocdata/" (and create
  6. Move the contents of the data dir there
  7. Login as "user1"
  8. Create a folder "test"

Expected result

Files app and Webdav must refuse to work with "StorageNotAvailableException" because the home folder cannot be found.

Actual result

Home folder gets recreated in the old location, with the new folder but not the old files... (which are still in oc_filecache).

Versions

ownCloud 10.0.0 RC1

Solution

Only allow creating the home folder in code whenever a user has never logged in before (lastLogin in DB is null). If the home folder is missing, throw StorageNotAvailableException.

For migration purposes, we'll need to introduce new occ commands:

Not tagging as regression as moving home folders in past versions could break in different ways.

@DeepDiver1975 @butonic @cdamken @pmaier1 FYI

@nightspotlight
Copy link

Looks like this issue exists in latest 10.0.2.

I've migrated my OC installation into Docker containers, I double checked everything in the new setup, but it didn't work properly (desktop clients get errors on sync, image preview doesn't work). Then I checked owncloud.log and saw the old data directory path. It seemed like OC simply ignored the updated datadirectory parameter. Then I grepped my database dump for the old path and was very surprised. Then I googled and found this issue. This is so frustrating considering that every other tutorial on the internet shows that updating datadirectory in config.php is enough. I've already spent a week slaving at my Docker OC setup trying to figure this out.

In my OC setup the hardcoded data directory path is seen in oc_accounts and oc_storages tables.

@butonic
Copy link
Member

butonic commented Aug 18, 2017

Instead of checking lastLogin != null I would prefer to check if the home storage has been created in he db. That is more correct.

btw. The home folder is hardcoded in the db in the account table intentionally to prevent data loss on unintended changes in ldap or the configuration.

@cdamken
Copy link
Contributor

cdamken commented Aug 18, 2017

@nightspotlight
Copy link

@cdamken sure, I saw the manual page. I've tried the SQL commands to update the paths, but it gave me "duplicate entry ... for key ..." errors. Using the UPDATE IGNORE syntax did not help. I gave up and took it as a chance to switch to ****cloud with a clean database and prepopulated data directory.

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

@PVince81
Copy link
Contributor Author

Ultimate solution: #29502.

In the meantime what we need: #27692

@felixboehm felixboehm removed this from the triage milestone Apr 10, 2018
@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants