nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.4k stars 4.07k forks source link

Session drops and most pages don't load after upgrading to 13.0.0 Beta 3 #7612

Closed qouoq closed 6 years ago

qouoq commented 6 years ago

I used to have a working Nextcloud 12 install. Three days ago it would not open, I think I got a blank page upon login. When that happened before, I used to be able to solve by removing the cookies. Since I still couldn't access after removing the cookies, and I didn't update my server for a long time, I decided to update, and due to the incompatibility between PHP 7.2 and Nextcloud 12, I installed Nextcloud 13. The upgrade process from Nextcloud 12 to 13 didn't work from the web interface, but it went uneventfully using occ command.

Right now I can open the Nextcloud Log in page, I cannot log in with the "Log in" button (it remains on the Log in page), but I can log in by ticking "Stay logged in". If I do that, I get to the Files page, which remains empty and enters a refresh loop with the message "Problem loading page, reloading in 5 seconds". From there, I can access most Settings pages, except Logging, which remains on the loading animation. Also Basic settings says: "Error occurred while checking server setup". The pages Apps and Users enter a refresh loop too. Last symptom, if I load the site again, it goes to a blank page, and I need to remove the cookies to be able to access the Log in page.

The only app that I enabled before is Contacts, I tried to disable it, it didn't help. I ran occ maintenance:repair, which completed without any message that seemed notable.

The server is working as expected with a desktop sync client, so through WebDAV if I understand correctly.


My system

Config files

Nexcloud config.php ```php 'oca8598edaf8', 'passwordsalt' => 'xxx', 'trusted_domains' => array ( 0 => 'files.mydomain.net', ), 'apps_paths' => array ( 0 => array ( 'path' => '/usr/share/webapps/nextcloud/apps', 'url' => '/apps', 'writable' => false, ), 1 => array ( 'path' => '/usr/share/webapps/nextcloud/apps2', 'url' => '/apps2', 'writable' => true, ), ), 'datadirectory' => '/usr/share/webapps/nextcloud/data', 'dbtype' => 'pgsql', 'version' => '13.0.0.8', 'dbname' => 'owncloud', 'dbhost' => 'localhost', 'dbtableprefix' => 'oc_', 'dbuser' => 'owncloud', 'dbpassword' => '', 'installed' => true, 'theme' => '', 'maintenance' => false, 'secret' => 'xxx', 'overwriteprotocol' => 'https', 'loglevel' => 0, 'trashbin_retention_obligation' => '10', 'htaccess.RewriteBase' => '/', 'memcache.local' => '\\OC\\Memcache\\APCu', 'overwrite.cli.url' => 'https://files.mydomain.net', ); ```
nginx nextcloud.conf ```nginx configuration file # Path to the root of your installation root /usr/share/webapps/nextcloud/; # ACME challenge include conf.d/letsencrypt.conf; location = /robots.txt { allow all; log_not_found off; access_log off; } # The following 2 rules are only needed for the user_webfinger app. # Uncomment it if you're planning to use this app. #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json # last; location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; } # set max upload size client_max_body_size 4000M; fastcgi_read_timeout 600; fastcgi_buffers 64 4K; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Uncomment if your server is build with the ngx_pagespeed module # This module is currently not supported. #pagespeed off; location / { rewrite ^ /index.php$uri; } #location / { # try_files $uri $uri/ /index.php; #} location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) { #fastcgi_split_path_info ^(.+\.php)(/.*)$; #include fastcgi_params; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param PATH_INFO $fastcgi_path_info; #fastcgi_param HTTPS on; ##Avoid sending the security headers twice #fastcgi_param modHeadersAvailable true; #fastcgi_param front_controller_active true; #fastcgi_pass php-handler; #fastcgi_intercept_errors on; #fastcgi_request_buffering off; include uwsgi_params; uwsgi_modifier1 14; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; #uwsgi_pass 127.0.0.1:3001; uwsgi_pass unix:/run/uwsgi/nextcloud.sock; } location ~ ^/(?:updater|ocs-provider)(?:$|/) { try_files $uri/ =404; index index.php; } # Adding the cache control header for js and css files # Make sure it is BELOW the PHP block location ~* \.(?:css|js|woff|svg|gif)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control "public, max-age=7200"; # Optional: Don't log access to assets access_log off; } location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args; # Optional: Don't log access to other assets access_log off; } ```
uwsgi nextcloud.ini ```dosini [uwsgi] ; load the required plugins plugins = php ; force the sapi name to 'apache', this will enable the opcode cache php-sapi-name = apache ; set master process name and socket ; '%n' refers to the name of this configuration file without extension procname-master = uwsgi %n master = true socket = /run/uwsgi/%n.sock ; drop privileges uid = http gid = http umask = 027 ; run with at least 1 process but increase up to 4 when needed processes = 4 cheaper = 1 ; reload whenever this config file changes ; %p is the full path of the current config file touch-reload = %p ; disable uWSGI request logging ;disable-logging = true ; enforce a DOCUMENT_ROOT php-docroot = /usr/share/webapps/%n ; limit allowed extensions php-allowed-ext = .php ; and search for index.php if required php-index = index.php ; set php configuration for this instance of php, no need to edit global php.ini php-set = date.timezone=Etc/UTC ;php-set = open_basedir=/tmp/:/usr/share/webapps/nextcloud:/etc/webapps/nextcloud:/dev/urandom php-set = expose_php=false ; avoid security risk of leaving sessions in world-readable /tmp ;php-set = session.save_path=/usr/share/webapps/nextcloud/data php-set = session.save_path=/var/lib/php/sessions ; port of php directives set upstream in /usr/share/webapps/nextcloud/.user.ini for use with PHP-FPM php-set = upload_max_filesize=513M php-set = post_max_size=513M php-set = memory_limit=512M php-set = output_buffering=off ; load all extensions only in this instance of php, no need to edit global php.ini ;; required core modules php-set = extension=gd php-set = extension=iconv ;php-set = extension=zip # enabled by default in global php.ini ;; database connectors ;; uncomment your selected driver ;php-set = extension=pdo_sqlite ;php-set = extension=pdo_mysql php-set = extension=pdo_pgsql ;; recommended extensions ;php-set = extension=curl # enabled by default in global php.ini php-set = extension=bz2 php-set = extension=intl ;; required for specific apps ;php-set = extension=ldap # for LDAP integration ;php-set = extension=ftp # for FTP storage / external user authentication ;php-set = extension=imap # for external user authentication, requires php-imap ;; recommended for specific apps ;php-set = extension=exif # for image rotation in pictures app, requires exiv2 ;php-set = extension=gmp # for SFTP storage ;; for preview generation ;; provided by packages in AUR ; php-set = extension=imagick ; opcache php-set = zend_extension=opcache ; user cache ; provided by php-acpu, to be enabled **either** here **or** in /etc/php/conf.d/apcu.ini ;php-set = extension=apcu ; per https://github.com/krakjoe/apcu/blob/simplify/INSTALL php-set = apc.ttl=7200 php-set = apc.enable_cli=1 cron2 = minute=-15,unique=1 /usr/bin/php -f /usr/share/webapps/nextcloud/cron.php 1>/dev/null ```

