Problem migrating existing OwnCloud installation to different server + different domain

Hi,

I’m currently trying to migrate an existing OwnCloud 10.4.1 installation (cloud.aujardin.com) to a different server, and under a different domain (cloud.slackbox.fr). Here’s what I did so far.

  1. Dump the database and transfer dump.sql to the new server.
  2. Copy all OwnCloud files and data to the new server using rsync.
  3. Create an empty database on the new server.
  4. Import dump.sql.
  5. Edit config.php on the new server and adjust variables, e. g. trusted_domains, datadirectory, overwrite.cli.url, dbname, dbuser, dbpassword and apps_paths.

It looks like I have a partial success. I can login to cloud.slackbox.fr as any of the existing users and I can access their data. But I can’t write anything, e. g. I can’t use the web interface to create a directory or upload a file. And the OwnCloud client can’t sync anything.

I double-checked my permissions, which seem OK. And it’s also not SELinux-related.

Any suggestions?

Hi kikinovak,

do you use php-fpm? If so, do the folder permissions reflect the fpm user?

In any case, is it possible to write to your data directory without error? by eg

sudo -u www-data touch /path_to_your_data_directory/admin/files/touchtest.txt

If this doesn’t help please provide the output of owncloud log for exactly that time range when you wanted to upload/create a directory. You might want to lower the debug level.

Aditionally we could require some basic information about your Server Setup (OS/Webserver/…) as it was shown in the issue template.

Hi cortho,

Yes, I’m using PHP-FPM. The server is running Oracle Linux 7.9 (a Red Hat Enterprise Linux clone like CentOS).

So I followed your advice, and here’s what I got.

# sudo -u apache touch /var/www/slackbox-owncloud/html/data/microlinux/files/touchtest.txt
# ls -l /var/www/slackbox-owncloud/html/data/microlinux/files/
total 4908
drwxr-x---. 2 apache apache    4096 Aug 22  2019 Documents
-rw-r-----. 1 apache apache 5011365 Aug 22  2019 ownCloud Manual.pdf
drwxr-x---. 2 apache apache    4096 Aug 22  2019 Photos
drwxr-x---. 2 apache apache    4096 Feb 14 15:18 Test
-rw-r--r--. 1 apache apache       0 Feb 16 06:52 touchtest.txt

Here’s the virtual host configuration:

# cat /etc/httpd/conf.d/10-cloud.slackbox.fr-ssl.conf 
# /etc/httpd/conf.d/10-cloud.slackbox.fr-ssl.conf

# http://cloud.slackbox.fr -> https://cloud.slackbox.fr
<VirtualHost *:80>
  ServerName cloud.slackbox.fr
  Redirect / https://cloud.slackbox.fr
</VirtualHost>

# https://cloud.slackbox.fr
<VirtualHost _default_:443>
  ServerAdmin info@microlinux.fr
  DocumentRoot "/var/www/slackbox-owncloud/html"
  <Directory "/var/www/slackbox-owncloud/html">
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
  ServerName cloud.slackbox.fr:443
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/sd-155842.dedibox.fr/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/sd-155842.dedibox.fr/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/sd-155842.dedibox.fr/fullchain.pem
  BrowserMatch "MSIE [2-5]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
  ErrorLog logs/cloud.slackbox.fr-error_log
  CustomLog logs/cloud.slackbox.fr-access_log common
</VirtualHost>

For setting file permissions, I used the script from the OwnCloud documentation:

# ls -l /var/www/slackbox-owncloud/
total 4
drwxr-x---. 14 microlinux apache 4096 May  8  2020 html
[root@sd-155842:~] # ls -l /var/www/slackbox-owncloud/html
total 376
drwxr-x---. 22 apache     apache   4096 Apr 15  2020 apps
drwxr-x---.  3 apache     apache   4096 May  8  2020 apps-external
-rw-r-----.  1 microlinux apache   8859 Apr 15  2020 AUTHORS
-rw-r-----.  1 microlinux apache 200376 Apr 15  2020 CHANGELOG.md
drwxr-x---.  2 apache     apache   4096 Feb 14 18:17 config
-rw-r-----.  1 microlinux apache   4624 Apr 15  2020 console.php
-rw-r-----.  1 microlinux apache  34520 Apr 15  2020 COPYING
drwxr-x---. 16 microlinux apache   4096 Apr 15  2020 core
-rw-r-----.  1 microlinux apache   1717 Apr 15  2020 cron.php
drwxr-x---.  7 apache     apache   4096 Feb 14 15:50 data
-rw-r-----.  1 microlinux apache  31204 Apr 15  2020 db_structure.xml
-rw-r-----.  1 microlinux apache    179 Apr 15  2020 index.html
-rw-r-----.  1 microlinux apache   3524 Apr 15  2020 index.php
drwxr-x---.  6 microlinux apache   4096 Apr 15  2020 lib
-rwxr-x--x.  1 microlinux apache    283 Apr 15  2020 occ
drwxr-x---.  2 microlinux apache   4096 Apr 15  2020 ocm-provider
drwxr-x---.  2 microlinux apache   4096 Apr 15  2020 ocs
drwxr-x---.  2 microlinux apache   4096 Apr 15  2020 ocs-provider
-rw-r-----.  1 microlinux apache   3135 Apr 15  2020 public.php
-rw-r-----.  1 microlinux apache   2157 Apr 15  2020 README.md
-rw-r-----.  1 microlinux apache   5618 Apr 15  2020 remote.php
drwxr-x---.  4 microlinux apache   4096 Apr 15  2020 resources
-rw-r-----.  1 microlinux apache     26 Apr 15  2020 robots.txt
drwxr-x---. 12 microlinux apache   4096 Apr 15  2020 settings
-rw-r-----.  1 microlinux apache   2231 Apr 15  2020 status.php
drwxr-x---.  6 apache     apache   4096 Nov 14  2019 updater
-rw-r-----.  1 microlinux apache    280 Apr 15  2020 version.php

