$absolutePath must be relative to "files"

Nextcloud version: 11.0.3.2
Operating system and version: no idea (I am at all inkl)
Apache or nginx version: no idea (I am at all inkl)
PHP version: 7.0
Is this the first time you’ve seen this error?: Yes.
Can you reliably replicate it? (If so, please outline steps): Yes, I just have to enter this in the shell: ./occ upgrade

Dear all,

I got the info that a new version of NC is out. Just pressed the upgrade button and everything went well until the setup gets to the nextcloud login page. This is the error I get:

Set log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Disabled 3rd-party app: bookmarks
Disabled 3rd-party app: calendar
Disabled 3rd-party app: contacts
Disabled 3rd-party app: files_markdown
Disabled 3rd-party app: keeweb
Disabled 3rd-party app: notes
Disabled 3rd-party app: rainloop
Disabled 3rd-party app: spreed
Disabled 3rd-party app: tasks
Disabled 3rd-party app: templateeditor
Updating …
InvalidArgumentException: $absolutePath must be relative to "files"
Update failed

Would be great if someone has an idea…

Cheers
Max

@LukasReschke any ideas?

If you don’t get an answer soon, please report to https://github.com/nextcloud/updater/issues

Can you provide some more information such as the version that you were gonna update to?

Hello Lukas,

thanks for your reply. I wanted to upgrade from 11.0.3.2 to 12.0.1
the last lines from updater.log:

2017-08-08T21:16:53+0200 gESPNzewiJ [info] internal version: 11.0.3.2
2017-08-08T21:16:53+0200 gESPNzewiJ [info] getUpdateServerResponse response: Array
(
[version] => 12.0.1.5
[versionstring] => Nextcloud 12.0.1
[url] => https://download.nextcloud.com/server/prereleases/nextcloud-12.0.1.zip
[web] => https://docs.nextcloud.com/server/11/admin_manual/maintenance/upgrade.html
[autoupdater] => 1
[signature] => R6+aQoW/L0L7RyM/ER06kH7XJHyskvmuOHcUKIydWGbFN1PQTjblqXiiUcsmFtsD
+ZLeiPtWg3wquzuA3GWk7vrJrRvIKgXXXyq9ywSleHU
qd9CCurtREBZVmaQLy79+aXvan+pSvq4f9kl9jVVDp/v9QDpaHSLtKrUCHGgyQZO
0APf4QTMn+JlXXXXXXXXXXXXXXXXX==
)

