From 4823653214615729bbd62940c5b3d7b987dcb4a5 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 3 Apr 2022 09:01:10 +0200 Subject: [PATCH] bundles/systemd-networkd: remove usage of systemd-resolved Something in the combination of arch+zfs+netctl+resolved+ipv6 leads to hanging dns, which in turn leads to hanging everything. --- bundles/arch-with-gui/metadata.py | 3 --- bundles/systemd-networkd/items.py | 23 ++++++++++++----------- nodes/kunsi-t470.py | 1 - 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/bundles/arch-with-gui/metadata.py b/bundles/arch-with-gui/metadata.py index 2748af1..869a7f9 100644 --- a/bundles/arch-with-gui/metadata.py +++ b/bundles/arch-with-gui/metadata.py @@ -80,9 +80,6 @@ defaults = { 'xdotool': {}, # needed for maim window selection }, }, - 'systemd-networkd': { - 'enable-resolved': True, - }, } @metadata_reactor.provides( diff --git a/bundles/systemd-networkd/items.py b/bundles/systemd-networkd/items.py index cd33380..aa50ca8 100644 --- a/bundles/systemd-networkd/items.py +++ b/bundles/systemd-networkd/items.py @@ -10,16 +10,12 @@ files = { svc_systemd = { 'systemd-networkd': {}, + 'systemd-resolved': { + 'running': False, + 'enabled': False, + }, } -if node.metadata.get('systemd-networkd/enable-resolved', False): - svc_systemd['systemd-resolved'] = {} -else: - files['/etc/resolv.conf'] = { - 'content_type': 'mako', - } - - directories = { '/etc/systemd/network': { 'purge': True, @@ -34,16 +30,16 @@ directories = { mac_host_prefix = '%04x' % (node.magic_number % 65534) generated_mac = f'52:54:00:{mac_host_prefix[0:2]}:{mac_host_prefix[2:4]}:{{}}' +all_interfaces_use_dhcp = True -# Don't use .get() here. We might end up with a node without a network -# config! -for interface, config in node.metadata['interfaces'].items(): +for interface, config in node.metadata.get('interfaces').items(): if config.get('dhcp', False): if 'vlans' in config: raise BundleError(f'{node.name} interface {interface} cannot use vlans and dhcp!') template = 'template-iface-dhcp.network' else: template = 'template-iface-nodhcp.network' + all_interfaces_use_dhcp = False if '.' in interface: vlan_id = int(interface.split('.')[1]) @@ -94,6 +90,11 @@ for interface, config in node.metadata['interfaces'].items(): }, } +if not all_interfaces_use_dhcp: + files['/etc/resolv.conf'] = { + 'content_type': 'mako', + } + for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): files[f'/etc/systemd/network/{bond}.netdev'] = { 'source': 'template-bond.netdev', diff --git a/nodes/kunsi-t470.py b/nodes/kunsi-t470.py index 0768b1f..61f21d4 100644 --- a/nodes/kunsi-t470.py +++ b/nodes/kunsi-t470.py @@ -80,7 +80,6 @@ nodes['kunsi-t470'] = { 'install_gui': True, }, 'systemd-networkd': { - 'enable-resolved': True, 'bridges': { 'br0': { 'match': {