nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

Lets Encrypt renewal fails after moving to current Docker image

Open sunjam opened this issue 3 years ago • 13 comments

Pulled nextcloudpi:latest Import ncp-config Re-enable DNS Re-enable webui Updating ncp fails #1478 Static IP and Domain are correctly listed under Trusted Domains Port forwarding is properly setup, but incorrectly listed as closed with nc-info #1475 Trusted Domain and IP lead to

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

ncp-report in next post

sunjam avatar May 15 '22 21:05 sunjam

Applied https://github.com/nextcloud/nextcloudpi/issues/1462#issuecomment-1100631895 NextCloudPi version v1.47.2

Related to #673 Used apt-get in docker to add systemctl and full-upgrade

systemctl status mysqld

# systemctl status mariadb
mariadb.service - MariaDB 10.5.15 database server
    Loaded: loaded (/lib/systemd/system/mariadb.service, enabled)
    Active: failed (dead)
root@321d749b679d:/# systemctl status mysqld
mysqld.service - MariaDB 10.5.15 database server
    Loaded: loaded (/lib/systemd/system/mysqld.service, disabled)
    Active: inactive (dead)
# php --version
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
# ls -la /data
total 32
drwxr-xr-x  8 root     root     4096 Mar  6 23:37 .
drwxr-xr-x  1 root     root     4096 May 15 13:58 ..
drwxr-xr-x  4 root     root     4096 May 15 14:05 backups
drwxr-xr-x  3 root     root     4096 Mar  8 22:34 bin
drwxr-xr-x  5 mysql    mysql    4096 May 15 16:36 database
drwxr-xr-x  9 root     root     4096 May 15 16:24 etc
drwxr-xr-x  3 root     www-data 4096 May 15 16:55 ncp
drwxr-x--- 14 www-data www-data 4096 May 12 14:10 nextcloud

chown www-data:www-data -R /data

# ncp-report

ncp-report

<--! Paste this in GitHub report -->

NextCloudPi diagnostics

NextCloudPi version  v1.47.2
NextCloudPi image    NextCloudPi_docker_03-07-22
OS                   Debian GNU/Linux 11. 5.10.102-meson64 (aarch64)
automount            no
USB devices          none
datadir              /data/nextcloud/data
data in SD           yes
data filesystem      ext2/ext3
data disk usage      83G/117G
rootfs usage         83G/117G
swapfile             /dev/zram0
dbdir                /data/database
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      down
Redis service        down
HPB service          down
Postfix service      down
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               2days

Nextcloud configuration

An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /data-ro/nextcloud/lib/private/DB/Connection.php:87
Stack trace:
#0 /data-ro/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /data-ro/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /data-ro/nextcloud/lib/private/DB/Connection.php(237): Doctrine\DBAL\Connection->executeQuery()
#3 /data-ro/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /data-ro/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /data-ro/nextcloud/lib/private/AppConfig.php(344): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /data-ro/nextcloud/lib/private/AppConfig.php(109): OC\AppConfig->loadConfigValues()
#7 /data-ro/nextcloud/lib/private/AppConfig.php(300): OC\AppConfig->getApps()
#8 /data-ro/nextcloud/lib/private/legacy/OC_App.php(972): OC\AppConfig->getValues()
#9 /data-ro/nextcloud/lib/private/Server.php(692): OC_App::getAppVersions()
#10 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC\{closure}()
#11 /data-ro/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#13 /data-ro/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#14 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#15 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(182): OC\AppFramework\Utility\SimpleContainer->get()
#16 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#17 /data-ro/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#19 /data-ro/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#20 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#21 /data-ro/nextcloud/lib/private/Server.php(1079): OC\AppFramework\Utility\SimpleContainer->get()
#22 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC\{closure}()
#23 /data-ro/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#24 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#25 /data-ro/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#26 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#27 /data-ro/nextcloud/lib/private/Server.php(2040): OC\AppFramework\Utility\SimpleContainer->get()
#28 /data-ro/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#29 /data-ro/nextcloud/lib/private/Server.php(439): OC\Files\View->__construct()
#30 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC\{closure}()
#31 /data-ro/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#32 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#33 /data-ro/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#34 /data-ro/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#35 /data-ro/nextcloud/lib/private/Server.php(1403): OC\AppFramework\Utility\SimpleContainer->get()
#36 /data-ro/nextcloud/lib/base.php(594): OC\Server->boot()
#37 /data-ro/nextcloud/lib/base.php(1087): OC::init()
#38 /data-ro/nextcloud/console.php(48): require_once('/data-ro/nextcl...')
#39 /data-ro/nextcloud/occ(11): require_once('/data-ro/nextcl...')
#40 {main}
HTTPd logs

[Sun May 15 21:46:50.786049 2022] [authz_host:error] [pid 891:tid 281473633104272] [client 192.168.0.10:50886] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Sun May 15 21:48:11.038668 2022] [mpm_event:notice] [pid 123:tid 281473847869456] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun May 15 21:48:11.074199 2022] [ssl:warn] [pid 123:tid 281473847869456] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun May 15 21:48:11.080341 2022] [mpm_event:notice] [pid 123:tid 281473847869456] AH00489: Apache/2.4.52 (Debian) OpenSSL/1.1.1k configured -- resuming normal operations
[Sun May 15 21:48:11.080430 2022] [core:notice] [pid 123:tid 281473847869456] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 15 21:56:00.405290 2022] [authz_host:error] [pid 1653:tid 281473742209424] [client 192.168.0.10:50992] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Sun May 15 21:56:03.180724 2022] [authz_host:error] [pid 1653:tid 281473742209424] [client 192.168.0.10:50992] AH01753: access check of 'localhost' to /favicon.ico failed, reason: unable to get the remote host name, referer: https://192.168.0.107:4443/
[Sun May 15 23:08:40.353994 2022] [authz_host:error] [pid 1653:tid 281473742209424] [client 192.168.0.10:51264] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Sun May 15 23:25:33.839558 2022] [mpm_event:notice] [pid 123:tid 281473847869456] AH00493: SIGUSR1 received.  Doing graceful restart
apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/http2.load: Cannot load /usr/lib/apache2/modules/mod_http2.so into server: /usr/lib/apache2/modules/mod_http2.so: undefined symbol: ap_thread_create
[Sun May 15 16:36:11.325532 2022] [ssl:warn] [pid 121:tid 281473346441232] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun May 15 16:36:11.360187 2022] [ssl:warn] [pid 122:tid 281473346441232] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun May 15 16:36:11.364542 2022] [core:warn] [pid 122:tid 281473346441232] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Sun May 15 16:36:11.369769 2022] [mpm_event:notice] [pid 122:tid 281473346441232] AH00489: Apache/2.4.53 (Debian) OpenSSL/1.1.1n configured -- resuming normal operations
[Sun May 15 16:36:11.369941 2022] [core:notice] [pid 122:tid 281473346441232] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 15 17:09:48.431954 2022] [ssl:warn] [pid 122:tid 281473265266704] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun May 15 17:09:48.467087 2022] [ssl:warn] [pid 123:tid 281473265266704] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun May 15 17:09:48.471727 2022] [core:warn] [pid 123:tid 281473265266704] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Sun May 15 17:09:48.477557 2022] [mpm_event:notice] [pid 123:tid 281473265266704] AH00489: Apache/2.4.53 (Debian) OpenSSL/1.1.1n configured -- resuming normal operations
[Sun May 15 17:09:48.477731 2022] [core:notice] [pid 123:tid 281473265266704] AH00094: Command line: '/usr/sbin/apache2'

Database logs

tail: cannot open '/var/log/mysql/*.log' for reading: No such file or directory

Nextcloud logs

