|
Dusty Mabe |
fbb253 |
From ac0e8f7dcc81432311906c3fca0d4211f6a2f68c Mon Sep 17 00:00:00 2001
|
|
Dusty Mabe |
fbb253 |
From: Dusty Mabe <dusty@dustymabe.com>
|
|
Dusty Mabe |
fbb253 |
Date: Tue, 13 Apr 2021 11:36:21 -0400
|
|
Dusty Mabe |
fbb253 |
Subject: [PATCH 1/2] fix(network-manager): only run NetworkManager if
|
|
Dusty Mabe |
fbb253 |
rd.neednet=1
|
|
Dusty Mabe |
fbb253 |
|
|
Dusty Mabe |
fbb253 |
Don't run the new systemd unit (nm-run.service) if rd.neednet=1
|
|
Dusty Mabe |
fbb253 |
isn't set. nm-initrd-generator will generate configuration even
|
|
Dusty Mabe |
fbb253 |
without rd.neednet=1 so determining if we should start based on
|
|
Dusty Mabe |
fbb253 |
just if connection profiles exist isn't enough. We need some other
|
|
Dusty Mabe |
fbb253 |
indicator. In this case we lay down a /run/NetworkManager/initrd/neednet
|
|
Dusty Mabe |
fbb253 |
if rd.neednet=1, which is used by nm-run.service to determine the
|
|
Dusty Mabe |
fbb253 |
need to run.
|
|
Dusty Mabe |
fbb253 |
---
|
|
Dusty Mabe |
fbb253 |
modules.d/35network-manager/nm-lib.sh | 1 +
|
|
Dusty Mabe |
fbb253 |
modules.d/35network-manager/nm-run.service | 3 +++
|
|
Dusty Mabe |
fbb253 |
2 files changed, 4 insertions(+)
|
|
Dusty Mabe |
fbb253 |
|
|
Dusty Mabe |
fbb253 |
diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh
|
|
Dusty Mabe |
fbb253 |
index fe053cf..d756022 100644
|
|
Dusty Mabe |
fbb253 |
--- a/modules.d/35network-manager/nm-lib.sh
|
|
Dusty Mabe |
fbb253 |
+++ b/modules.d/35network-manager/nm-lib.sh
|
|
Dusty Mabe |
fbb253 |
@@ -14,6 +14,7 @@ nm_generate_connections()
|
|
Dusty Mabe |
fbb253 |
/etc/sysconfig/network-scripts/ifcfg-*; do
|
|
Dusty Mabe |
fbb253 |
[ -f "$i" ] || continue
|
|
Dusty Mabe |
fbb253 |
echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
|
|
Dusty Mabe |
fbb253 |
+ : > /run/NetworkManager/initrd/neednet # activate nm-run.service
|
|
Dusty Mabe |
fbb253 |
break
|
|
Dusty Mabe |
fbb253 |
done
|
|
Dusty Mabe |
fbb253 |
fi
|
|
Dusty Mabe |
fbb253 |
diff --git a/modules.d/35network-manager/nm-run.service b/modules.d/35network-manager/nm-run.service
|
|
Dusty Mabe |
fbb253 |
index b667ce3..f041ade 100644
|
|
Dusty Mabe |
fbb253 |
--- a/modules.d/35network-manager/nm-run.service
|
|
Dusty Mabe |
fbb253 |
+++ b/modules.d/35network-manager/nm-run.service
|
|
Dusty Mabe |
fbb253 |
@@ -15,6 +15,9 @@ Before=network.target network-online.target
|
|
Dusty Mabe |
fbb253 |
#run before we try to mount anything from the dracut hooks
|
|
Dusty Mabe |
fbb253 |
Before=dracut-initqueue.service
|
|
Dusty Mabe |
fbb253 |
|
|
Dusty Mabe |
fbb253 |
+#do not run if networking not needed
|
|
Dusty Mabe |
fbb253 |
+ConditionPathExists=/run/NetworkManager/initrd/neednet
|
|
Dusty Mabe |
fbb253 |
+
|
|
Dusty Mabe |
fbb253 |
#do not run, if there is no configuration
|
|
Dusty Mabe |
fbb253 |
ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
|
|
Dusty Mabe |
fbb253 |
ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*
|
|
Dusty Mabe |
fbb253 |
--
|
|
Dusty Mabe |
fbb253 |
2.30.2
|
|
Dusty Mabe |
fbb253 |
|