OwnCloud has been running fine for years on half a dozen servers, without a hiccup. But this is the first time I actually try to clone an installation to a different server with a different domain. I’m doing this for testing purposes mainly.

Uh oh and it looks like I’m on to something because I just took a peek in owncloud.log, and it’s filled with the following:

{"reqId":"fa7a65b0-37b0-411e-972d-2d167e7f1083","level":3,"time":"2021-02-14T20:24:17+00:00","remoteAddr":"88.161.127
.222","user":"microlinux","app":"no app in context","method":"PROPFIND","url":"\/remote.php\/dav\/files\/microlinux\/
","message":"User backend OC\\User\\Database is returning home: \/var\/www\/slackbox-owncloud\/html\/data\/microlinux
for user: microlinux which differs from existing value: \/var\/www\/aujardin-owncloud\/html\/data\/microlinux"}
{"reqId":"85558610-1609-4a46-8112-6978dae5b804","level":3,"time":"2021-02-14T20:29:17+00:00","remoteAddr":"88.161.127
.222","user":"microlinux","app":"no app in context","method":"PROPFIND","url":"\/remote.php\/dav\/files\/microlinux\/
","message":"User backend OC\\User\\Database is returning home: \/var\/www\/slackbox-owncloud\/html\/data\/microlinux
for user: microlinux which differs from existing value: \/var\/www\/aujardin-owncloud\/html\/data\/microlinux"}

Here’s what my config.php looks like (except the password):

<?php
$CONFIG = array (
  'instanceid' => 'ocghcg4ouqo7',
  'passwordsalt' => '9bOeyjIkRnwuEeR1YsvLLRLCx7zlr5',
  'secret' => '9xlfua1f3sprpFqq7wdyUkJmC6n267OYkvz89pY00y60fpPQ',
  'trusted_domains' =>
  array (
    0 => 'cloud.slackbox.fr',
  ),
  'datadirectory' => '/var/www/slackbox-owncloud/html/data',
  'overwrite.cli.url' => 'https://cloud.slackbox.fr',
  'dbtype' => 'mysql',
  'version' => '10.4.1.3',
  'dbname' => 'slackbox-owncloud',
  'dbhost' => 'localhost:3306',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'slackboxuser',
  'dbpassword' => 'my_db_password_here',
  'logtimezone' => 'UTC',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/slackbox-owncloud/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/slackbox-owncloud/html/apps-external',
      'url' => '/apps-external',
      'writable' => true,
    ),
  ),
  'installed' => true,
  'has_rebuilt_cache' => true,
  'maintenance' => false,
  'loglevel' => 2,
);

I have a vague intuition this has something to do with this:

'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),

Any suggestions ?

Cheers from the sunny South of France,

Niki

After (much) more experimenting, I finally found the culprit. Initially, I copied over my existing installation residing in /var/www/aujardin-owncloud/html to /var/www/slackbox-owncloud/html. Apparently it’s not enough to edit config.php accordingly. It looks like the absolute filepath to data/ is also hardcoded in the database (which is a weird design choice).

I repeated the experience, only this time I kept the initial absolute filepath on my copy, and things went perfectly, e. g. I can create directories using the web client, upload files, etc.

So now the question is: how can I tell my installation to use a different file path to things? Do I have to jump through burning loops to configure this? Or is this some simple one-liner somewhere?

Cheers,

Niki

1 Like

Hi again,

I’m glad you found the issue. Your question regarding the data directory is answered in the docs:

https://doc.owncloud.com/server/admin_manual/maintenance/manually-moving-data-folders.html

1 Like

Worked like a charm. Thanks very much.

1 Like