Initial page corrupted

Nextcloud version (eg, 18.0.2): 19.0.2.
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): NGINX latest
PHP version (eg, 7.1): 7.4

The issue you are facing:

When I log on to my NC instance I get the username/pass screen. Then the totp screen.
After login is successful I should get redirected to the normal landing page (files I think?), but instead the page is corrupted as shown below. It does not matter which browsers I test this with and whether I am remote or on my lan. Even on the phone it looks the same. When I click on one of the apps (files, email, etc.) I go through to the normal page and everything works fine from there. When I click on skip to main content or navigation of app I just get returned to the same corrupted page…

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

Steps to replicate it:

  1. Log in using user/pass
  2. Enter totp token
  3. Voilá

The output of your Nextcloud log in Admin > Logging:

{"reqId":"R5rOKG3BO3izGM8gjf2i","level":3,"time":"2020-09-01T14:38:21+00:00","remoteAddr":"143.179.26.129","user":"mark","app":"index","method":"POST","url":"/apps/text/session/sync","message":{"Exception":"Exception","Message":"Argument 1 passed to OCA\\Text\\Controller\\SessionController::sync() must be of the type int, null given, called in /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 170","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func"},{"file":"/var/www/nextcloud/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":110,"Previous":{"Exception":"TypeError","Message":"Argument 1 passed to OCA\\Text\\Controller\\SessionController::sync() must be of the type int, null given, called in /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 170","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"sync","class":"OCA\\Text\\Controller\\SessionController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func"},{"file":"/var/www/nextcloud/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/text/lib/Controller/SessionController.php","Line":80},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Android 10; Mobile; rv:79.0) Gecko/79.0 Firefox/79.0","version":"19.0.2.2","id":"5f4f7f3435820"}

AND <<< I think the one below has been fixed, I had issues after upgrading to php 7.4, but I do not see this error anymore now.

{"reqId":"mmxphH3tFgpguh2IFHAS","level":3,"time":"2020-09-01T09:31:04+00:00","remoteAddr":"192.168.1.1","user":"--","app":"core","method":"GET","url":"/index.php/204","message":{"Exception":"Doctrine\\DBAL\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory","Code":0,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":889,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":194,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[],null]},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":200,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["SELECT * FROM `oc_appconfig`",[],[]]},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":216,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":331,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":109,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":287,"function":"getApps","class":"OC\\AppConfig","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":883,"function":"getValues","class":"OC\\AppConfig","type":"->","args":[false,"installed_version"]},{"file":"/var/www/nextcloud/lib/private/TemplateLayout.php","line":164,"function":"getAppVersions","class":"OC_App","type":"::","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":185,"function":"__construct","class":"OC\\TemplateLayout","type":"->","args":["error",""]},{"file":"/var/www/nextcloud/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":334,"function":"printPage","class":"OC\\Template\\Base","type":"->","args":[]},{"file":"/var/www/nextcloud/index.php","line":63,"function":"printExceptionErrorPage","class":"OC_Template","type":"::","args":[{"__class__":"Doctrine\\DBAL\\DBALException"},500]}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.12.1","version":"19.0.2.2","id":"5f4f7f3435c27"}

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

server {
    if ($host = my.website.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


server_name my.website.com;
#Your DDNS adress, (e.g. from desec.io or no-ip.com) 
listen 80 default_server;
location ^~ /.well-known/acme-challenge {
proxy_pass http://127.0.0.1:81;
proxy_set_header Host $host;
}
location / {
return 301 https://$host$request_uri;
}

location ^~ /.well-known/webfinger {
rewrite ^/\.well-known/webfinger /public.php?service=webfinger last;
}

}
server {
server_name my.website.com;
listen 443 ssl http2 default_server;
root /var/www/nextcloud/;
access_log /var/log/nginx/nextcloud.access.log main;
error_log /var/log/nginx/nextcloud.error.log warn;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
client_max_body_size 10240M;
location / {
rewrite ^ /index.php;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ \.(?:flv|mp4|mov|m4a)$ {
mp4;
mp4_buffer_size 100m;
mp4_max_buffer_size 1024m;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $fastcgi_script_name =404;
include fastcgi_params;
include php_optimization.conf;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
include php_optimization.conf;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|woff|svg|gif|png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
access_log off;
expires 30d;
}

    ssl_certificate /etc/letsencrypt/live/my.website.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/my.website.com/privkey.pem; # managed by Certbot
}

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

2020/09/02 00:00:07 [error] 588#588: *1883 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "PROPFIND /.well-known/webfinger HTTP/1.1", host: "my.website.com", referrer: "https://my.website.com/settings/admin/overview"
2020/09/02 00:04:00 [error] 588#588: *1881 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "GET /.well-known/webfinger?resource=acct:name@my.website.com HTTP/1.1", host: "my.website.com"
2020/09/02 00:04:07 [error] 588#588: *1881 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "GET /.well-known/webfinger?resource=acct:name@my.website.com HTTP/1.1", host: "my.website.com"
2020/09/02 00:04:15 [error] 588#588: *1881 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "GET /.well-known/webfinger HTTP/1.1", host: "my.website.com"
2020/09/02 00:52:37 [error] 596#596: *121 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "PROPFIND /.well-known/webfinger HTTP/1.1", host: "my.website.com", referrer: "https://my.website.com/settings/admin/overview"
2020/09/02 04:14:32 [error] 596#596: *1973 FastCGI sent in stderr: "Access to the script '/var/www/nextcloud/apps/firstrunwizard/img/Nextcloud.mp4' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.1.1, server: my.website.com, request: "GET /apps/firstrunwizard/img/Nextcloud.mp4 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "my.website.com", referrer: "https://my.website.com/apps/files/?dir=/&fileid=161"
2020/09/02 04:14:38 [error] 596#596: *1973 FastCGI sent in stderr: "Access to the script '/var/www/nextcloud/apps/firstrunwizard/img/Nextcloud.mp4' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.1.1, server: my.website.com, request: "GET /apps/firstrunwizard/img/Nextcloud.mp4 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "my.website.com", referrer: "https://my.website.com/apps/files/?dir=/&fileid=161"
2020/09/02 04:15:06 [error] 596#596: *2068 access forbidden by rule, client: 192.168.1.1, server: my.website.com, request: "PROPFIND /.well-known/webfinger HTTP/1.1", host: "my.website.com", referrer: "https://my.website.com/settings/admin/overview"

That seems odd. Do you use an unixsocket to connect to your DB? If not, maybe you use localhost instead of 127.0.0.1 to connect to your DB. This way the kernel, so I heard, translates this to an unixsocket, which is a file.
Try 127.0.0.1 as db host then instead of localhost

From another similar problem:
“The issue that arose here is that “localhost” uses a UNIX socket and can not find the database in the standard directory. However “127.0.0.1” uses TCP (Transmission Control Protocol), which essentially means it runs through the “local internet” on your computer being much more reliable than the UNIX socket in this case.”
Source: StackOverflow

Hmm, did not know that. But nothing changed in my config concerning that.
I think that error was trown because I was missing some needed php 7.4 modules after the upgrade. Database connection is fine now, otherwise nothing would work at all :slight_smile:

That could be it. To resolve that you could use, instead of the php7.4 packages, the normal php packages. Those packages get automatically upgraded to new php versions, so you dont have to worry about installing the right packages.

I spent a whole day troubleshooting all kinds of errors after upgrading to php 7.4. Also uninstalled some 7.2 stuff now. Really don’t fancy going back to 7.2.

But I do not see any DB connection issues for the log of today. So I don’t see how that can still be the issue?

What I meant with my last post is that the ubuntu maintainer will upgrade php for you if you choose php over a specific version, I concluded that that might be more hassle-free.

Please read this guide. Perhaps you missed some packages.

https://www.howtoforge.com/tutorial/ubuntu-nginx-nextcloud/

1 Like

Ah, yes thanks.
I upgraded to Ubuntu 20.01, but it did not upgrade php to 7.4 for some reason. That’s why I did it manually, to make sure I would not have to when NC 20 goes live.

I have found out what is causing the corrupted page issue by the way: the “Radio” plugin!
I noticed that on that page (ending in #app-content) the favicon was that of the radio plugin.

So I disabled the radio app and tried again: no issues anymore. Enabled the radio app: corrupt page again.

Should I create an issue for this on GitHub?

Please install “apt-show-versions”

sudo apt-get install apt-show-versions

and look if packages (e.g. php) comes from not-20-04-ubuntu.

apt-show-version |fgrep php

Or look

dpkg -l |fgrep php

Compare with https://packages.ubuntu.com/search?keywords=php

I think that is actually what happened.
I installed php 7.2 from ppa ondrej, since it was not available yet on (then) 18.x ubuntu. So the upgrade disabled the ppa and did not upgrade php I think.

All versions I see now come from Ubuntu :slight_smile:

Thanks for the guide btw, very helpful info in there!

You can deinstall the ppa packages, deactivate the souce and install php from Ubuntu 20.04 LTS. You do not need with Ubuntu 20.04 LTS php from ppa

The upgrader did that for me. ppa is disabled, php 7.4 was installed from the normal repositories :slight_smile: