(SOLVED) Cannot access NextcloudPi - Connection refused - httpd service down

Dear Community,

after upgrading Nextcloudpi to 0.61.1 I cannot access my Nextcloud or the Web-Interface anymore and get a “connection refused” error in the browser.

sudo ncp-report --> HTTPD seems to be down

pi@nextcloudpi:~ $ sudo ncp-report
<--! Paste this in GitHub report -->

<details>
<summary>NextCloudPi diagnostics</summary>

NextCloudPi version  v0.66.1
NextCloudPi image    NextCloudPi_10-23-18
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          none
datadir              /var/www/nextcloud/data
data in SD           yes
data filesystem      ext2/ext3
data disk usage      2.4G/118G
rootfs usage         2.4G/118G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    14.0.3.0
HTTPD service        down
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               3:21

</details>

<details>
<summary>Nextcloud configuration</summary>

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "5": "nextcloudpi.local",
            "7": "nextcloudpi",
            "8": "nextcloudpi.lan",
            "1": "192.168.1.100",
            "3": "rbey.ddns.net",
            "2": "rbey.ddns.net",
            "4": "rbey.ddns.net"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "14.0.3.0",
        "overwrite.cli.url": "https:\/\/rbey.ddns.net\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "loglevel": "2",
        "log_type": "file"
    }
}

</details>

<details>
<summary>HTTPd logs</summary>

</details>

<details>
<summary>Database logs</summary>

2018-11-06  9:25:18 1988296720 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2018-11-06  9:25:18 1988296720 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-11-06  9:25:18 1988296720 [Note] InnoDB: The InnoDB memory heap is disabled
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-11-06  9:25:18 1988296720 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Using Linux native AIO
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Using generic crc32 instructions
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Completed initialization of buffer pool
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Highest supported file format is Barracuda.
2018-11-06  9:25:18 1988296720 [Note] InnoDB: 128 rollback segment(s) are active.
2018-11-06  9:25:18 1988296720 [Note] InnoDB: Waiting for purge to start
2018-11-06  9:25:18 1988296720 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 703831457
2018-11-06  9:25:18 1988296720 [Note] Plugin 'FEEDBACK' is disabled.
2018-11-06  9:25:18 1379922736 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-11-06  9:25:18 1988296720 [Note] Server socket created on IP: '127.0.0.1'.
2018-11-06  9:25:18 1988296720 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.35-MariaDB-1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Raspbian testing-staging
</details>

<details>
<summary>Nextcloud logs</summary>

