Blob Blame History Raw
From 0454dc247a146fabd66232c26536514dca1f6044 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 18 Sep 2018 11:17:54 +0200
Subject: [PATCH] network: configure NetworkManager to use dhclient

If the network module obtained a lease using dhclient, NetworkManager
must be configured to use it too, otherwise it would obtain a different
lease (and could potentially break a connection to the network volume).
---
 modules.d/40network/ifup.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 54981386..ea2a67ff 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -41,6 +41,12 @@ do_dhcp() {
         return 1
     fi
 
+    if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
+        mkdir -p /run/NetworkManager/conf.d
+        echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
+        echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
+    fi
+
     while [ $_COUNT -lt $_DHCPRETRY ]; do
         info "Starting dhcp for interface $netif"
         dhclient "$@" \