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

config.php lost during upgrade #18973

Closed
julianuu opened this issue Jan 18, 2020 · 9 comments
Closed

config.php lost during upgrade #18973

julianuu opened this issue Jan 18, 2020 · 9 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug needs info

Comments

@julianuu
Copy link

julianuu commented Jan 18, 2020

Steps to reproduce

I didn't try to reproduce.

What happened is that after letting pacman update the packages from 17.0.1 to 17.0.2, it also updated php to 7.4.1, which nextcloud was not compatible with, and nextcloud complained. So I downgraded back to 7.3.12. Then when visiting the home page of my nextcloud installation, it did not ask to perform the upgrade, but to 'install nextcloud' and fill in the database name etc. Turns out the reason was that at some point /etc/webapps/nextcloud/config/config.php (which on arch is symlinked to /usr/share/webapps/nextcloud/config/config.php) has been replaced by a stub, see config report below. Here are the timestamps.
ls --full-time

-rw-r----- 1 http http    61 2020-01-07 15:50:31.880671374 +0100 config.php

/var/log/pacman.log

[2020-01-07T15:50:31+0100] [ALPM] warning: /etc/php/php.ini installed as /etc/php/php.ini.pacnew
[2020-01-07T15:50:31+0100] [ALPM] upgraded php (7.3.12-1 -> 7.4.1-1)
[2020-01-07T15:50:31+0100] [ALPM] upgraded php-gd (7.3.12-1 -> 7.4.1-1)
[2020-01-07T15:50:32+0100] [ALPM] warning: directory permissions differ on /usr/share/webapps/nextcloud/
…
[2020-01-07T15:50:37+0100] [ALPM] upgraded nextcloud (17.0.1-1 -> 17.0.2-1)

So I can't say if config.php got replaced during the php-update or the nextcloud-update.

I had no backup but I could make nextcloud run again by rewriting config.php by hand.

According to them its not pacmans fault.

maybe related:

Expected behaviour

Settings in config.php should not change after update.

Actual behaviour

config.php got replaced by one that contains nothing but an instanceid.

Server configuration

Operating system:
arch

Web server:
nginx 1.16.1

Database:
mariadb

PHP version:
7.3.12 / 7.4.1

Nextcloud version:
17.0.1

Updated from an older Nextcloud/ownCloud or fresh install:
updated

Where did you install Nextcloud from:
arch repository

Signing status:

Signing status

No errors since I fixed it already.

List of activated apps:

App list
Enabled:
  - accessibility: 1.3.0
  - activity: 2.10.1
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - dav: 1.13.0
  - federatedfilesharing: 1.7.0
  - federation: 1.7.0
  - files: 1.12.0
  - files_rightclick: 0.14.2
  - files_sharing: 1.9.0
  - files_trashbin: 1.7.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - gallery: 18.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - nextcloud_announcements: 1.6.0
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - password_policy: 1.7.0
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - recommendations: 0.5.0
  - serverinfo: 1.7.0
  - sharebymail: 1.7.0
  - support: 1.0.1
  - survey_client: 1.5.0
  - systemtags: 1.7.0
  - text: 1.1.1
  - theming: 1.8.0
  - twofactor_backupcodes: 1.6.0
  - updatenotification: 1.7.0
  - viewer: 1.2.0
  - workflowengine: 1.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - encryption
  - files_external
  - files_pdfviewer
  - user_ldap

Nextcloud configuration:

Config report
<?php
$CONFIG = array (
  'instanceid' => 'oce7zkjp9x37',
);

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Operating system: arch

Logs

Web server error log

