nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

dnsmasq systemd-resolved and freeDNS

Open zakkg3 opened this issue 1 year ago • 1 comments

Adding a freeDNS domains adds an entry on dnsMasq:

address=/some.url.com/192.168.XXX.XXX # This is optional if we add it to /etc/hosts

But then the crontab does

registeredIP=$(dig +short "some.url.com" |tail -n1) and compares this with the public IP from http://checkip.dyndns.org.

so, the registered resolves to the local IP 192.168.XXX.XXX which is diff from the public IP.

Not 100% sure if this is related but, I've also had to disable the systemd-resolved unit as DnsMasq was not able to start (that was a fresh Nextcloudpi installation) cause the port was already taken on startup.

' 53: bind: address already in use '

That is something I found many users faced and is still not resolved https://github.com/nextcloud/nextcloudpi/issues/1446

NextcloudPi diagnostics

NextcloudPi version  v1.55.3
NextcloudPi image
OS                   Armbian-unofficial 24.8.2 Bookworm \l . 6.6.45-current-bcm2711 (aarch64)
automount            no
USB devices          sda sdb
datadir              /media/sda/ncdata/data
data in SD           no
data filesystem      ext2/ext3
data disk usage      70G/1.8T
rootfs usage         8.1G/116G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    30.0.2.2
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          up
Postfix service      up
Internet check       ok
Public IPv4          ***REMOVED SENSITIVE VALUE***
Public IPv6          ***REMOVED SENSITIVE VALUE***
Port 80              open
Port 443             open
IP                   ***REMOVED SENSITIVE VALUE***
Gateway              ***REMOVED SENSITIVE VALUE***
Interface            end0
Certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         yes
Uptime               17:22

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "7": "nextcloudpi",
            "5": "nextcloudpi.local",
            "8": "nextcloudpi.lan",
            "3": "nextcloudpi",
            "14": "nextcloudpi",
            "11": "somedomain.here.com",
            "1": "XXX.XXX.XXX.XXX",
            "2": "somedomain.here.com"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.2.2",
        "overwrite.cli.url": "https:\/\/nextcloudpi\/",
        "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***"
        },
        "tempdirectory": "\/media\/sda\/ncdata\/data\/tmp",
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "jpeg_quality": 60,
        "overwriteprotocol": "https",
        "maintenance": false,
        "logfile": "\/media\/sda\/ncdata\/data\/nextcloud.log",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "loglevel": "2",
        "log_type": "file",
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/exiftool-aarch64-glibc",
        "memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-aarch64"
    }
}

HTTPd logs

[Wed Nov 27 08:17:19.655660 2024] [authz_host:error] [pid 67977:tid 67998] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:19.665644 2024] [authz_host:error] [pid 67977:tid 67999] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:19.672105 2024] [authz_host:error] [pid 67977:tid 67989] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/nc-button.svg failed, reason: unable to get the remote host name, referer: https://XXX.XXX.XXX.XXX:4443/css/ncp.css
[Wed Nov 27 08:17:19.685517 2024] [authz_host:error] [pid 67977:tid 67994] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/info-white.svg failed, reason: unable to get the remote host name, referer: https://XXX.XXX.XXX.XXX:4443/css/ncp.css
[Wed Nov 27 08:17:19.699159 2024] [authz_host:error] [pid 67977:tid 67997] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/settings-white.svg failed, reason: unable to get the remote host name, referer: https://XXX.XXX.XXX.XXX:4443/css/ncp.css
[Wed Nov 27 08:17:19.768975 2024] [authz_host:error] [pid 67977:tid 68000] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:19.983119 2024] [authz_host:error] [pid 67977:tid 68000] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.246287 2024] [authz_host:error] [pid 67977:tid 68001] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.452639 2024] [authz_host:error] [pid 67977:tid 68001] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.467558 2024] [authz_host:error] [pid 67977:tid 67978] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/download.svg failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.467588 2024] [authz_host:error] [pid 67977:tid 67982] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/delete.svg failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.480703 2024] [authz_host:error] [pid 67977:tid 68002] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.712406 2024] [authz_host:error] [pid 67977:tid 68002] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.714562 2024] [authz_host:error] [pid 67977:tid 67978] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/download.svg failed, reason: unable to get the remote host name
[Wed Nov 27 08:17:29.725043 2024] [authz_host:error] [pid 67977:tid 67982] [remote 192.168.178.21:54119] AH01753: access check of 'localhost' to /img/delete.svg failed, reason: unable to get the remote host name
[Wed Nov 27 08:18:06.485239 2024] [authz_host:error] [pid 67977:tid 67983] [remote 192.168.178.21:54121] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Wed Nov 27 08:18:06.691724 2024] [authz_host:error] [pid 67977:tid 67983] [remote 192.168.178.21:54121] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Wed Nov 27 08:18:06.692145 2024] [authz_host:error] [pid 67977:tid 67983] [remote 192.168.178.21:54121] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:18:06.896415 2024] [authz_host:error] [pid 67977:tid 67983] [remote 192.168.178.21:54121] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Wed Nov 27 08:18:56.802284 2024] [http2:warn] [pid 67977:tid 68018] [client 192.168.178.21:54119] h2_stream(67977-5-49,CLEANUP): started=1, scheduled=1, ready=0, out_buffer=0

Database logs

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

Nextcloud logs

{"reqId":"Z0Wsc8NLsQxIVX-imCpywwAAFA0","level":2,"time":"2024-11-26T11:09:42+00:00","remoteAddr":"192.168.0.140","user":"ncp","app":"no app in context","method":"GET","url":"/index.php/settings/apps","message":"Invalid defaultDaemonConfig data provided to provideInitialState by settings","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","version":"30.0.2.2","data":[]}
{"reqId":"Z0WxpUr5pRPJEiJZDzkjbQAATRE","level":2,"time":"2024-11-26T11:31:49+00:00","remoteAddr":"XXX.XXX.XXX.remoteip","user":"auserXXX","app":"no app in context","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fmemories%2Fnxsetup","message":"Request does not pass strict cookie check","userAgent":"MemoriesNative/1.12 Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.76 Mobile Safari/537.36","version":"30.0.2.2","data":[]}
{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Server.php","line":43,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":370,"function":"start","class":"OCA\\DAV\\Connector\\Sabre\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":19,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":146,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":259,"message":"Expected filesize of 4861985 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 4718592 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","exception":{},"CustomMessage":"Expected filesize of 4861985 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 4718592 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side."}}
{"reqId":"Z0Z2dlL0oaYNTvglpTq2KAAAAAM","level":3,"time":"2024-11-27T01:31:35+00:00","remoteAddr":"192.168.178.20","user":"auserXXX","app":"no app in context","method":"PUT","url":"/remote.php/dav/uploads/auserXXX/1dc3a14fde30c10434b0c56d73a2859a/000002","message":"Expected filesize of 17027088 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 11550720 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.29.2","version":"30.0.2.2","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 17027088 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 11550720 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":110,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":34,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Server.php","line":43,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":370,"function":"start","class":"OCA\\DAV\\Connector\\Sabre\\Server","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":662,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1132,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":22,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Security/Crypto.php","Line":137,"message":"Could not decrypt or decode encrypted session data","exception":{},"CustomMessage":"Could not decrypt or decode encrypted session data"}}

zakkg3 avatar Nov 27 '24 09:11 zakkg3

I can confirm I am having this issue as well. The Wizard installs dnsmasq when adding an external USB drive. Then on the next boot, there's a conflict between dnsmasq and systemd-resolved.

If you've already enabled ssh and sudo, then you can SSH in and use this:

sudo systemctl disable systemd-resolved

This will allow it to boot. It seems that both dnsmasq and systemd-resolved are DNS resolvers. I don't know why we would need two of them. I'm also not sure if this will cause other problems. But this conflict ought to be fixed.

ChrisMenning avatar Mar 31 '25 00:03 ChrisMenning