Logs

The following logs are from a click on the "Log in" button

Nextcloud log (loglevel=0) ```json {"reqId":"kJErNTjC3zLSBD3qw5uT","level":0,"time":"2017-12-19T15:13:17+00:00","remoteAddr":"127.0.0.1","user":"--","app":"no app in context","method":"GET","url":"\/index.php\/apps\/files\/","message":"Current user is not logged in","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:57.0) Gecko\/20100101 Firefox\/57.0","version":"13.0.0.8"} {"reqId":"pWWU7pwghFUPuhMFflcs","level":0,"time":"2017-12-19T15:13:17+00:00","remoteAddr":"127.0.0.1","user":"--","app":"core","method":"GET","url":"\/index.php\/login?redirect_url=\/index.php\/apps\/files\/","message":"Scss is disabled for \/usr\/share\/webapps\/nextcloud\/core\/css\/jquery-ui-fixes.scss, ignoring","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:57.0) Gecko\/20100101 Firefox\/57.0","version":"13.0.0.8"} {"reqId":"pWWU7pwghFUPuhMFflcs","level":0,"time":"2017-12-19T15:13:17+00:00","remoteAddr":"127.0.0.1","user":"--","app":"core","method":"GET","url":"\/index.php\/login?redirect_url=\/index.php\/apps\/files\/","message":"Scss is disabled for \/usr\/share\/webapps\/nextcloud\/core\/css\/server.scss, ignoring","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:57.0) Gecko\/20100101 Firefox\/57.0","version":"13.0.0.8"} {"reqId":"pWWU7pwghFUPuhMFflcs","level":0,"time":"2017-12-19T15:13:17+00:00","remoteAddr":"127.0.0.1","user":"--","app":"core","method":"GET","url":"\/index.php\/login?redirect_url=\/index.php\/apps\/files\/","message":"Scss is disabled for \/usr\/share\/webapps\/nextcloud\/core\/css\/share.scss, ignoring","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:57.0) Gecko\/20100101 Firefox\/57.0","version":"13.0.0.8"} {"reqId":"pWWU7pwghFUPuhMFflcs","level":0,"time":"2017-12-19T15:13:17+00:00","remoteAddr":"127.0.0.1","user":"--","app":"core","method":"GET","url":"\/index.php\/login?redirect_url=\/index.php\/apps\/files\/","message":"Scss is disabled for \/usr\/share\/webapps\/nextcloud\/core\/css\/jquery.ocdialog.scss, ignoring","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:57.0) Gecko\/20100101 Firefox\/57.0","version":"13.0.0.8"} ```
nginx access.log ``` 127.0.0.1 - - [20/Dec/2017:00:05:19 +0800] "POST /index.php/login HTTP/1.1" 303 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" 127.0.0.1 - - [20/Dec/2017:00:05:19 +0800] "GET /index.php/apps/files/ HTTP/1.1" 303 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" 127.0.0.1 - - [20/Dec/2017:00:05:19 +0800] "GET /index.php/login?redirect_url=/index.php/apps/files/ HTTP/1.1" 200 3167 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" ```
uwsgi log ``` uwsgi[222]: [pid: 273|app: -1|req: -1/378] 127.0.0.1 () {48 vars in 1233 bytes} [Wed Dec 20 00:07:39 2017] POST /index.php/login?redirect_url=/index.php/apps/files/ => generated 0 bytes in 138 msecs (HTTP/1.1 303) 13 headers in 843 bytes (0 switches on core 0) uwsgi[222]: [pid: 273|app: -1|req: -1/379] 127.0.0.1 () {44 vars in 1057 bytes} [Wed Dec 20 00:07:39 2017] GET /index.php/apps/files/ => generated 0 bytes in 25 msecs (HTTP/1.1 303) 12 headers in 771 bytes (0 switches on core 0) uwsgi[222]: [pid: 273|app: -1|req: -1/380] 127.0.0.1 () {44 vars in 1116 bytes} [Wed Dec 20 00:07:39 2017] GET /index.php/login?redirect_url=/index.php/apps/files/ => generated 10222 bytes in 45 msecs (HTTP/1.1 200) 12 headers in 723 bytes (0 switches on core 0) uwsgi[222]: [pid: 273|app: -1|req: -1/381] 127.0.0.1 () {48 vars in 1012 bytes} [Wed Dec 20 00:07:41 2017] PROPFIND /remote.php/dav/files/li/ => generated 510 bytes in 38 msecs (HTTP/1.1 207) 13 headers in 758 bytes (0 switches on core 0) ```
MorrisJobke commented 6 years ago