2017-08-08T21:16:53+0200 gESPNzewiJ [info] storage location exists
2017-08-08T21:17:33+0200 gESPNzewiJ [info] end of downloadUpdate()
2017-08-08T21:17:33+0200 gESPNzewiJ [info] endStep(“5”)
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] request to updater
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] currentStep()
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] Step 5 is in state “end”.
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] POST request for step "6"
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] startStep(“6”)
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] extractDownload()
2017-08-08T21:17:33+0200 EYNiIGIvpf [info] storage location: /www/htdocs/xxxx/wolke/data/updater-ocu3d6cgenj0/downloads/
2017-08-08T21:17:34+0200 EYNiIGIvpf [info] end of extractDownload()
2017-08-08T21:17:34+0200 EYNiIGIvpf [info] endStep(“6”)
2017-08-08T21:17:34+0200 78qvsTLehA [info] request to updater
2017-08-08T21:17:34+0200 78qvsTLehA [info] currentStep()
2017-08-08T21:17:34+0200 78qvsTLehA [info] Step 6 is in state “end”.
2017-08-08T21:17:34+0200 78qvsTLehA [info] POST request for step "7"
2017-08-08T21:17:34+0200 78qvsTLehA [info] startStep(“7”)
2017-08-08T21:17:34+0200 78qvsTLehA [info] replaceEntryPoints()
2017-08-08T21:17:34+0200 78qvsTLehA [info] replace index.php
2017-08-08T21:17:34+0200 78qvsTLehA [info] replace status.php
2017-08-08T21:17:34+0200 78qvsTLehA [info] replace remote.php
2017-08-08T21:17:34+0200 78qvsTLehA [info] replace public.php
2017-08-08T21:17:34+0200 78qvsTLehA [info] replace ocs/v1.php
2017-08-08T21:17:34+0200 78qvsTLehA [info] end of replaceEntryPoints()
2017-08-08T21:17:34+0200 78qvsTLehA [info] endStep(“7”)
2017-08-08T21:17:34+0200 Cxeun23Cym [info] request to updater
2017-08-08T21:17:34+0200 Cxeun23Cym [info] currentStep()
2017-08-08T21:17:34+0200 Cxeun23Cym [info] Step 7 is in state “end”.
2017-08-08T21:17:34+0200 Cxeun23Cym [info] POST request for step "8"
2017-08-08T21:17:34+0200 Cxeun23Cym [info] startStep(“8”)
2017-08-08T21:17:34+0200 Cxeun23Cym [info] deleteOldFiles()
2017-08-08T21:17:34+0200 Cxeun23Cym [info] config sample exists
2017-08-08T21:17:34+0200 Cxeun23Cym [info] thmes README exists
2017-08-08T21:17:35+0200 Cxeun23Cym [info] end of deleteOldFiles()
2017-08-08T21:17:35+0200 Cxeun23Cym [info] endStep(“8”)
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] request to updater
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] currentStep()
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] Step 8 is in state “end”.
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] POST request for step "9"
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] startStep(“9”)
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] moveNewVersionInPlace()
2017-08-08T21:17:35+0200 ldl8w3Peyf [info] storage location: /www/htdocs/xxxx/wolke/data/updater-ocu3d6cgenj0/downloads/nextcloud/
2017-08-08T21:17:36+0200 ldl8w3Peyf [info] end of moveNewVersionInPlace()
2017-08-08T21:17:36+0200 ldl8w3Peyf [info] endStep(“9”)
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] request to updater
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] currentStep()
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] Step 9 is in state “end”.
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] POST request for step "10"
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] startStep(“10”)
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] setMaintenanceMode(“false”)
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] configFileName /www/htdocs/xxxx/wolke/updater/…/config/config.php
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] end of setMaintenanceMode()
2017-08-08T21:18:03+0200 2KDfrU8VFU [info] endStep(“10”)
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] request to updater
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] currentStep()
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] Step 10 is in state “end”.
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] POST request for step "11"
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] startStep(“11”)
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] finalize()
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] storage location: /www/htdocs/xxxx/wolke/data/updater-ocu3d6cgenj0/downloads/nextcloud/
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] end of finalize()
2017-08-08T21:18:03+0200 8x4CPrq3nB [info] endStep(“11”)

Thank you so much for you help!

BR
Max

Just trying to help speeding this one up: there is no error message in your logs, only info messages.
Could you check the logs again if there is something that contains the error message from your initial post?

Hi Schmu,

if I run ./occ upgrade
i get this error:

Set log level to debug
Updating database schema
Updated database
Updating <theming> ...
InvalidArgumentException: $absolutePath must be relative to "files"
Update failed
Maintenance mode is kept active
Reset log level

In the updater.log there is no error.

The issues is related to the theming app I guess. I read several posts about this error but unfortunately I could not find any solution.

Hi,

Yes I saw these too, but the error messages were always different.

I grep the nextcloud directory for that error message and found:

# grep -r 'absolutePath must be' *
lib/private/Files/View.php:                             '$absolutePath must be relative to "files", value is "%s"',
lib/private/Files/View.php:                     throw new \InvalidArgumentException('$absolutePath must be relative to "files"');

This error message is part of the function

public function getPathRelativeToFiles($absolutePath) {
        $path = Filesystem::normalizePath($absolutePath);
        $parts = explode('/', trim($path, '/'), 3);
        // "$user", "files", "path/to/dir"
        if (!isset($parts[1]) || $parts[1] !== 'files') {
                $this->logger->error(
                        '$absolutePath must be relative to "files", value is "%s"',
                        [
                                $absolutePath
                        ]
                );
                throw new \InvalidArgumentException('$absolutePath must be relative to "files"');
        }
        if (isset($parts[2])) {
                return $parts[2];
        }
        return '';
}

And every other function that calls getPathRelativeToFiles is trying to lock a path or file when it tries to mount storage:

        private function lockPath($path, $type, $lockMountPoint = false) {
            $absolutePath = $this->getAbsolutePath($path);
            $absolutePath = Filesystem::normalizePath($absolutePath);
            if (!$this->shouldLockFile($absolutePath)) {
                    return false;
            }

            $mount = $this->getMountForLock($absolutePath, $lockMountPoint);
            if ($mount) {
                    try {
                            $storage = $mount->getStorage();
                            if ($storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
                                    $storage->acquireLock(
                                            $mount->getInternalPath($absolutePath),
                                            $type,
                                            $this->lockingProvider
                                    );
                            }
                    } catch (\OCP\Lock\LockedException $e) {
                            // rethrow with the a human-readable path
                            throw new \OCP\Lock\LockedException(
                                    $this->getPathRelativeToFiles($absolutePath),
                                    $e
                            );
                    }
            }

            return true;
    }

