This server has no working Internet connection - when it actually does

Nextcloud Hub 5 - 27.0.1
Operating system and version: Debian 11.7 - Linux kernel 5.15.86
nginx version: nginx/1.18.0
PHP information:

PHP
Version: 8.1.21
Memory limit: 536.9 MB
Max execution time: 3600
Upload max size: 10.7 GB
Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, imap, intl, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache

The issue you are facing:
In settings/admin/overview I get an error/warning:

This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.

I can’t update apps and can’t install new ones.
But other then that, all is fine: I can connect to the server through the browser and the client and it synces my contacts and calendars to multiple devices.

The output of your Nextcloud log in Admin > Logging:

[internet_connection_check] Error: OCP\Http\Client\LocalServerException: Host violates local access rules at <<closure>>

 0. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php line 35
    OC\Http\Client\DnsPinMiddleware->OC\Http\Client\{closure}("*** sensitive parameters replaced ***")
 1. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 31
    GuzzleHttp\PrepareBodyMiddleware->__invoke()
 2. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php line 71
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 3. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 63
    GuzzleHttp\RedirectMiddleware->__invoke()
 4. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php line 75
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 5. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 331
    GuzzleHttp\HandlerStack->__invoke()
 6. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 168
    GuzzleHttp\Client->transfer()
 7. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 187
    GuzzleHttp\Client->requestAsync("*** sensitive parameters replaced ***")
 8. /var/www/nextcloud/lib/private/Http/Client/Client.php line 226
    GuzzleHttp\Client->request()
 9. /var/www/nextcloud/apps/settings/lib/Controller/CheckSetupController.php line 218
    OC\Http\Client\Client->get()
10. /var/www/nextcloud/apps/settings/lib/Controller/CheckSetupController.php line 200
    OCA\Settings\Controller\CheckSetupController->isSiteReachable()
11. /var/www/nextcloud/apps/settings/lib/Controller/CheckSetupController.php line 911
    OCA\Settings\Controller\CheckSetupController->hasInternetConnectivityProblems()
12. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\CheckSetupController->check()
13. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController()
14. /var/www/nextcloud/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch()
15. /var/www/nextcloud/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main()
16. /var/www/nextcloud/lib/base.php line 1071
    OC\Route\Router->match()
17. /var/www/nextcloud/index.php line 36
    OC::handleRequest()

GET /settings/ajax/checksetup
from xxx.xxx.xxx.xxx by dosch at 2023-08-04T07:16:22+00:00

I also checked the NGINX log, but couldn’t find any useful errors.

This person solved it on CentOS. I hope someone know what I can do on debian to solve this.

You posted under different topics, did you check the other issues as well?

Empty certificate file → /data/files_external/rootcerts.crt empty after update · Issue #4978 · nextcloud/server · GitHub (probably a different error)

Do you use onlyoffice? There are some reports and an open bug report:

Was it working before?

This is the default vallue in config.php if not set:

'connectivity_check_domains' => [
	'www.nextcloud.com',
	'www.startpage.com',
	'www.eff.org',
	'www.edri.org'
],

But sending a ping shows, that the latter (www.edri.org) does, while the site is online, not respond to ping:

for server in www.nextcloud.com www.startpage.com www.eff.org www.edri.org; do ping -c 1 $server; done

EDIT:

I looked now how nextcloud does the check and it is NOT with simple ping but with guzzlehttp.

You can do that check with this script.

Adapt the require line, so that it points to the autoload.php of your server:

Give it a name, e.g. isSiteReachable.php

<?php

// Include the autoload.php from Nextcloud to load all required dependencies:
require "/var/www/nextcloud/3rdparty/autoload.php";

/** Check if the 'debug' option is set in the command-line arguments
    If it is set, use it as the debug option
    Otherwise, set debug to false by default */
$shortOpts = 'd'; // Short option: -d
$longOpts = ['debug']; // Long option: --debug
$options = getopt($shortOpts, $longOpts);
$debug = isset($options['d']) || isset($options['debug']);

$connectivity_check_domains = [
    'www.nextcloud.com',
    'www.startpage.com',
    'www.eff.org',
    'www.edri.org',
];

