Connman dnsproxy and dnsmasq - how not to break it during next upgrades?

Hi Everyone, yesterday I took an osmc upgrade on Rpi4. After this, my dnsmasq install failed to start.
I edited /etc/connman.prefs from dnsproxy=yes to dnsproxy=no, rebooted and everything was then fine. (Inspiration came from this post Connman(d) DNS and port 53 - #9 by HarryL).

What shall I do to make sure this will not break during next upgrades?

Thank you!

That change is persistent across updates.

Sam

Hi Sam, you’re right: the /etc/connman.prefs config is still there after Dec update.
However, for some reason that I am trying to discover, dnsmasq won’t start any longer. Any idea?
Thank you.


~$ cat /etc/connman.prefs
#’ If set to yes, connman enables a dns proxy running on localhost port 53 and sets /etc/resolv.conf nameservers to point at 127.0.0.1
#’ If set to no, the dns proxy is disabled and connman will update nameservers directly in /etc/resolv.conf.

dnsproxy=no


~$ sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2023-12-15 06:48:39 CET; 28min ago
Process: 330 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
Process: 412 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
CPU: 192ms

Dec 15 06:48:39 osmc systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server…
Dec 15 06:48:39 osmc dnsmasq[412]: dnsmasq: failed to create listening socket for port 53: Address already in use
Dec 15 06:48:39 osmc dnsmasq[412]: failed to create listening socket for port 53: Address already in use
Dec 15 06:48:39 osmc systemd[1]: dnsmasq.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Dec 15 06:48:39 osmc dnsmasq[412]: FAILED to start up
Dec 15 06:48:39 osmc systemd[1]: dnsmasq.service: Failed with result ‘exit-code’.
Dec 15 06:48:39 osmc systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.


~$ grep VERSION_ID /etc/os-release
VERSION_ID=“2023.12-1”

It is connmand listening on port 53 despite the connman.prefs config:


~$ sudo netstat -tulpn | grep LISTEN | grep 53
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 277/connmand
tcp6 0 0 ::1:53 :::* LISTEN 277/connmand

OK. So, after looking at connman.service file I realized the Dec update had moved connman prefs to a new location. Changed the setting in the new location. The prefs file is now here: /etc/osmc/prefs.d/connman


$ cat /etc/systemd/system/multi-user.target.wants/connman.service
[Unit]
Description=Connman connection service
After=dbus.service network-pre.target wpa_supplicant.service
Wants=network.target remote-fs-pre.target
Before=remote-fs-pre.target network.target

[Service]
Type=dbus
BusName=net.connman
EnvironmentFile=-/etc/osmc/prefs.d/connman
Restart=always
RestartSec=5
ExecStart = /usr/bin/start-network
ExecStopPost = /bin/sleep 2
StandardOutput=null

[Install]
WantedBy=multi-user.target

Success. What shall I do to make sure this will not break during next upgrades?

~$ sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-12-15 07:37:10 CET; 1min 0s ago
Process: 367 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
Process: 485 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
Process: 507 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
Main PID: 505 (dnsmasq)
Tasks: 1 (limit: 3931)
CPU: 243ms
CGroup: /system.slice/dnsmasq.service
└─505 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local->

Dec 15 07:37:10 osmc systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server…
Dec 15 07:37:10 osmc systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

You don’t need to change anything - it’s a fixed path now.

Great. Thanks Sam. Out of pure curiosity, why did we need to move the connman prefs to an osmc custom location?

For consistency. It’s an OSMC package so should be kept under an OSMC directory .