Skip to content

fix(wifi): prevent stale WiFi settings from being applied after Skip#1540

Merged
tdewey-rpi merged 1 commit into
raspberrypi:mainfrom
4RH1T3CT0R7:dev/4rh1t3ct0r/fix-wifi-persistence
Mar 16, 2026
Merged

fix(wifi): prevent stale WiFi settings from being applied after Skip#1540
tdewey-rpi merged 1 commit into
raspberrypi:mainfrom
4RH1T3CT0R7:dev/4rh1t3ct0r/fix-wifi-persistence

Conversation

@4RH1T3CT0R7

@4RH1T3CT0R7 4RH1T3CT0R7 commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

When a user previously configured WiFi and later skips customization (e.g. for an ETH0-only headless build), the WiFi settings from the previous session were silently applied to the image

customizationSettings is loaded from persistent storage (QSettings) at app startup. When the user clicks "Skip" on any customization step, the runtime flags (wifiConfigured = false) are cleared but the WiFi keys (wifiSSID, wifiPasswordCrypt, wifiHidden) remain in customizationSettings. The customization generator checks wifiSSID directly - not the wifiConfigured flag - so it applies the stale WiFi config

This is the same class of bug as #1520 (USB Gadget Mode persistence)

Fix

Before calling applyCustomisationFromSettings(), strip WiFi keys from customizationSettings when wifiConfigured is false. This is done centrally in WizardContainer.qml at the writing step entry point, covering all Skip paths

Closes #1326

@4RH1T3CT0R7 4RH1T3CT0R7 force-pushed the dev/4rh1t3ct0r/fix-wifi-persistence branch from 4fc34af to 42aa9e0 Compare March 7, 2026 17:03
@tdewey-rpi

Copy link
Copy Markdown
Collaborator

Thanks for the PR, @4RH1T3CT0R7

I think this is probably inverted, though? Shouldn't we just fix the customisation generator to actually honour the wifiConfigured flag, and avoid otherwise transforming state?

Move the wifiConfigured check from QML-side filtering into the C++
customisation generator itself. All three generation paths (systemd
script, cloud-init user-data, cloud-init network-config) now read the
wifiConfigured flag and return empty WiFi fields when false.

This prevents stale persisted WiFi settings from earlier sessions
being applied when the user skips WiFi configuration.

Defaults to true for backward compatibility.

Fixes: raspberrypi#1326
@4RH1T3CT0R7 4RH1T3CT0R7 force-pushed the dev/4rh1t3ct0r/fix-wifi-persistence branch from 42aa9e0 to c897862 Compare March 13, 2026 10:28
@4RH1T3CT0R7

4RH1T3CT0R7 commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

Good point, the generator should honour the flag directly rather than filtering state in QML

Reworked: the wifiConfigured flag is now passed through to customization_generator.cpp, and all three generation paths (generateSystemdScript, generateCloudInitUserData, generateCloudInitNetworkConfig) check it. When wifiConfigured is false, WiFi-related fields (ssid, cryptedPsk, hidden) are set to empty/false, so stale persisted values are never used. Defaults to true for backward compatibility

The QML side now just passes customizationSettings.wifiConfigured = wifiConfigured and hands the complete settings object to the generator unchanged

@tdewey-rpi tdewey-rpi merged commit dd05076 into raspberrypi:main Mar 16, 2026
@4RH1T3CT0R7 4RH1T3CT0R7 deleted the dev/4rh1t3ct0r/fix-wifi-persistence branch March 17, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: wifi builds default wifi on

2 participants