Is it possible that you use external storage or something like that?
I’m just guessing a bit, while I’m no developer unfortunately.

1 Like

Hello Schmu,

AWESOME :slight_smile:

I dont have the possibility to change to another storagem but I changed the path in the config.php file from:
'datadirectory' => '/www/htdocs/xxxx/wolke/data',

to
'datadirectory' => '/www/htdocs/xxxx/wolke/test',

And the weird thing is that the update did work now…

I just have to find a way to fix my data folder… Probably the userrights i guess.

Thanks for your help!

Oh cool :slight_smile: I didn’t expect that changing the data folder would help :smiley:

Do you have any soft links in your data folder? That’s the only thing I can think of right now, that might cause issues.
But yes, we could check the user rights as well.

Ja, weird… Isn’t it. No my data folder is just a normal folder. But I found a strange update folder in it. Maybe this caused the problem. Anyway I copied all files to the new test folder, renamed data to data_bad and then renamed test to data, changed the link in config.php and all looks good.

Thanks for your help

Did you change the location of the data folder at some point or is this still the data folder from the initial setup?

No, I never changed the data folder. (Exept of now)
In the original data folder there was this updater-ocu3dxxxbla folder. Can the issue be related to this?

Cheers
Max

You should not change the data folder, since that may cause some issues with update steps that access files.

If you receive $absolutePath must be relative to "files" there should also be a message in your data/nextcloud.log file, containing the path that was tried to be accessed.

Has anyone of you a log entry that contains: $absolutePath must be relative to "files", value is
or $absolutePath must be relative to \"files\", value is ?
If so that would be of very high interest.

The correct fix should be

Hi,

thanks very much for your reply.
I do have the message in my log file.

{main}\",\"File\":\"\\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php\",\"Line\":2088}","userAgent":"--","version":"12.0.1.5"}
{"reqId":"IEeUdCe4PsEensLgO1gy","level":3,"time":"2017-08-09T18:02:18+02:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Updater::failure: InvalidArgumentException: $absolutePath must be relative to \"files\"","userAgent":"--","version":"12.0.1.5"}
{"reqId":"IEeUdCe4PsEensLgO1gy","level":3,"time":"2017-08-09T18:02:18+02:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Updater::updateEnd: Update failed","userAgent":"--","version":"12.0.1.5"}
{"reqId":"IEeUdCe4PsEensLgO1gy","level":1,"time":"2017-08-09T18:02:18+02:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Updater::maintenanceActive: Maintenance mode is kept active","userAgent":"--","version":"12.0.1.5"}
{"reqId":"IEeUdCe4PsEensLgO1gy","level":1,"time":"2017-08-09T18:02:18+02:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Updater::resetLogLevel: Reset log level to Warning(2)","userAgent":"--","version":"12.0.1.5"}
{"reqId":"WYszqVUNkK8AAGCiO44AAAAL","level":3,"time":"2017-08-09T18:09:13+02:00","remoteAddr":"149.7.112.147","user":"--","app":"PHP","method":"GET","url":"\/","message":"file_get_contents(\/www\/htdocs\/xxxx\/wolke\/data\/appdata_ocu3d6cgenj0\/js\/core\/merged-template-prepend.js.deps): failed to open stream: No such file or directory at \/www\/htdocs\/xxxx\/wolke\/lib\/private\/Files\/Storage\/Local.php#209","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko\/20100101 Firefox\/45.0","version":"12.0.1.5"}
{"reqId":"WYszqVUNkK8AAGCiO44AAAAL","level":3,"time":"2017-08-09T18:09:13+02:00","remoteAddr":"149.7.112.147","user":"--","app":"PHP","method":"GET","url":"\/","message":"Invalid argument supplied for foreach() at \/www\/htdocs\/xxxx\/wolke\/lib\/private\/Template\/JSCombiner.php#107","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko\/20100101 Firefox\/45.0","version":"12.0.1.5"}
{"reqId":"WYszqVUNkK8AAGOBRVcAAAAN","level":3,"time":"2017-08-09T18:09:13+02:00","remoteAddr":"149.7.112.147","user":"--","app":"PHP","method":"GET","url":"\/index.php\/js\/core\/merged-template-prepend.js?v=8a3cb98b7e42f9cb077a2706373c8a8e-10","message":"file_get_contents(\/www\/htdocs\/xxxx\/wolke\/data\/appdata_ocu3d6cgenj0\/js\/core\/merged-template-prepend.js.gzip): failed to open stream: No such file or directory at \/www\/htdocs\/xxxx\/wolke\/lib\/private\/Files\/Storage\/Local.php#209","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko\/20100101 Firefox\/45.0","version":"12.0.1.5"}
{"reqId":"WYsz2FUNkK8AABbJQiUAAAAI","level":3,"time":"2017-08-09T18:10:01+02:00","remoteAddr":"149.7.112.147","user":"maxxx","app":"no app in context","method":"GET","url":"\/","message":"Exception: {\"Exception\":\"Symfony\\\\Component\\\\Routing\\\\Exception\\\\RouteNotFoundException\",\"Message\":\"Unable to generate a URL for the named route \\\"theming.Theming.getStylesheet\\\" as such route does not exist.\",\"Code\":0,\"Trace\":\"#0 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Route\\\/Router.php(339): Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGenerator->generate('theming.Theming...', Array, 1)\\n#1 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/URLGenerator.php(77): OC\\\\Route\\\\Router->generate('theming.Theming...', Array)\\n#2 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/apps\\\/theming_bck\\\/appinfo\\\/app.php(29): OC\\\\URLGenerator->linkToRoute('theming.Theming...', Array)\\n#3 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/legacy\\\/app.php(209): require_once('\\\/www\\\/htdocs\\\/v13...')\\n#4 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/legacy\\\/app.php(149): OC_App::requireAppFile('theming_bck')\\n#5 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/legacy\\\/app.php(124): OC_App::loadApp('theming_bck')\\n#6 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/base.php(989): OC_App::loadApps()\\n#7 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/index.php(48): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/3rdparty\\\/symfony\\\/routing\\\/Generator\\\/UrlGenerator.php\",\"Line\":130}","userAgent":"Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko\/20100101 Firefox\/45.0","version":"12.0.1.5"}

