Unable to rescan files, files inaccessible after upgrade from v18 to v19

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 19.0.1
Operating system and version (eg, Ubuntu 20.04): CentOS 8
Apache or nginx version (eg, Apache 2.4.25): httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64
PHP version (eg, 7.1): 7.2.11

The issue you are facing:
After using the web interface to update from v18 to v19, everything seemed fine and there were no errors during upgrade. On closer inspection tho, files became inaccessible. Clicking on any file in web interface yields Error loading [file] message.

I tried doing a rescan:

occ files:scan --all
Starting scan for user 1 out of 3226 (0027C895-504A-4548-A0D7-C94DF93DC589)
Home storage for user 0027C895-504A-4548-A0D7-C94DF93DC589 not writable
Make sure you're running the scan command only as the user the web server runs as

It’ll report the same error for all scanned files. File permissions seem to be fine:

drwxr-x--- 3232 apache apache 159744 Aug 13 16:50 data
drwxr-xr-x  2 apache apache       6 Aug 13 16:35 0027C895-504A-4548-A0D7-C94DF93DC589

I also recursively chowned nextcloud dir (which contains data dir as well) to apache:apache just in case:
chown -R apache:apache nextcloud/

I wrapped occ command in a bash script, and it does run as apache user, so that shouldn’t be the issue here:

nextcloud:/var/www/html/nextcloud # which occ
/usr/bin/occ
nextcloud:/var/www/html/nextcloud # cat /usr/bin/occ 
#!/bin/bash

sudo -u apache php /var/www/html/nextcloud/occ $@

Contents of data/update.log:

2020-08-13T13:22:48+0000 hFuopFuq6R [info] request to updater
2020-08-13T13:22:48+0000 hFuopFuq6R [info] currentStep()
2020-08-13T13:22:48+0000 hFuopFuq6R [info] show HTML page
2020-08-13T13:22:48+0000 hFuopFuq6R [info] current version: 18.0.6 build time: 2020-06-09T07:36:10+00:00 dbb46a72b1cafa15c330515ee2bd0caf8d5151eb
2020-08-13T13:22:48+0000 hFuopFuq6R [info] getUpdateServerResponse()
2020-08-13T13:22:48+0000 hFuopFuq6R [info] updaterServer: https://updates.nextcloud.com/updater_server/
2020-08-13T13:22:48+0000 hFuopFuq6R [info] releaseChannel: stable
2020-08-13T13:22:48+0000 hFuopFuq6R [info] internal version: 18.0.6.0
2020-08-13T13:22:48+0000 hFuopFuq6R [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x2x11
2020-08-13T13:22:48+0000 hFuopFuq6R [info] getUpdateServerResponse response: Array
(
    [version] => 19.0.1.1
    [versionstring] => Nextcloud 19.0.1
    [url] => https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip
    [web] => https://docs.nextcloud.com/server/19/admin_manual/maintenance/upgrade.html
    [changes] => https://updates.nextcloud.com/changelog_server/?version=19.0.1
    [autoupdater] => 1
    [eol] => 0
    [signature] => uTYzr6YDYDK68A8fZ42IOzQEmilMNmsX4L1bypJkkAN/UOBP5ZK8tc/hgSrmXd4t
g0f7/c39nYo9CfMs8swPYCqTt7mbgx+z/LxlVJXNJeQkYEtLIA+kczQKNprY/c4E
wNk/dR5uVMqmlkAhQVXwJ8M4D30t1wJ8235XRLYtOfxowE+OQLLkYaDNEyU0pJK5
jCKI42xQJyO1bn0FAvGR5zqyWeHSXJKr5fleDw/L8ozPCZIgppGbigvwhOWE+Exs
bsf53THWtncb19OL626j8RbgQ3EuN4uSU7cp1pGqkg/kzQdBxR7TXcOqNMw8tiPC
CsKuFqRI37eQhbI/i2nrjg==
)

2020-08-13T13:22:48+0000 hFuopFuq6R [info] checkForUpdate() Array
(
    [version] => 19.0.1.1
    [versionstring] => Nextcloud 19.0.1
    [url] => https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip
    [web] => https://docs.nextcloud.com/server/19/admin_manual/maintenance/upgrade.html
    [changes] => https://updates.nextcloud.com/changelog_server/?version=19.0.1
    [autoupdater] => 1
    [eol] => 0
    [signature] => uTYzr6YDYDK68A8fZ42IOzQEmilMNmsX4L1bypJkkAN/UOBP5ZK8tc/hgSrmXd4t
g0f7/c39nYo9CfMs8swPYCqTt7mbgx+z/LxlVJXNJeQkYEtLIA+kczQKNprY/c4E
wNk/dR5uVMqmlkAhQVXwJ8M4D30t1wJ8235XRLYtOfxowE+OQLLkYaDNEyU0pJK5
jCKI42xQJyO1bn0FAvGR5zqyWeHSXJKr5fleDw/L8ozPCZIgppGbigvwhOWE+Exs
bsf53THWtncb19OL626j8RbgQ3EuN4uSU7cp1pGqkg/kzQdBxR7TXcOqNMw8tiPC
CsKuFqRI37eQhbI/i2nrjg==
)

2020-08-13T13:22:48+0000 hFuopFuq6R [info] getChangelogURL()
2020-08-13T13:22:48+0000 hFuopFuq6R [info] end of checkForUpdate() Update to Nextcloud 19.0.1 available. (channel: "stable")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light">https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip</code><br /><a class="external_link" href="https://nextcloud.com/changelog/#19-0-1" target="_blank" rel="noreferrer noopener">Open changelog ↗</a>
2020-08-13T13:23:00+0000 1DxRz84GKm [info] request to updater
2020-08-13T13:23:00+0000 1DxRz84GKm [info] currentStep()
2020-08-13T13:23:00+0000 1DxRz84GKm [info] POST request for step "1"
2020-08-13T13:23:00+0000 1DxRz84GKm [info] startStep("1")
2020-08-13T13:23:00+0000 1DxRz84GKm [info] checkForExpectedFilesAndFolders()
2020-08-13T13:23:00+0000 1DxRz84GKm [info] end of checkForExpectedFilesAndFolders()
2020-08-13T13:23:00+0000 1DxRz84GKm [info] endStep("1")
2020-08-13T13:23:00+0000 ExnzutiqcC [info] request to updater
2020-08-13T13:23:00+0000 ExnzutiqcC [info] currentStep()
2020-08-13T13:23:00+0000 ExnzutiqcC [info] Step 1 is in state "end".
2020-08-13T13:23:00+0000 ExnzutiqcC [info] POST request for step "2"
2020-08-13T13:23:00+0000 ExnzutiqcC [info] startStep("2")
2020-08-13T13:23:00+0000 ExnzutiqcC [info] checkWritePermissions()
2020-08-13T13:23:00+0000 ExnzutiqcC [info] end of checkWritePermissions()
2020-08-13T13:23:00+0000 ExnzutiqcC [info] endStep("2")
2020-08-13T13:23:00+0000 HBil3xb8SX [info] request to updater
2020-08-13T13:23:00+0000 HBil3xb8SX [info] currentStep()
2020-08-13T13:23:00+0000 HBil3xb8SX [info] Step 2 is in state "end".
2020-08-13T13:23:00+0000 HBil3xb8SX [info] POST request for step "3"
2020-08-13T13:23:01+0000 HBil3xb8SX [info] startStep("3")
2020-08-13T13:23:01+0000 HBil3xb8SX [info] createBackup()
2020-08-13T13:23:27+0000 HBil3xb8SX [info] end of createBackup()
2020-08-13T13:23:27+0000 HBil3xb8SX [info] endStep("3")
2020-08-13T13:23:27+0000 v4chRBbXWT [info] request to updater
2020-08-13T13:23:27+0000 v4chRBbXWT [info] currentStep()
2020-08-13T13:23:27+0000 v4chRBbXWT [info] Step 3 is in state "end".
2020-08-13T13:23:27+0000 v4chRBbXWT [info] POST request for step "4"
2020-08-13T13:23:27+0000 v4chRBbXWT [info] startStep("4")
2020-08-13T13:23:27+0000 v4chRBbXWT [info] downloadUpdate()
2020-08-13T13:23:27+0000 v4chRBbXWT [info] getUpdateServerResponse()
2020-08-13T13:23:27+0000 v4chRBbXWT [info] updaterServer: https://updates.nextcloud.com/updater_server/
2020-08-13T13:23:27+0000 v4chRBbXWT [info] releaseChannel: stable
2020-08-13T13:23:27+0000 v4chRBbXWT [info] internal version: 18.0.6.0
2020-08-13T13:23:27+0000 v4chRBbXWT [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x2x11
2020-08-13T13:23:27+0000 v4chRBbXWT [info] getUpdateServerResponse response: Array
(
    [version] => 19.0.1.1
    [versionstring] => Nextcloud 19.0.1
    [url] => https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip
    [web] => https://docs.nextcloud.com/server/19/admin_manual/maintenance/upgrade.html
    [changes] => https://updates.nextcloud.com/changelog_server/?version=19.0.1
    [autoupdater] => 1
    [eol] => 0
    [signature] => uTYzr6YDYDK68A8fZ42IOzQEmilMNmsX4L1bypJkkAN/UOBP5ZK8tc/hgSrmXd4t
g0f7/c39nYo9CfMs8swPYCqTt7mbgx+z/LxlVJXNJeQkYEtLIA+kczQKNprY/c4E
wNk/dR5uVMqmlkAhQVXwJ8M4D30t1wJ8235XRLYtOfxowE+OQLLkYaDNEyU0pJK5
jCKI42xQJyO1bn0FAvGR5zqyWeHSXJKr5fleDw/L8ozPCZIgppGbigvwhOWE+Exs
bsf53THWtncb19OL626j8RbgQ3EuN4uSU7cp1pGqkg/kzQdBxR7TXcOqNMw8tiPC
CsKuFqRI37eQhbI/i2nrjg==
)

2020-08-13T13:23:27+0000 v4chRBbXWT [info] storage location exists
2020-08-13T13:23:31+0000 v4chRBbXWT [info] end of downloadUpdate()
2020-08-13T13:23:31+0000 v4chRBbXWT [info] endStep("4")
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] request to updater
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] currentStep()
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] Step 4 is in state "end".
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] POST request for step "5"
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] startStep("5")
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] verifyIntegrity()
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] getUpdateServerResponse()
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] updaterServer: https://updates.nextcloud.com/updater_server/
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] releaseChannel: stable
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] internal version: 18.0.6.0
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x2x11
2020-08-13T13:23:31+0000 M0nkim4lyZ [info] getUpdateServerResponse response: Array
(
    [version] => 19.0.1.1
    [versionstring] => Nextcloud 19.0.1
    [url] => https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip
    [web] => https://docs.nextcloud.com/server/19/admin_manual/maintenance/upgrade.html
    [changes] => https://updates.nextcloud.com/changelog_server/?version=19.0.1
    [autoupdater] => 1
    [eol] => 0
    [signature] => uTYzr6YDYDK68A8fZ42IOzQEmilMNmsX4L1bypJkkAN/UOBP5ZK8tc/hgSrmXd4t
g0f7/c39nYo9CfMs8swPYCqTt7mbgx+z/LxlVJXNJeQkYEtLIA+kczQKNprY/c4E
wNk/dR5uVMqmlkAhQVXwJ8M4D30t1wJ8235XRLYtOfxowE+OQLLkYaDNEyU0pJK5
jCKI42xQJyO1bn0FAvGR5zqyWeHSXJKr5fleDw/L8ozPCZIgppGbigvwhOWE+Exs
bsf53THWtncb19OL626j8RbgQ3EuN4uSU7cp1pGqkg/kzQdBxR7TXcOqNMw8tiPC
CsKuFqRI37eQhbI/i2nrjg==
)

