How do I disable systemd-networkd.service so that connman.service can enable DNS?

by Alex Ryan   Last Updated May 23, 2020 01:00 AM

I have Automotive Grade Linux (Halibut 8.0.0) installed on a Qualcomm board.
This is an embedded system with no package manager, no build tools and no working DNS, but I can bring up ethernet okay.

sa8155:~# ifconfig eth0 up
sa8155:~# udhcpc
udhcpc: started, v1.29.3
udhcpc: sending discover
udhcpc: sending select for
udhcpc: lease of obtained, lease time 604800
/etc/udhcpc.d/50default: Adding DNS
/etc/udhcpc.d/50default: Adding DNS

Notice that DHCP reports that the name servers are being retrieved correctly.

And I can ping the name servers:

sa8155:~# ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=58 time=8.973 ms
64 bytes from seq=1 ttl=58 time=19.634 ms
64 bytes from seq=2 ttl=58 time=11.391 ms

However, I cannot use DNS to resolve any names.

sa8155:~# nslookup
nslookup: write to '': Connection refused
;; connection timed out; no servers could be reached

I noticed that /etc/resolv.conf is empty other than this comment:

sa8155:~# cat /etc/resolv.conf 
# Generated by Connection Manager

I tried manually editing /etc/resolv.conf like so:

sa8155:~# cat /etc/resolv.conf 
# Generated by Connection Manager
search local.test

But that seems to disable the ethernet interface altogether.

I tried manually adding a single host and ip address pair to /etc/hosts, but I could not edit that file even though I am root.

sa8155:~# ls -alF /etc/ | grep host
-rw-r--r--  1 root     root         26 Nov 13  2019 host.conf
-rw-r--r--  1 root     root     111912 Nov 13  2019 hostapd.conf
-rw-r--r--  1 root     root          7 Nov 13  2019 hostname
-rw-r--r--  1 root     root        237 Nov 13  2019 hosts
-rw-r--r--  1 root     root          0 Nov 13  2019 hosts.allow
-rw-r--r--  1 root     root          0 Nov 13  2019 hosts.deny
sa8155:~# chmod 766 /etc/hosts
chmod: changing permissions of `/etc/hosts': Read-only file system

So I tried using ConnMan to add the DNS entries.

Here is the procedure

However, connmanctl services does not return the expected list.

sa8155:~# connmanctl services
Error: The name net.connman was not provided by any .service files

I originally posted this question here and one responder suggested that systemd-networkd might be competing with connman.

I have verified that both services are running:

sa8155:~# systemctl --type=service | grep network
  systemd-networkd.service                               loaded active running Network Service                                     
sa8155:~# systemctl --type=service | grep conn

However, my understanding is that the configuration files for systemd-networkd are located here:


And this directory is empty for me.

It was also suggested that /etc/nsswitch.conf might be configured incorrectly.
Here is what mine looks like:

sa8155:/etc/systemd/network# cat /etc/nsswitch.conf 
# /etc/nsswitch.conf
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          localuser files myhostname  mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

Related Questions

How to Configure Google DNS or OpenDNS with Netplan?

Updated December 03, 2018 16:00 PM

Systemd host-only bridge

Updated March 13, 2019 12:00 PM

How do I host a registered domain with bind9?

Updated February 07, 2016 12:40 PM