Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for wicked network manager #900

Merged
merged 11 commits into from
Nov 25, 2020

Conversation

danimo
Copy link
Contributor

@danimo danimo commented Aug 21, 2020

This introduces support for wicked as network management module.

Todo:

  • compare dbus module with the one in the bluetooth HiD PR.
  • add tests if possible (wicked is probably not available on fedora)
  • check if all parameters are properly accepted
  • add documentation

@danimo danimo changed the title WiP: wicked support WiP: support for wicked network manager Aug 21, 2020
@github-actions github-actions bot added modules Issue tracker for all modules network Issues related to the network module labels Aug 21, 2020
@danimo danimo mentioned this pull request Aug 21, 2020
@danimo
Copy link
Contributor Author

danimo commented Aug 21, 2020

Effective diff between the wicked (a) and the bluetooth dbus module (b):

diff --git a/modules.d/06dbus/module-setup.sh b/modules.d/06dbus/module-setup.sh
old mode 100755
new mode 100644
index 6843cfa3..0e8262c7
--- a/modules.d/06dbus/module-setup.sh
+++ b/modules.d/06dbus/module-setup.sh
@@ -36,30 +36,16 @@ install() {
     /usr/bin/dbus-daemon \
     /usr/bin/dbus-send
 
-  dbus_system_services="
-        org.freedesktop.systemd1
-        org.freedesktop.timedate1
-        org.freedesktop.hostname1
-  "
-  inst_dir      /etc/dbus-1/system.d
-  inst_dir      /usr/share/dbus-1/services
-  inst_dir      /usr/share/dbus-1/system-services
-  inst_multiple /etc/dbus-1/system.conf
-  inst_multiple /usr/share/dbus-1/system.conf \
-                /usr/share/dbus-1/services/org.freedesktop.systemd1.service
-  for service in $dbus_system_services ; do
-      inst_multiple        /etc/dbus-1/system.d/${service}.conf \
-              /usr/share/dbus-1/system-services/${service}.service
-  done
+  inst_multiple $(find /usr/share/dbus-1)
+  inst_multiple $(find /etc/dbus-1)
   inst_multiple $(find /var/lib/dbus)
 
   inst_hook cleanup 99 "$moddir/dbus-cleanup.sh"
 
-  grep '^messagebus:' /etc/passwd >> "$initdir/etc/passwd"
-  grep '^messagebus:' /etc/group >> "$initdir/etc/group"
+  grep '^dbus:' /etc/passwd >> "$initdir/etc/passwd"
+  grep '^dbus:' /etc/group >> "$initdir/etc/group"
 
-  # do not enable -- this is a static service
-  #systemctl --root "$initdir" enable $DBUS_SERVICE > /dev/null 2>&1
+  systemctl --root "$initdir" enable $DBUS_SERVICE > /dev/null 2>&1
 
   sed -i -e \
 '/^\[Unit\]/aDefaultDependencies=no\
  • inst_multiple chained with find seems crude, need to revisit why this was done
  • not sure about why the network services would be needed, why install them?
  • dbus vs. messagebus user is a distro thing, can be unified via grep -E '^(d|message)bus:' /etc/passwd

@rtorrero
Copy link

About your first point:

$ find /var/lib/dbus
/var/lib/dbus
/var/lib/dbus/machine-id

Maybe we could just add them explicitely, since it's just two files?

About the second point:

Do you mean the systemd service files for the wickedd parts? it's less messy to start it like this vs explicit calls since there are dependencies between the multiple wicked components and also due to the dependency with dbus. We tried multiple combinations and we had trouble to get get wicked started only when dbus was ready to be used. This way it seemed it worked fine.

@danimo
Copy link
Contributor Author

danimo commented Aug 26, 2020

$ find /var/lib/dbus
/var/lib/dbus
/var/lib/dbus/machine-id

Maybe we could just add them explicitely, since it's just two files?

Yes. If there is no deeper reason behind that, we should go for it. Also, we need to ensure the module either becomes host only safe.

About the second point:

Do you mean the systemd service files for the wickedd parts? it's less messy to start it like this vs explicit calls since there are dependencies between the multiple wicked components and also due to the dependency with dbus. We tried multiple combinations and we had trouble to get get wicked started only when dbus was ready to be used. This way it seemed it worked fine.

I was referring to this:

-  dbus_system_services="
-        org.freedesktop.systemd1
-        org.freedesktop.timedate1
-        org.freedesktop.hostname1
-  "

@danimo
Copy link
Contributor Author

danimo commented Aug 28, 2020

@rtorrero ping?

@rtorrero
Copy link

rtorrero commented Sep 2, 2020

@rtorrero ping?

I'm currently recovering the setup I used to test this. I think I remember it had something to do with the resulting lease file in case of DHCP (that will be used after the initrd stage too).

modules.d/06dbus/module-setup.sh Outdated Show resolved Hide resolved
modules.d/06dbus/module-setup.sh Outdated Show resolved Hide resolved
modules.d/06dbus/module-setup.sh Outdated Show resolved Hide resolved
modules.d/06dbus/module-setup.sh Outdated Show resolved Hide resolved
modules.d/06dbus/module-setup.sh Outdated Show resolved Hide resolved
@rtorrero
Copy link

rtorrero commented Sep 2, 2020

@rtorrero ping?

I'm currently recovering the setup I used to test this. I think I remember it had something to do with the resulting lease file in case of DHCP (that will be used after the initrd stage too).

After doing some tests, I can confirm that

       org.freedesktop.systemd1
       org.freedesktop.timedate1
       org.freedesktop.hostname1
 "```
is not really needed. It made no difference having them there or not. 

@bengal
Copy link
Contributor

bengal commented Sep 10, 2020

Hi, any progress on this?

I'm reworking the NetworkManager dracut module to run as a systemd
service with D-Bus support and I'm looking forward to see the dbus
module in this pull request merged.

Maybe the dbus module could be a separate PR, so that it can be
reviewed and merged independently from wicked support?

bengal added a commit to NetworkManager/dracut that referenced this pull request Sep 20, 2020
This commit changes how NM is started inside the initramfs. Instead of
synchronously running NM from the initqueue hook in the special
--configure-and-quit=initrd mode, start it from a systemd service.

This has multiple advantages. First, we no longer need to run NM in a
special mode that requires additional testing and
maintenance. NetworkManager works exactly as in the real root.

Also, now NM runs with D-Bus support and therefore its API can be used
by other modules. This open the possibility, for example, to integrate
nm-cloud-setup to automatically configure networking in the initramfs
based on cloud metadata.

This commit also enables the NetworkManager dispatcher service, that
allows to run shell scripts when an interface state changes. In this
way, we can call the various dracut hooks (online, netroot) as soon as
one interface gets activated instead of waiting that all interfaces
were configured (as the current implementation does).

Requirements for this commit are:

 - the D-Bus dracut module submitted at:
   dracutdevs#544
   dracutdevs#900

 - the systemd-hostnamed dracut module submitted at
   dracutdevs#895 ,
   which allows NM to change the hostname via D-Bus
   through hostnamed
@github-actions github-actions bot added crypt Issues related to the crypt module dmsquash-live Issues related to the dmsquash-live module dracut-install Issues related to dracut install drm Issues related to the drm module github Issues related to .github network-legacy Issues related to the network-legacy module rngd Issues related to the rngd module systemd Issues related to the systemd module watchdog Issues related to the watchdog module labels Oct 28, 2020
@danimo danimo changed the title WiP: support for wicked network manager Support for wicked network manager Nov 24, 2020
@danimo danimo marked this pull request as ready for review November 24, 2020 19:20
@danimo
Copy link
Contributor Author

danimo commented Nov 24, 2020

@bengal Sorry for the slow progress. I've done some testing, addressed (most of) your concerns and will be doing some more testing tomorrow, before merging this.

@danimo danimo merged commit 6fee16e into dracutdevs:master Nov 25, 2020
@danimo danimo deleted the drawick-consolidate branch November 25, 2020 17:21
@LaszloGombos
Copy link
Collaborator

Follow-up to try to test this module - #2117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypt Issues related to the crypt module dmsquash-live Issues related to the dmsquash-live module dracut-install Issues related to dracut install drm Issues related to the drm module github Issues related to .github modules Issue tracker for all modules network Issues related to the network module network-legacy Issues related to the network-legacy module rngd Issues related to the rngd module systemd Issues related to the systemd module watchdog Issues related to the watchdog module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants