From a201963c83beed0194f7d93d74fd7f77df9497e8 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Fri, 20 Nov 2026 08:28:40 +0100 Subject: [PATCH] Keep NetworkManager-wait-online enabled Disabling it left network-online.target empty, so reflector, periodic maintenance and nftables-drift raced the LAN/DNS and failed every boot. Co-Authored-By: Claude Opus 5.5 --- .../nm-wait-online-kept-2026-11-20.json | 10 ++++++ .../i3blocks-automation-tutor-2026-10-10.json | 31 ------------------- .../nm-wait-online-kept-2026-11-20.json | 29 +++++++++++++++++ .../fixes/fix_arch_performance.sh | 6 ++-- .../fixes/lib/arch_hardware.sh | 13 +++++--- .../fixes/lib/arch_perf_fixes.sh | 13 +++++--- .../lib/tests/test_arch_hardware_boot.sh | 19 ++++++------ .../fixes/lib/tests/test_arch_perf_fixes.sh | 20 ++++++------ .../fixes/optimize_arch_desktop.sh | 6 ++-- 9 files changed, 84 insertions(+), 63 deletions(-) create mode 100644 docs/superpowers/contracts/nm-wait-online-kept-2026-11-20.json delete mode 100644 docs/superpowers/evidence/i3blocks-automation-tutor-2026-10-10.json create mode 100644 docs/superpowers/evidence/nm-wait-online-kept-2026-11-20.json diff --git a/docs/superpowers/contracts/nm-wait-online-kept-2026-11-20.json b/docs/superpowers/contracts/nm-wait-online-kept-2026-11-20.json new file mode 100644 index 00000000..c18d52e5 --- /dev/null +++ b/docs/superpowers/contracts/nm-wait-online-kept-2026-11-20.json @@ -0,0 +1,10 @@ +{ + "title": "Keep NetworkManager-wait-online enabled", + "objective": "The Arch performance fixers stop disabling NetworkManager-wait-online, so network-online.target waits for the LAN and the boot units ordered after it (reflector, periodic maintenance, nftables-drift) stop failing.", + "acceptance_criteria": [ + "fix_nm_wait_online and tweak_nm_wait_online enable the unit when disabled and never disable it", + "After a boot, systemctl --failed lists none of reflector, periodic-system-*, nftables-drift" + ], + "out_of_scope": ["fix_ubuntu_performance.sh (other machine)"], + "verifier": "bash linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh; bash linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh; systemctl --failed after the next boot" +} diff --git a/docs/superpowers/evidence/i3blocks-automation-tutor-2026-10-10.json b/docs/superpowers/evidence/i3blocks-automation-tutor-2026-10-10.json deleted file mode 100644 index 28ef5b35..00000000 --- a/docs/superpowers/evidence/i3blocks-automation-tutor-2026-10-10.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "intent": "The i3 bar shows today's Automation tutor progress (tutor n/4), hides at 4/4, and a click opens the tutor via plc-lab's run.sh.", - "scope": [ - "linux_configuration/i3blocks/automation_tutor.sh, the [automation_tutor] stanza in linux_configuration/i3blocks/config, linux_configuration/tests/test_i3blocks_automation_tutor.sh", - "Non-goal: no ledger HMAC check (earned_time owns that); display only" - ], - "changes": [ - "New block counts kind==credit rows dated today in ~/.local/share/automation_tutor/ledger.json; hidden at 4/4; orange message when jq is missing or the ledger is unreadable", - "Click runs ~/src/plc-lab/run.sh (override AUTOMATION_TUTOR_RUN); ledger override AUTOMATION_TUTOR_LEDGER", - "Hermetic test with a stub run.sh and fixture ledgers: no ledger, 2 today + 1 yesterday, 4 today, unreadable, click" - ], - "verification": [ - { - "command": "bash linux_configuration/tests/test_i3blocks_automation_tutor.sh", - "result": "pass", - "evidence": "automation_tutor block: all checks passed" - }, - { - "command": "pre-commit run --files ", - "result": "pass", - "evidence": "shellcheck, codespell, file caps and shell hooks passed" - } - ], - "risks": [ - "i3blocks config is deployed by the installer; the block only appears after the next deploy to ~/.config/i3blocks" - ], - "rollback": [ - "git revert the commit", - "Remove [automation_tutor] from ~/.config/i3blocks/config and reload i3blocks" - ] -} diff --git a/docs/superpowers/evidence/nm-wait-online-kept-2026-11-20.json b/docs/superpowers/evidence/nm-wait-online-kept-2026-11-20.json new file mode 100644 index 00000000..e54b0a2d --- /dev/null +++ b/docs/superpowers/evidence/nm-wait-online-kept-2026-11-20.json @@ -0,0 +1,29 @@ +{ + "intent": "Boot units ordered after network-online.target (reflector, periodic maintenance, nftables-drift) stop failing at boot.", + "scope": [ + "linux_configuration/fixes/lib/arch_perf_fixes.sh, lib/arch_hardware.sh, fix_arch_performance.sh, optimize_arch_desktop.sh", + "fix_ubuntu_performance.sh left alone: other machine, not observed failing" + ], + "changes": [ + "fix_nm_wait_online and tweak_nm_wait_online now ENABLE NetworkManager-wait-online instead of disabling it", + "menu/header text updated to match" + ], + "verification": [ + { + "command": "bash linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh && bash linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh", + "result": "pass", + "evidence": "red first (3 + 3 failures), then 21/0 and 27/0" + }, + { + "command": "systemctl list-dependencies network-online.target", + "result": "pass", + "evidence": "host now lists NetworkManager-wait-online.service (was empty, target reached at 08:22:13 before the LAN was up)" + } + ], + "risks": [ + "Boot units after network-online wait up to NM's 30 s timeout when there is no network" + ], + "rollback": [ + "git revert; systemctl disable NetworkManager-wait-online.service" + ] +} diff --git a/linux_configuration/fixes/fix_arch_performance.sh b/linux_configuration/fixes/fix_arch_performance.sh index 9b57831e..851d14fe 100755 --- a/linux_configuration/fixes/fix_arch_performance.sh +++ b/linux_configuration/fixes/fix_arch_performance.sh @@ -7,7 +7,7 @@ # 2. CPU governor stuck on powersave → AMD Ryzen throttled despite AC power # 3. No power management daemon → inconsistent CPU/GPU power state management # 4. Systemd journal bloated (>1GiB) → wastes disk I/O -# 5. NetworkManager-wait-online.service → adds ~6s to every boot for no benefit +# 5. NetworkManager-wait-online.service → kept enabled: network-online.target needs it # 6. media-organizer.service broken → wrong script path & user, fails every boot # # Usage: @@ -49,7 +49,7 @@ Fixes applied: 1. Enable NVIDIA hardware acceleration (RenderAccel true) 2. Install/enable power-profiles-daemon, set performance profile 3. Vacuum systemd journal to 300M, cap future size - 4. Disable NetworkManager-wait-online.service (saves ~6s boot) + 4. Keep NetworkManager-wait-online.service enabled (boot units need the network) 5. Fix media-organizer.service (correct path and user) All fixes are idempotent and safe to re-run. @@ -183,7 +183,7 @@ main() { fix_journal apply_fix \ - "Fix 4/5: Disable NetworkManager-wait-online.service (~6s boot saving)" \ + "Fix 4/5: Keep NetworkManager-wait-online.service enabled" \ fix_nm_wait_online apply_fix \ diff --git a/linux_configuration/fixes/lib/arch_hardware.sh b/linux_configuration/fixes/lib/arch_hardware.sh index 3d9f54c1..6fb2a76c 100755 --- a/linux_configuration/fixes/lib/arch_hardware.sh +++ b/linux_configuration/fixes/lib/arch_hardware.sh @@ -125,15 +125,20 @@ tweak_mitigations() { } # =================================================================== -# 8. Disable NetworkManager-wait-online +# 8. Keep NetworkManager-wait-online enabled # =================================================================== +# Keep NetworkManager-wait-online ENABLED. Disabling it once "saved ~6s" but +# left network-online.target with no dependencies: reflector, the periodic +# maintenance units and nftables-drift then ran before DNS/LAN existed and +# failed on every boot (2026-11-20). Only units ordered after +# network-online.target wait for it; the desktop does not. tweak_nm_wait_online() { - if ! systemctl is-enabled NetworkManager-wait-online.service >/dev/null 2>&1; then - log_ok "NetworkManager-wait-online already disabled — skipping." + if systemctl is-enabled NetworkManager-wait-online.service >/dev/null 2>&1; then + log_ok "NetworkManager-wait-online already enabled — skipping." return 0 fi - systemctl disable NetworkManager-wait-online.service + systemctl enable NetworkManager-wait-online.service return 0 } diff --git a/linux_configuration/fixes/lib/arch_perf_fixes.sh b/linux_configuration/fixes/lib/arch_perf_fixes.sh index 1e306707..f5c22a62 100755 --- a/linux_configuration/fixes/lib/arch_perf_fixes.sh +++ b/linux_configuration/fixes/lib/arch_perf_fixes.sh @@ -48,15 +48,20 @@ JOURNALEOF } # =================================================================== -# Fix 4: Disable NetworkManager-wait-online +# Fix 4: Keep NetworkManager-wait-online enabled # =================================================================== +# Keep NetworkManager-wait-online ENABLED. Disabling it once "saved ~6s" but +# left network-online.target with no dependencies: reflector, the periodic +# maintenance units and nftables-drift then ran before DNS/LAN existed and +# failed on every boot (2026-11-20). Only units ordered after +# network-online.target wait for it; the desktop does not. fix_nm_wait_online() { - if ! systemctl is-enabled NetworkManager-wait-online.service >/dev/null 2>&1; then - log_ok "NetworkManager-wait-online is already disabled — skipping." + if systemctl is-enabled NetworkManager-wait-online.service >/dev/null 2>&1; then + log_ok "NetworkManager-wait-online already enabled — skipping." return 0 fi - systemctl disable NetworkManager-wait-online.service + systemctl enable NetworkManager-wait-online.service return 0 } diff --git a/linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh b/linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh index dbd33cee..bb4426f2 100755 --- a/linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh +++ b/linux_configuration/fixes/lib/tests/test_arch_hardware_boot.sh @@ -79,18 +79,19 @@ _t_lacks "$(_t_calls)" "grub-mkconfig" "tweak_mitigations: does not regenerate w printf '\n-- tweak_nm_wait_online --\n' -# Case 16: already disabled -> skip. -arch_desktop_reset -_t_stub systemctl 'exit 1' -_t_run tweak_nm_wait_online -_t_contains "$out" "already disabled" "tweak_nm_wait_online: reports the skip" - -# Case 17: enabled -> disabled. +# Case 16: already enabled -> skip, never disable (network-online.target needs it). arch_desktop_reset _t_stub systemctl 'exit 0' _t_run tweak_nm_wait_online -_t_contains "$(_t_calls)" "systemctl disable NetworkManager-wait-online.service" \ - "tweak_nm_wait_online: disables the service" +_t_contains "$out" "already enabled" "tweak_nm_wait_online: reports the skip" +_t_lacks "$(_t_calls)" "systemctl disable" "tweak_nm_wait_online: never disables it" + +# Case 17: disabled -> enabled. +arch_desktop_reset +_t_stub systemctl 'exit 1' +_t_run tweak_nm_wait_online +_t_contains "$(_t_calls)" "systemctl enable NetworkManager-wait-online.service" \ + "tweak_nm_wait_online: enables the service" printf '\n-- tweak_journal --\n' diff --git a/linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh b/linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh index 8b83e239..8cd6a757 100755 --- a/linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh +++ b/linux_configuration/fixes/lib/tests/test_arch_perf_fixes.sh @@ -50,20 +50,22 @@ _t_lacks "$(_t_calls)" "systemctl restart systemd-journald" \ "fix_journal: does not restart journald when the cap already exists" # --- fix_nm_wait_online ----------------------------------------------------- - -arch_reset -_t_stub systemctl 'exit 0' -fix_nm_wait_online -_t_contains "$(_t_calls)" "systemctl disable NetworkManager-wait-online.service" \ - "fix_nm_wait_online: disables the wait-online unit when it is enabled" +# Disabling it left network-online.target with no dependencies, so every +# After=network-online.target unit raced DNS at boot and failed (2026-11-20). arch_reset _t_stub systemctl 'exit 1' +fix_nm_wait_online +_t_contains "$(_t_calls)" "systemctl enable NetworkManager-wait-online.service" \ + "fix_nm_wait_online: enables the wait-online unit when it is disabled" + +arch_reset +_t_stub systemctl 'exit 0' out="$(fix_nm_wait_online 2>&1)" -_t_contains "$out" "already disabled" \ - "fix_nm_wait_online: reports a unit that is already disabled" +_t_contains "$out" "already enabled" \ + "fix_nm_wait_online: reports a unit that is already enabled" _t_lacks "$(_t_calls)" "systemctl disable" \ - "fix_nm_wait_online: does not re-disable an already-disabled unit" + "fix_nm_wait_online: never disables the wait-online unit" # --- fix_media_organizer ---------------------------------------------------- diff --git a/linux_configuration/fixes/optimize_arch_desktop.sh b/linux_configuration/fixes/optimize_arch_desktop.sh index 6a47cf0d..0be7b15b 100755 --- a/linux_configuration/fixes/optimize_arch_desktop.sh +++ b/linux_configuration/fixes/optimize_arch_desktop.sh @@ -10,7 +10,7 @@ # 5. Filesystem — fstrim timer, noatime advisory # 6. NVIDIA GPU — max performance level via persistence mode # 7. Kernel mitigations — option to disable CPU vulnerability mitigations for extra speed -# 8. Boot speed — disable unnecessary wait-online services +# 8. Keep NetworkManager-wait-online enabled (boot units need the network) # 9. Journal housekeeping — cap at 300M # 10. Process scheduler — install ananicy-cpp for automatic nice/ionice/scheduling # @@ -64,7 +64,7 @@ Optimizations applied: 5. Enable fstrim.timer for SSD TRIM maintenance 6. Set NVIDIA GPU to max performance level (persistence mode) 7. [--aggressive] Disable CPU vulnerability mitigations - 8. Disable NetworkManager-wait-online.service for faster boot + 8. Keep NetworkManager-wait-online.service enabled 9. Vacuum & cap systemd journal at 300M 10. Install/enable ananicy-cpp for automatic process prioritization @@ -150,7 +150,7 @@ main() { tweak_mitigations apply_tweak \ - "Tweak 8/10: Disable NetworkManager-wait-online (faster boot)" \ + "Tweak 8/10: Keep NetworkManager-wait-online enabled" \ tweak_nm_wait_online apply_tweak \