Skip to content

Commit

Permalink
overlay/live: reconfigure NetworkManager-wait-online in the real root
Browse files Browse the repository at this point in the history
This adds coreos-liveiso-reconfigure-nm-wait-online.service which will
configured NetworkManager-wait-online.service in the real root timeout
quicker and also not show a failure if there is no connection.

Doing this for the Live ISO improves the user experience when booting
the Live ISO without network.
  • Loading branch information
dustymabe committed Apr 3, 2020
1 parent b834bcb commit 6237683
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Configure NetworkManager-wait-online in the real root for the
# Live ISO to timeout quicker and also not explicitly fail since
# booting the Live ISO without network is a valid use case.
#
# Doing this improves the user experience when booting the
# Live ISO without network.

[Unit]
Description=Reconfigure NetworkManager-wait-online service
DefaultDependencies=no
# Make sure we are in the initramfs and we are booted to the live ISO
ConditionPathExists=/usr/lib/initrd-release
ConditionKernelCommandLine=coreos.liveiso
ConditionPathExists=/run/ostree-live

[Service]
Type=oneshot
RemainAfterExit=yes
# Note keep this in sync with NetworkManager-wait-online.service
# Right now we are keeping the same ExecStart but we are making it
# OK to fail (`-`) and timeout sooner (5 seconds vs 30).
ExecStartPre=/usr/bin/mkdir -p /run/systemd/system/NetworkManager-wait-online.service.d
ExecStart=/bin/bash -c 'echo -e "[Service]\nExecStart=\nExecStart=-/usr/bin/nm-online -s -q --timeout=5" > /run/systemd/system/NetworkManager-wait-online.service.d/liveiso.conf'
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_requires sysroot-etc.mount initrd-root-fs.target
add_requires sysroot-var.mount initrd-root-fs.target

add_requires coreos-liveiso-network-kargs.service initrd.target
add_requires coreos-liveiso-reconfigure-nm-wait-online.service initrd.target

mkdir -p "${UNIT_DIR}/ostree-prepare-root.service.d"
cat > "${UNIT_DIR}/ostree-prepare-root.service.d/10-live.conf" <<EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ install() {

inst_simple "$moddir/coreos-liveiso-network-kargs.service" \
"$systemdsystemunitdir/coreos-liveiso-network-kargs.service"

inst_simple "$moddir/coreos-liveiso-reconfigure-nm-wait-online.service" \
"$systemdsystemunitdir/coreos-liveiso-reconfigure-nm-wait-online.service"
}

0 comments on commit 6237683

Please sign in to comment.