{"reqId":"W9iTdt@meSiWWjfp@HNZFAAAVQ8","level":3,"time":"2018-10-30T17:23:02+00:00","remoteAddr":"92.194.31.150","user":"richi","app":"PHP","method":"POST","url":"\/index.php\/apps\/music\/api\/scan","message":"Undefined index: filesize at \/var\/www\/nextcloud\/apps\/music\/3rdparty\/getID3\/getid3\/module.tag.apetag.php#25","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"14.0.3.0"}
{"reqId":"W9iT3t@meSiWWjfp@HNZPwAAVQ8","level":3,"time":"2018-10-30T17:24:48+00:00","remoteAddr":"92.194.31.150","user":"richi","app":"PHP","method":"POST","url":"\/index.php\/apps\/music\/api\/scan","message":"Undefined index: filesize at \/var\/www\/nextcloud\/apps\/music\/3rdparty\/getID3\/getid3\/module.tag.apetag.php#25","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"14.0.3.0"}
{"reqId":"W9iUDd@meSiWWjfp@HNZUQAAShY","level":3,"time":"2018-10-30T17:25:34+00:00","remoteAddr":"92.194.31.150","user":"richi","app":"PHP","method":"POST","url":"\/index.php\/apps\/music\/api\/scan","message":"Undefined index: filesize at \/var\/www\/nextcloud\/apps\/music\/3rdparty\/getID3\/getid3\/module.tag.apetag.php#25","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"14.0.3.0"}
{"reqId":"W9iUwd@meSiWWjfp@HNZnwAAVxY","level":3,"time":"2018-10-30T17:28:39+00:00","remoteAddr":"92.194.31.150","user":"richi","app":"PHP","method":"POST","url":"\/index.php\/apps\/music\/api\/scan","message":"Undefined index: filesize at \/var\/www\/nextcloud\/apps\/music\/3rdparty\/getID3\/getid3\/module.tag.apetag.php#25","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"14.0.3.0"}
{"reqId":"W9iVQN@meSiWWjfp@HNZ2QAARg8","level":3,"time":"2018-10-30T17:30:41+00:00","remoteAddr":"92.194.31.150","user":"richi","app":"PHP","method":"POST","url":"\/index.php\/apps\/music\/api\/scan","message":"Undefined index: filesize at \/var\/www\/nextcloud\/apps\/music\/3rdparty\/getID3\/getid3\/module.tag.apetag.php#25","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"14.0.3.0"}

</details>

Apache2 status

pi@nextcloudpi:~ $ sudo systemctl status apache2.service
â—Ź apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; generated; vendor preset: enabled)
   Active: active (exited) since Tue 2018-11-06 09:24:55 UTC; 3h 26min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 601 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service

Nov 06 09:24:55 nextcloudpi systemd[1]: Starting LSB: Apache2 web server...
Nov 06 09:24:55 nextcloudpi systemd[1]: Started LSB: Apache2 web server.

/var/log/apache2/error.log is empty.

/var/log/apache2/error.log.1 gives:

pi@nextcloudpi:~ $ tail -40 /var/log/apache2/error.log.1
[Mon Nov 05 06:25:02.323426 2018] [ssl:warn] [pid 9967:tid 1995747728] AH01882: Init: this version of mod_ssl was compiled against a newer library (OpenSSL 1.1.0h  27 Mar 2018, version currently loaded is OpenSSL 1.1.0f  25 May 2017) - may result in undefined or erroneous behavior
[Mon Nov 05 06:25:02.327127 2018] [ssl:warn] [pid 9967:tid 1995747728] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 05 06:25:02.328971 2018] [mpm_event:notice] [pid 9967:tid 1995747728] AH00489: Apache/2.4.34 (Raspbian) OpenSSL/1.1.0f configured -- resuming normal operations
[Mon Nov 05 06:25:02.329010 2018] [core:notice] [pid 9967:tid 1995747728] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 05 06:26:17.325902 2018] [mpm_event:notice] [pid 9967:tid 1995747728] AH00491: caught SIGTERM, shutting down

Any help is very much appreciated.

What was the version before upgrading? Or how long ago was last upgrade?
Autoupgrade is enabled by default now, it was not before, this caused users to wait too long. Updates need to be run a least once or better twice a month.
Try running

ncp-update

again, check if HTTPD is up and ports open, and then run letsencrypt from ncp-config.
If upgrade was broken or interrupted at some previous run, you could also try

sudo apt install -f

and copy/paste output here if it didnt fix it or get errors.

If it did, check ports and httpd and run letsencrypt again then restart apache

Autoupgrade is enabled but I’m not shure what the previous version was.

pi@nextcloudpi:~ $ sudo apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

then

pi@nextcloudpi:~ $ sudo apt list --upgradable -a
Listing... Done
php-imagick/unknown 3.4.3-4+0~20181106031703.7+stretch~1.gbpba1eeb armhf [upgradable from: 3.4.3-4]
php-imagick/now 3.4.3-4 armhf [installed,upgradable to: 3.4.3-4+0~20181106031703.7+stretch~1.gbpba1eeb]
php-imagick/stable 3.4.3~rc2-2 armhf

so I did sudo apt install php-imagick, which went fine, rebooted the system but it still doesn’t work.

Letsencript

Launching letsencrypt
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert not yet due for renewal
Keeping the existing certificate

Certificate not yet due for renewal; no action taken.
System config value trusted_domains => 4 set to string mydomain.net
System config value overwrite.cli.url set to string https://mydomain.net/
Done. Press any key...

Hello community,

I’ve exactly the same Problem. The error log shows the same entries with the same timestamps!?!

[Mon Nov 05 06:25:02.784948 2018] [ssl:warn] [pid 747:tid 1995678096] AH01882: Init: this version of mod_ssl was compiled against a newer library (OpenSSL 1.1.0h  27 Mar 2018, version currently loaded is OpenSSL 1.1.0f  25 May 2017) - may result in undefined or erroneous behavior
[Mon Nov 05 06:25:02.790551 2018] [ssl:warn] [pid 747:tid 1995678096] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 05 06:25:02.792483 2018] [mpm_event:notice] [pid 747:tid 1995678096] AH00489: Apache/2.4.34 (Raspbian) OpenSSL/1.1.0f configured -- resuming normal operations
[Mon Nov 05 06:25:02.792506 2018] [core:notice] [pid 747:tid 1995678096] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 05 06:26:18.686158 2018] [mpm_event:notice] [pid 747:tid 1995678096] AH00491: caught SIGTERM, shutting down

Any help is appreciated!

1 Like

i had this too.
I was using the oct 23 image
after i got rid of that and re-installed NCP with this recent nov 4th version my HTTPD went up again.

not sure if that helps

Hello everyone,

This should fix it

sudo apt-get update
sudo apt-get install --reinstall apache2
sudo apt-get install libapache2-mod-authnz-external
sudo apt-get install libapache2-mod-security2
3 Likes