2020-08-13T13:23:31+0000 M0nkim4lyZ [info] storage location: /var/www/html/nextcloud/data/updater-octf6dqfurel/downloads/
2020-08-13T13:23:33+0000 M0nkim4lyZ [info] end of verifyIntegrity()
2020-08-13T13:23:33+0000 M0nkim4lyZ [info] endStep("5")
2020-08-13T13:23:33+0000 0SH0IAriuB [info] request to updater
2020-08-13T13:23:33+0000 0SH0IAriuB [info] currentStep()
2020-08-13T13:23:33+0000 0SH0IAriuB [info] Step 5 is in state "end".
2020-08-13T13:23:33+0000 0SH0IAriuB [info] POST request for step "6"
2020-08-13T13:23:33+0000 0SH0IAriuB [info] startStep("6")
2020-08-13T13:23:33+0000 0SH0IAriuB [info] extractDownload()
2020-08-13T13:23:33+0000 0SH0IAriuB [info] storage location: /var/www/html/nextcloud/data/updater-octf6dqfurel/downloads/
2020-08-13T13:23:37+0000 0SH0IAriuB [info] end of extractDownload()
2020-08-13T13:23:37+0000 0SH0IAriuB [info] endStep("6")
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] request to updater
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] currentStep()
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] Step 6 is in state "end".
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] POST request for step "7"
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] startStep("7")
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] setMaintenanceMode("true")
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] configFileName /var/www/html/nextcloud/updater/../config/config.php
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] end of setMaintenanceMode()
2020-08-13T13:23:37+0000 w3ukyhHBEY [info] endStep("7")
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] request to updater
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] currentStep()
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] Step 7 is in state "end".
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] POST request for step "8"
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] startStep("8")
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replaceEntryPoints()
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace index.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace status.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace remote.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace public.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace ocs/v1.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] replace ocs/v2.php
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] end of replaceEntryPoints()
2020-08-13T13:23:37+0000 1xMbvj9B3v [info] endStep("8")
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] request to updater
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] currentStep()
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] Step 8 is in state "end".
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] POST request for step "9"
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] startStep("9")
2020-08-13T13:23:37+0000 hdS9qh8tgE [info] deleteOldFiles()
2020-08-13T13:23:38+0000 hdS9qh8tgE [info] config sample exists
2020-08-13T13:23:38+0000 hdS9qh8tgE [info] themes README exists
2020-08-13T13:23:41+0000 hdS9qh8tgE [info] end of deleteOldFiles()
2020-08-13T13:23:41+0000 hdS9qh8tgE [info] endStep("9")
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] request to updater
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] currentStep()
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] Step 9 is in state "end".
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] POST request for step "10"
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] startStep("10")
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] moveNewVersionInPlace()
2020-08-13T13:23:41+0000 oIK62Fnx2t [info] storage location: /var/www/html/nextcloud/data/updater-octf6dqfurel/downloads/nextcloud/
2020-08-13T13:23:42+0000 oIK62Fnx2t [info] end of moveNewVersionInPlace()
2020-08-13T13:23:42+0000 oIK62Fnx2t [info] endStep("10")
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] request to updater
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] currentStep()
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] Step 10 is in state "end".
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] POST request for step "11"
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] startStep("11")
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] setMaintenanceMode("false")
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] configFileName /var/www/html/nextcloud/updater/../config/config.php
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] end of setMaintenanceMode()
2020-08-13T13:24:32+0000 NRHRZAmQiy [info] endStep("11")
2020-08-13T13:24:32+0000 6UyP21jxzr [info] request to updater
2020-08-13T13:24:32+0000 6UyP21jxzr [info] currentStep()
2020-08-13T13:24:32+0000 6UyP21jxzr [info] Step 11 is in state "end".
2020-08-13T13:24:32+0000 6UyP21jxzr [info] POST request for step "12"
2020-08-13T13:24:33+0000 6UyP21jxzr [info] startStep("12")
2020-08-13T13:24:33+0000 6UyP21jxzr [info] finalize()
2020-08-13T13:24:33+0000 6UyP21jxzr [info] storage location: /var/www/html/nextcloud/data/updater-octf6dqfurel/downloads/nextcloud/
2020-08-13T13:24:33+0000 6UyP21jxzr [info] call opcache_reset()
2020-08-13T13:24:33+0000 6UyP21jxzr [info] end of finalize()
2020-08-13T13:24:33+0000 6UyP21jxzr [info] endStep("12")

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Upgrade from 18.0.7 to 19.0.1 using web interface
  2. Check if you can access files in web interface

The output of your Nextcloud log in Admin > Logging:

Warning	OC\Log\Rotate	Log file "/var/log/nextcloud/nextcloud.log" was over 104857600 bytes, moved to "/var/log/nextcloud/nextcloud.log.1"

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

nextcloud:/var/www/html/nextcloud # cat config/config.php 
<?php
$CONFIG = array (
  'instanceid' => 'removed',
  'passwordsalt' => 'removed',
  'secret' => 'removed',
  'trusted_domains' => 
  array (
    0 => 'removed',
    1 => 'removed',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'overwrite.cli.url' => 'removed',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'removed',
  'dbpassword' => 'removed',
  'installed' => true,
  'maintenance' => false,
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0,
  ),
  'theme' => '',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'logfilemode' => 416,
  'loglevel' => 2,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'default_language' => 'sl',
  'default_locale' => 'sl_SI',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\Image',
    8 => 'OC\\Preview\\Photoshop',
    9 => 'OC\\Preview\\TIFF',
    10 => 'OC\\Preview\\SVG',
    11 => 'OC\\Preview\\Font',
    12 => 'OC\\Preview\\MP3',
    13 => 'OC\\Preview\\Movie',
    14 => 'OC\\Preview\\MKV',
    15 => 'OC\\Preview\\MP4',
    16 => 'OC\\Preview\\AVI',
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

Nothing out of the ordinary

Do you have 3226 users with names like 0027C895-504A-4548-A0D7-C94DF93DC589 ?
Perhaps your directorys are at the wrong position or there is a problem with the database.

Is this an output in one directory (nextcloud-dir)?
Users are not at this level. Users are in “data”.

Perhaps you can also re-use this update-function (command line). Perhaps you get nicer errors.

Read at position " Using the command line based update"

comamnd for you:
sudo -u apache2 php updater/updater.phar

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/update.html

I beleive that’s normal for LDAP users, and yes, there are a lot. File locations shouldn’t be any different from before, there could be something wrong with the DB tho. I remember I had to execute two occ commands to update some tables manually after the upgrade. Sadly, I don’t have them in history tho.

Yeah, sorry. The way I pasted it could be a bit confusing. /data resides in /nextcloud dir, and user directories are inside /data dir. I just combined outputs to make it clear that the permissions are fine.

I can’t rerun the upgrade, because it “successfully” upgraded before:

nextcloud:/var/www/html/nextcloud # sudo -u apache php updater/updater.phar 
Nextcloud Updater - version: v17.0.1-1-gf9724f4 dirty

Current version is 19.0.1.

No update available.

Nothing to do.

Can you execute it without /usr/bin/occ:

sudo -u apache php /var/www/html/nextcloud/occ files:scan --all

Change wrong permissions again. Then repeat command. Post errors.

nextcloud:/var/www/html # chown -R apache:apache nextcloud/ 
nextcloud:/var/www/html # ll
total 291332
drwxr-xr-x  2 apache apache        22 Nov 11  2019 info
drwxr-x--- 14 apache apache      4096 Aug 17 12:01 nextcloud
-rw-r--r--  1 root   root    83842356 Nov  7  2019 nextcloud-17.0.1.zip
-rw-r--r--  1 root   root   107208956 Mar 18 15:30 nextcloud-18.0.3.zip
-rw-r--r--  1 root   root   107260727 Apr 22 21:35 nextcloud-18.0.4.zip
nextcloud:/var/www/html # sudo -u apache php /var/www/html/nextcloud/occ files:scan --all
Starting scan for user 1 out of 3226 (0027C895-504A-4548-A0D7-C94DF93DC589)
Home storage for user 0027C895-504A-4548-A0D7-C94DF93DC589 not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 3226 (00306EB9-7828-4C4E-B46F-9EDB6D42AFA8)
Home storage for user 00306EB9-7828-4C4E-B46F-9EDB6D42AFA8 not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 3 out of 3226 (003EBD7F-A9AF-4209-B651-606FA6037FD5)
Home storage for user 003EBD7F-A9AF-4209-B651-606FA6037FD5 not writable
Make sure you're running the scan command only as the user the web server runs as

I aborted execution with ctrl+c, because it’s outputting the same errors as I mentioned before.