function isSiteReachable(string $site, bool $debug): bool {
    try {
        $client = new \GuzzleHttp\Client([
//            'debug' => true, // Enable debugging output
            'debug' => $debug, // Enable debugging output
        ]);
        // if there is no protocol, test http:// AND https://
        if (preg_match('/^https?:\/\//', $site) !== 1) {
            $httpSite = 'http://' . $site . '/';
            echo "Testing HTTP site: $httpSite\n";
            $client->get($httpSite);
            $httpsSite = 'https://' . $site . '/';
            echo "Testing HTTPS site: $httpsSite\n";
            $client->get($httpsSite);
        } else {
            echo "Testing site: $site\n";
            $client->get($site);
        }
        echo "Site is reachable.\n";
    } catch (\Exception $e) {
        echo "Site is not reachable. Error: " . $e->getMessage() . "\n";
        return false;
    }
    return true;
}

foreach ($connectivity_check_domains as $domain) {
    $result = isSiteReachable($domain, $debug);
    echo $domain . ' is ' . ($result ? 'reachable' : 'not reachable') . PHP_EOL;
}
?>

and run it:

php -f /path/to/isSiteReachable.php

with -d or --debug (without -f after php!) it runs in debug mode:

php /path/to/isSiteReachable.php --debug

Now you can see, if that tests result in success or not

hope that helps,
much luck!

1 Like

I do not use OnlyOffice.

It has not been working for over 4 years now, but I could never be bothered to really look into it. Until today. Yesterday I updated to NC27 in the hope this would also fix this issue. But apparently not…

Yes I can confirm this behavior.

I now appended the end of the config file in such a way:


  'connectivity_check_domains' => [
        'www.nextcloud.com',
        'www.startpage.com',
        'www.eff.org'
],
);

Look at my previous post, I EDITED it. The ping is not the way it is tested by the server.

ah, we posted at the same time.

I think I’ll need some more time to test this. Some questions.

Where do I adapt the require line? What do I give the name isSiteReachable.php?

Thnx already for your help and patience.

The php-code inside of that fenced codeblock is meant to copy inside of a textfile on your server and you should give that textfile the name isSiteReachable.php

The line of that codeblock with

require "/var/www/nextcloud/3rdparty/autoload.php"

Should be adapted to your environment.
This one is right, if nextcloud is installed in the directory /var/www/nextcloud

Do you see now?

Than you should run that script in a terminal like I described above.

Everything very simple.

Much luck!

1 Like

yes, so far so good: all works as planned, I just get an unexpected error:

PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.0.2”. You are running 7.4.33. in /var/www/nextcloud/3rdparty/composer/platform_check.php on line 24

Fix your php first.

You did not fill out the support template at all. If you expect help, don’t cry for basics. I am unable to help you without more information about your system.
The lack of understanding might be a cause of your issue. That is totally OK but then you should fill out the complete support template, including webserver (with version) an php Version. or if it is even a docker/aio or snap?

Much luck.

hey @ernolf, understood. I just looked up those versions as you were replying and added the info.

I understand that the older version of PHP I have block the test you just spelled out for me. But do you think it also causes the blocking of internet access?

Version conflicts in php van cause a lot of problems.
Nextcloud 27 (the version you are running) does not work with php 7.4 and you are on debian 11, so why do you have php 7.4 installed?

Your nginx is definitively working with another (php-fpm) version. So remove all php7.4 from your server. This is how you can do that:

sudo apt-get remove --purge php7.4*

Much luck

yes, that worked. Now your script runs.

I pasted the output (which is a lot) here:
https://zerobin.net/?6a49e081846feb45#njDxos5ZBHKvifBOnJl7796osA7O/FuOximMqcxd1qc=

I hope this gives some info on why NC claims there is no internet connection and how I can fix that so I can install and update apps again

… the important lines:

www.nextcloud.com is reachable
www.startpage.com is reachable
www.eff.org is reachable
www.edri.org is reachable

So that is NOT the cause of your issue. You can safely remove the ‘connectivity_check_domains’ from your config.php

Does the problem still exist at all now that you’ve removed the offending php version from your box?

yup, the root issue is still there… :sweat:

No other ideas? @ernolf ?

If you go to the admin panel on system, there is a php version. Is that the same version when you run php -v on your command line?

Do you have a Mandatory Access Control system like AppArmor or SELinux installed on your server and potentially restricting the web server from accessing the internet?"

Test for AppArmor:

sudo aa-status

Test for SELinux:

sudo sestatus

Nextcloud has a bug since version 23.0.8. If you do not have IPv6 support compiled into PHP, even if you do not use IPv6 at all, nextcloud thinks it has no connectivity. There’s been a bug open since then, but what can I say.

The bug report also includes a fix to update IpUtils.php so that everything works again.