Hi,

that fixed it. Thank you very much!

1 Like

same here, i will definitely turn OFF any auto updates, this is the 3rd time on pi, nextcloud auto updates leaves me in a no service state.

Hello guys,

Yesterday I updated nextcloudpi via ncp-update. Today I realized that sync did not work, and I had no access to the webui. ssh works ok.

sudo ncp-report also gives the following result

NextCloudPi image    NextCloudPi_11-04-18
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          sda
datadir              /media/TurboX/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      7.1G/466G
rootfs usage         2.3G/15G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    14.0.3.0
HTTPD service        down
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed

I tried @nachoparker 's solution but I get

Setting up apache2 (2.4.25-3+deb9u6) ...
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
â—Ź apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-02-14 20:28:58 EET; 28ms ago
  Process: 2838 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Feb 14 20:28:58 nextcloudpi systemd[1]: Starting The Apache HTTP Server...
Feb 14 20:28:58 nextcloudpi apachectl[2838]: apache2: Syntax error on line 225 of /etc/apach…ctory
Feb 14 20:28:58 nextcloudpi apachectl[2838]: Action 'start' failed.
Feb 14 20:28:58 nextcloudpi apachectl[2838]: The Apache error log may have more information.
Feb 14 20:28:58 nextcloudpi systemd[1]: apache2.service: Control process exited, code=exited…tus=1
Feb 14 20:28:58 nextcloudpi systemd[1]: Failed to start The Apache HTTP Server.
Feb 14 20:28:58 nextcloudpi systemd[1]: apache2.service: Unit entered failed state.
Feb 14 20:28:58 nextcloudpi systemd[1]: apache2.service: Failed with result 'exit-code'.

any clues?

Thanx in advance

your certs might be gone. Try this

Unfortunately I do not have a backup to restore as I am new at rassberrypi and ncp and it is my first setup. What I have tried till now is the following:
I realized that folder /etc/letsencrypt/live/ was empty so I

sudo cp -r /etc/letsencrypt-old/live/my.whatever.com /etc/letsencrypt/live/

(in fact the folder my.whatever.com was missing with all the certificates keys etc.)
But this did not fix the problem.
I then saw your answer and checked nextcloud.conf and ncp.conf

The corresponding lines contain the following:

SSLCertificateFile /etc/letsencrypt/live/my.whatever.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.whatever.com/privkey.pem

Isn’t this the way it should be?

what I meant is that you can do this to get your HTTP back, then run letsencrypt normally

You can change the following lines in /etc/apache2/sites-available/ files nextcloud.conf and ncp.conf

   SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

, then reboot

I changed aforementioned lines to

in both nextcloud.conf and ncp.conf and rebooted but still no luck.
sudo ncp-report has httpd down.

Any other suggestions? Could there be any other log file I can upload that shows more info perhaps?

Ok after hours of trial and error I write down the steps I followed to manage and make it working again.

  1. sudo nano /etc/apache2/sites-available/nextcloud.conf

  2. changed lines as mentioned above to :

SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  1. repeated step 2 for file
    /etc/apache2/sites-available/ncp.conf

  2. sudo mv /etc/letsencrypt /etc/letsencrypt.broken

  3. sudo mv /etc/letsencrypt.old /etc/letsencrypt

  4. sudo systemctl restart apache2 (with this step I got httpd up)

  5. sudo nano /etc/apache2/sites-available/nextcloud.conf

  • changed back lines to

In the above quote do not forget to change “my. whatever .com” accordingly to what is your directory

  1. repeated step 7 for file /etc/apache2/sites-available/ncp.conf

  2. sudo systemctl restart apache2

Now its time to make my first backup :slight_smile:

2 Likes

Created an account to say:

  1. Thank you! This solution worked for me.
  2. I, too, am making a backup, pronto.
1 Like

You are welcome Derek, I should also thank nachoparker for his kind guidance.

1 Like

Solved my letsencrypt issue after upgrade to NextCloudPi 1.8.0. Saved me a lot of time. Thanks!

Unfortunately this is not a permanent solution as after upgrading to NextcloudPi 1.8.0 I got the same problem. Of course steps above will solve it again, but probably until next upgrade.

Guys is it only me that I need after each upgrade to follow the procedure above to make httpd run again? Has anyone found a permanent solution?

try

  • change the certs to snakeoil
  • restart apache
  • apt-get purge letsencrypt
  • remove /etc/letsencrypt
  • remove /usr/local/etc/ncp-config.d/letsencrypt.cfg
  • run sudo ncp-update
  • optionally, run letsencrypt from ncp-web to update your certs
1 Like