Web server error log
Jan 07 15:50:34 wg-server nginx[198850]: 2020/01/07 15:50:34 [error] 198850#198850: *456899 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0PHP message: PHP Fatal error:  Unknown: Failed opening required '/usr/share/webapps/nextcloud/remote.php' (include_path='.:') in Unknown on line 0" while reading response header from upstream, client: xxxx, server: xxxx, request: "PROPFIND /remote.php/dav/files/xxxx/ HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "xxxx"
Jan 07 15:50:36 wg-server nginx[198850]: 2020/01/07 15:50:36 [error] 198850#198850: *456182 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0Unable to open primary script: /usr/share/webapps/nextcloud/remote.php (No such file or directory)" while reading response header from upstream, client: xxxx, server: xxxx, request: "PROPFIND /remote.php/dav/files/xxxx HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "xxxx"
Jan 07 15:50:36 wg-server nginx[198850]: 2020/01/07 15:50:36 [error] 198850#198850: *456182 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0Unable to open primary script: /usr/share/webapps/nextcloud/remote.php (No such file or directory)" while reading response header from upstream, client: xxxx, server: xxxx, request: "PROPFIND /remote.php/dav/files/xxxx", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "xxxx"
Jan 07 15:50:36 wg-server nginx[198850]: 2020/01/07 15:50:36 [error] 198850#198850: *456182 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0Unable to open primary script: /usr/share/webapps/nextcloud/remote.php (No such file or directory)" while reading response header from upstream, client: xxxx, server: xxxx, request: "PROPFIND /remote.php/dav/files/xxxx", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:",
host: "xxxx"

There is nothing really before or after.

Nextcloud log (data/nextcloud.log)

Nextcloud log
{"reqId":"o9zkWK47wWzjcEp1TlF9","level":3,"time":"2020-01-07T15:40:30+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/l
ib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/
602.1 (KHTML, like Gecko) qutebrowser\/1.8.3 Version\/10.0 Safari\/602.1","version":""}
{"reqId":"8SCktifTR2U7QuwoN6kg","level":3,"time":"2020-01-07T15:43:19+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.
so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-a
ndroid\/3.9.2","version":""}
{"reqId":"ZloWovKTT6KnoYIE7cMc","level":3,"time":"2020-01-07T15:43:20+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.
so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-a
ndroid\/3.9.2","version":""}
{"reqId":"kVbVbruEesnBh9Vx2eTG","level":3,"time":"2020-01-07T15:53:40+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.
so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-a
ndroid\/3.9.2","version":""}
{"reqId":"m7dMYak27HE5YsIUTz10","level":3,"time":"2020-01-07T15:53:42+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.
so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-a
ndroid\/3.9.2","version":""}
{"reqId":"Sgt2Igy8iU33NaWiqWuF","level":3,"time":"2020-01-07T15:55:31+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/csrftoken","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/module
s\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x
86_64) AppleWebKit\/602.1 (KHTML, like Gecko) qutebrowser\/1.8.3 Version\/10.0 Safari\/602.1","version":""}
{"reqId":"9oCOqsVJyC7SjQW5cUfH","level":3,"time":"2020-01-07T16:10:32+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/csrftoken","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/module
s\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x
86_64) AppleWebKit\/602.1 (KHTML, like Gecko) qutebrowser\/1.8.3 Version\/10.0 Safari\/602.1","version":""}
{"reqId":"fn4FyOkQTCIXxMBx2lcO","level":3,"time":"2020-01-07T16:15:02+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-android\/3.9.2","version":""}
{"reqId":"0grH2bjSsOSkdCQNfIDD","level":3,"time":"2020-01-07T16:15:02+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/204","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (Android) Nextcloud-android\/3.9.2","version":""}
{"reqId":"c6QZiFzeYgslAfHOVK7v","level":3,"time":"2020-01-07T16:25:36+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"\/index.php\/csrftoken","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/602.1 (KHTML, like Gecko) qutebrowser\/1.8.3 Version\/10.0 Safari\/602.1","version":""}
{"reqId":"M8Rx5d4bmx7wmFIwUy10","level":3,"time":"2020-01-07T16:29:04+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PROPFIND","url":"\/remote.php\/webdav\/xxxx","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla\/5.0 (iOS) Nextcloud-iOS\/2.25.3","version":""}
{"reqId":"ontQ9yoT6uqjU3Jg4kFB","level":3,"time":"2020-01-07T16:29:04+00:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PROPFIND","url":"\/remote.php\/webdav\/xxxx","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory))
at Unknown#0","userAgent":"Mozilla\/5.0 (iOS) Nextcloud-iOS\/2.25.3","version":""}
{"reqId":"0lsv6np5OYC0UhmkQV3k","level":3,"time":"2020-01-07T18:48:46+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'apcu.so' (tried: \/usr\/lib\/php\/modules\/apcu.so (\/usr\/lib\/php\/modules\/apcu.so: undefined symbol: php_error_docref), \/usr\/lib\/php\/modules\/apcu.so.so (\/usr\/lib\/php\/modules\/apcu.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":""}
{"reqId":"xiB9tD0Q7HugEfZ987Ep","level":3,"time":"2020-01-07T20:13:40+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'imagick' (tried: \/usr\/lib\/php\/modules\/imagick (\/usr\/lib\/php\/modules\/imagick: cannot open shared object file: No such file or directory), \/usr\/lib\/php\/modules\/imagick.so (libMagickWand-7.Q16HDRI.so.6: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":""}
{"reqId":"8GacFuNEMb0QZtOU14hc","level":3,"time":"2020-01-07T20:17:03+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'imagick' (tried: \/usr\/lib\/php\/modules\/imagick (\/usr\/lib\/php\/modules\/imagick: cannot open shared object file: No such file or directory), \/usr\/lib\/php\/modules\/imagick.so (libMagickWand-7.Q16HDRI.so.6: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":""}

I can post more logs is it makes sense.

EDIT: wrong version numbers for nextcloud and php

@julianuu julianuu added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jan 18, 2020
@svetlemodry
Copy link

svetlemodry commented Jan 19, 2020

This is rather an Arch packaging issue. The bug for the nextcloud Arch package is being tracker here.

@julianuu
Copy link
Author

Hm I don't know. Someone here pointed out that pacman should not be touching config.php since it's not part of the package. And this case appears to be by someone running ubuntu, however its older.

@svetlemodry
Copy link

So I gave it a quick test on my Arch laptop. Actually all seemed to have worked out allright, although I did not have nextcloud really running, just tested the install/update process.

I've installed the 17.0.2 package, created a config.php file in the symlinked /etc/webapps/nextcloud/config/config.php path, ran the update to 18.0.0, the user created config file was still in place as expected. Uninstalling the nextcloud package leaves the config.php untouched too. Looks like there is nothing wrong with the packaging itself.
Btw. in the bug report you mention

What happened is that after letting pacman update the packages from 17.0.2 to 17.0.3

but there was no 17.0.3 version of the nextcloud package, so I presume you mean the stable 18.0.0 version, right?

@julianuu
Copy link
Author

but there was no 17.0.3 version of the nextcloud package, so I presume you mean the stable 18.0.0 version, right?

Ah sorry, it was 17.0.1 -> 17.0.2 actually.

@svetlemodry
Copy link

So a quick check of the up 17.0.1 -> 17.0.2 upgrade, behaves fine too. The same way as the 17.0.2 -> 18.0.0 upgrade, config.php file is not touched and kept in place.
The one thing that comes to my mind is, there was a newer version of php released for Arch on 29.11.2019 after which the 17.0.2 version of nextcloud hit the repos on 1.1.2020.
If I am not mistaken, nextcloud 17.0.2 was not compatible with php 7.4.0 yet, so not sure if because of that, the trouble with the dissapearing config.php might have happened.

@julianuu
Copy link
Author

Yes, when doing the upgrade the new php got installed too and then nextcloud complained about it, so technically the php version I had while config.php was replaced was 7.4.1. Only after that did I downgrade php again

@kesselb
Copy link
Contributor

kesselb commented Jan 22, 2020

#18978
https://bugs.archlinux.org/task/64689#comment184108
https://bugs.archlinux.org/task/64689#comment184737

Just to mention it. It's probably not related to this security hardening. Actually we should not create config.php on the fly. Such code is predetermined to fail.

server/lib/base.php

Lines 242 to 243 in d05f131

$configFilePath = self::$configDir .'/config.php';
if(!file_exists($configFilePath)) {

If config is symlinked to /etc/webapps/nextcloud/config/ and Nextcloud is unable to read the file a new config.php is created.

<?php

var_dump(file_exists('config/config.php'));

Place it next to index.php (or console.php) and access the file via your webserver.

@szaimen
Copy link
Contributor

szaimen commented Jun 7, 2021

Is this Issue still valid in NC21.0.2? If not, please close this issue. Thanks! :)

@julianuu
Copy link
Author

julianuu commented Jun 7, 2021

Doesn't seem so :) At least it has not happened to me again. I'll close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug needs info
Projects
None yet
Development

No branches or pull requests

5 participants