A white page indicates a severe error. The nextcloud.log doesn't hold anything valuable. Please check the php-fpm error log for more details.

Sorry for the long time - hopefully the issue is gone for you. Please try to upgrade to 13.0.0 first and check if the php log has anything meaningful. Until then I will close this ticket - we are happy to reopen if you notice some traceable problems.

Thanks

sdfg2 commented 6 years ago

I just manually installed on gentoo. I too am using uwsgi and nginx, and I get the same results in the logs. I can log in ok using Vivaldi on the local network, Chrome refuses to play ball remotely, Firefox 'sort of' works remotely (it logs in only if you select 'stay logged in', and then it comes up with 'problem loading page'. Closing and restarting Firefox then makes it work ok.) Android NC client has no problems remotely, nor does dav.

Given there is a difference in how different browsers are responding to this, I wonder if it's a session problem. I have just spent an hour or so researching this, and I see a few people pointing to problems with the ability of php to write sessions files on the server, but I don't seem to have that problem.

(Yeah I know I need to update a lot of these, but I'm planning on migrating to arch from gentoo for my server. Plus, this has been happening for me since NC11, but I locked myself out the house earlier and discovered I need this to work so I can log in and get my contacts' phone numbers to get my spare keys heh)

MorrisJobke commented 6 years ago

uwsgi 2.0.15

I never have used a setup with uwsgi. PHP-FPM worked always quite nice with nginx. See also the nginx documentation page: https://docs.nextcloud.com/server/13/admin_manual/installation/nginx.html

klada commented 6 years ago

I am facing the same issue on Debian with uWSGI 2.0.14 and PHP 7.0.27 with a fresh installation of Nextcloud 13.0.1 (new instance, no upgrade). I could never get past the login page (after login I got a redirect from index.php/apps/files back to /index.php/login?redirect_url=/index.php/apps/files/)

@sdfg2 @qouoq Did you ever get to the root of this issue?

And your point regarding the "stay logged in" checkbox is quite interesting. In my case I also got past the login page with this option, but all XHR requests failed with some HTTP 4xx code. The Nextcloud log keeps saying "Current user is not logged in" for these requests.

I figured out that using uwsgi in standalone mode (without nginx) actually works (with http-socket), but obviously you would always want to run an actual web server in front of uwsgi. Could you please test if uWSGI in standalone mode (without Nginx) works for you? This might help to tackle this down a bit.