Cheers
Max

The First line is only half of it, and is the interesting line :wink:

{"reqId":"WNFcSVUNkK8AAEl9hOYAAAAD","remoteAddr":"149.7.112.147","app":"index","message":"Exception: {\"Exception\":\"InvalidArgumentException\",\"Message\":\"$absolutePath must be relative to \\\"files\\\"\",\"Code\":0,\"Trace\":\"#0 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php(1900): OC\\\\Files\\\\View->getPathRelativeToFiles('\\\/themedinstance...')\\n#1 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php(1997): OC\\\\Files\\\\View->lockPath('\\\/themedinstance...', 1, false)\\n#2 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php(1110): OC\\\\Files\\\\View->lockFile('\\\/themedinstance...', 1)\\n#3 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php(967): OC\\\\Files\\\\View->basicOperation('fopen', '\\\/themedinstance...', Array, 'r')\\n#4 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/Node\\\/File.php(94): OC\\\\Files\\\\View->fopen('\\\/themedinstance...', 'r')\\n#5 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/apps\\\/theming\\\/lib\\\/Controller\\\/ThemingController.php(273): OC\\\\Files\\\\Node\\\\File->fopen('r')\\n#6 [internal function]: OCA\\\\Theming\\\\Controller\\\\ThemingController->getLogo()\\n#7 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#8 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Theming\\\\Controller\\\\ThemingController), 'getLogo')\\n#9 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Theming\\\\Controller\\\\ThemingController), 'getLogo')\\n#10 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\Theming\\\\\\\\Con...', 'getLogo', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#11 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#12 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Route\\\/Router.php(299): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#13 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/base.php(1010): OC\\\\Route\\\\Router->match('\\\/apps\\\/theming\\\/l...')\\n#14 \\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/index.php(40): OC::handleRequest()\\n#15 {main}\",\"File\":\"\\\/www\\\/htdocs\\\/xxxx\\\/wolke\\\/lib\\\/private\\\/Files\\\/View.php\",\"Line\":2068}","level":3,"time":"2017-03-21T18:00:57+01:00","method":"GET","url":"\/index.php\/apps\/theming\/logo?v=10","user":"maxxx","version":"11.0.2.7"}

Better?

Yeah thanks, can you check if my patch also solves this?

Hi,

would love to test it but I guess I cant say if it works as the error does not appear anymore in my nextcloud.
To apply the patch I just copy its content to the View.php file, is this correct?

Cheers
Max

Mostly, or you change just the one line that is red and replace it with the green one