{"reqId":"YoFmomkz0Y6NFhx@3DkNFAAAAEw","level":0,"time":"2022-05-15T20:46:27+00:00","remoteAddr":"76.210.138.30","user":"James","app":"workflowengine","method":"PROPFIND","url":"/remote.php/dav/files/James/","message":"Flow activation: rules were requested for operation Block access to a file","userAgent":"Mozilla/5.0 (Linux) mirall/3.5.0-20220505.175928.ccb79dc69-1.0~focal1 (Nextcloud, ubuntu-5.4.0-110-lowlatency ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"23.0.2.1"}
{"reqId":"YoFmomkz0Y6NFhx@3DkNFAAAAEw","level":0,"time":"2022-05-15T20:46:27+00:00","remoteAddr":"76.210.138.30","user":"James","app":"workflowengine","method":"PROPFIND","url":"/remote.php/dav/files/James/","message":"No flow configurations is going to run Block access to a file","userAgent":"Mozilla/5.0 (Linux) mirall/3.5.0-20220505.175928.ccb79dc69-1.0~focal1 (Nextcloud, ubuntu-5.4.0-110-lowlatency ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"auto_groups","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"webapppassword","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"extract","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"geoblocker","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"maps","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"metadata","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"piwik","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"qownnotesapi","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"socialsharing_email","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"socialsharing_facebook","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"socialsharing_twitter","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"suspicious_login","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"twofactor_gateway","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"uploaddetails","method":"","url":"--","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new parser added : FeedIo\\Standard\\Json","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new parser added : FeedIo\\Standard\\Atom","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new parser added : FeedIo\\Standard\\Rss","userAgent":"--","version":"23.0.2.1"}
{"reqId":"7bwXwZy2wBjfIEZzxuZQ","level":0,"time":"2022-05-15T20:46:42+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new parser added : FeedIo\\Standard\\Rdf","userAgent":"--","version":"23.0.2.1"}

sunjam avatar May 15 '22 23:05 sunjam

@sunjam Since this issue is 2 months old, I suppose you don't have that container anymore (or found a solution)?

theCalcaholic avatar Jul 28 '22 06:07 theCalcaholic

I'm closing the issue for now. Feel free to respond and I'll reopen it :)

theCalcaholic avatar Aug 14 '22 22:08 theCalcaholic

I did not find a solution. Got no response on the forum or anywhere else. I still have the container. Any suggestions?

Basically I have ncp-config export, nc-rsync backups of my data directory and am trying to import them into a clean container. I can try it on my own, grew frustrated with it after a few attempts.

sunjam avatar Aug 17 '22 18:08 sunjam

What exactly is the issue at this point? That mysql is not running? Or that the letsencrypt certificates are not renewed automatically?

Does a simple service mysql start do anything?

theCalcaholic avatar Aug 17 '22 22:08 theCalcaholic

Tried systemctl start mysql but it does nothing within the docker container. Also, systemctl is not included within the container.

sunjam avatar Aug 18 '22 21:08 sunjam

Mm you're right, systemd with systemctl isn't in the container, when I've been experimenting with building the docker containers I had to add "systemd" to be installed inside the base container for that to work 🙏

ZendaiOwl avatar Aug 19 '22 09:08 ZendaiOwl

@sunjam Yes, that's why I was suggesting to run service mysql start :)

theCalcaholic avatar Aug 20 '22 14:08 theCalcaholic

I had to add "systemd" to be installed inside the base container @ZendaiOwl Please don't do that outside of experimentation, though. Systemd doesn't work reliably inside docker

theCalcaholic avatar Aug 20 '22 14:08 theCalcaholic

I had to add "systemd" to be installed inside the base container @ZendaiOwl Please don't do that outside of experimentation, though. Systemd doesn't work reliably inside docker

Alright 🙏 I didn't know that, do you know why that is?

ZendaiOwl avatar Aug 20 '22 14:08 ZendaiOwl

It's just not designed for that. Docker is meant to be a containerization for single processes (we're abusing it a bit in that regard) and a process management engine like systemd is meant for the opposite of the spectrum :)

Apparently, it's not impossible to do anymore (some time ago you needed host system access in order to run systemd, but it's not a very good idea for production still. That's why we use a very simple bash script for process management.

theCalcaholic avatar Aug 20 '22 14:08 theCalcaholic

@theCalcaholic Thank you Alright, yeah I found an article about this from someone working with container runtimes at red hat 🥳

Seems podman was developed to resolve such issues, he also outlines some of the problems with using systemd on a docker container without properly setting it up, if I understood it correctly 🙏

https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container#other_cool_features_about_podman_and_systemd

Edit: Haha, we found the same article 😅😂

ZendaiOwl avatar Aug 20 '22 15:08 ZendaiOwl

@sunjam Are you still interested in fixing this? I'm still curious about the output of service mysql start :)

@sunjam Yes, that's why I was suggesting to run service mysql start :)

theCalcaholic avatar Aug 26 '22 13:08 theCalcaholic

This issue can be closed, it is caused by the internal upgrade within docker, which should not be done unless the image you're pulling from has gone through precisely & exactly the same upgrade process as you did within your container, including configurations, package installation and all.

And if anyone comes here reading, you can use systemd within a container, it is not recommended to use with docker directly however and you should use podman for that, which was developed by red hat to resolve the issues of using systemd within a container more easily. As can be read in the article linked in one of the comments above

ZendaiOwl avatar Sep 26 '22 01:09 ZendaiOwl