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

WIP: Run NM via systemd unit, don't depend on ip=dhcp kargs #321

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion live/EFI/fedora/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ set timeout=5

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora CoreOS (Live)' --class fedora --class gnu-linux --class gnu --class os {
linux /images/vmlinuz @@KERNEL-ARGS@@ rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal
linux /images/vmlinuz @@KERNEL-ARGS@@ ignition.firstboot ignition.platform.id=metal
initrd /images/initramfs.img
}
2 changes: 1 addition & 1 deletion live/isolinux/isolinux.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ label linux
menu label ^Fedora CoreOS (Live)
menu default
kernel /images/vmlinuz
append initrd=/images/initramfs.img @@KERNEL-ARGS@@ rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal
append initrd=/images/initramfs.img @@KERNEL-ARGS@@ ignition.firstboot ignition.platform.id=metal

menu separator # insert an empty line

Expand Down
2 changes: 1 addition & 1 deletion live/zipl.prm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@@KERNEL-ARGS@@ rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal
@@KERNEL-ARGS@@ ignition.firstboot ignition.platform.id=metal
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Network Manager (CoreOS initrd)
Wants=network.target
After=network-pre.target dbus.service
Before=network.target network.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/nm-initrd-generator rd.neednet=1 ip=dhcp,dhcp6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to work. I fear this is going to miss:

  • custom kargs for static networking (e.g. the ones injected by coreos-installer)
  • runtime kargs from /etc/cmdline.d. (e.g. the ones forwarded from vmware guestinfo)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom kargs for static networking (e.g. the ones injected by coreos-installer)

Right, we probably need to make this an ExecStartPre= that looks at /proc/cmdline and defers to that if any relevant arguments exist.

runtime kargs from /etc/cmdline.d. (e.g. the ones forwarded from vmware guestinfo)

This only exists in coreos/afterburn#379 right?

But hmm...either way, we should order After=dracut-cmdline.service and parse.../tmp/networking_opts it looks like?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the vmware guestinfo bits specifically are only in a not-yet-merged PR, but generally I think the cmdline.d primitive is a useful one to keep.

ExecStart=/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_MODULE CAP_AUDIT_WRITE CAP_KILL CAP_SYS_CHROOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

depends() {
echo ignition network-manager
}

install_and_enable_unit() {
unit="$1"; shift
target="$1"; shift
inst_simple "$moddir/$unit" "$systemdsystemunitdir/$unit"
mkdir -p "$initdir/$systemdsystemunitdir/$target.requires"
ln_r "../$unit" "$systemdsystemunitdir/$target.requires/$unit"
}

install() {
# We're forcibly overriding NM to be run as a service
install_and_enable_unit coreos-NetworkManager.service network-online.target
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be network.target, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm...debatable. See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
I think what Ignition wants is much closer to network-online.target.

}