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

network: ensure disconnected interfaces are disabled #2015

Conversation

Chris-Peterson444
Copy link
Contributor

@Chris-Peterson444 Chris-Peterson444 commented Jun 15, 2024

According to LP:#2063331, Subiquity policy should be to disable interfaces which are not automatically configured in the installation environment on the target machine. Subiquity already has this logic mostly in place, via a call to BaseNetworkController.update_initial_configs in the right places. The subiquitycore network controller calls this function on the first view of the network screen, but the non-core server network controller doesn't. Existing logic and comments in the non-core controller imply this is already the expected behavior in non-core installs as well (see comments in the existing autoinstall logic). This PR adds the update_initial_configs call in two places in the server network controller:

  1. In the GET request handler. This is the endpoint clients should call to get information to populate the network screen, so we should update the device configurations before sending them to the client.
  2. In the configured function. It's possible to complete the install by simply marking the network controller as configured without ever interacting with it. However, because the screen was not "shown" (i.e. server received a GET request), the target system will end up with the not updated network config. The Desktop installer specifically does this, likely to avoid changing control of the live session's network from NetworkManager to networkd. Calling update_initial_config here without calling apply_config will allow the target system to receive the correct config without modifying the live sessions network settings.

Lastly, I included a fix for NetworkDev.ip_networks_for_version that makes sure static configuration information is really removed from the config when setting ipv4 and ipv6 to either disabled or automatic. Existing behavior would allow static configuration options to be appended to the existing config when resubmitting the form and also persist when presented as "disabled" in the UI.

@Chris-Peterson444 Chris-Peterson444 force-pushed the network-wait-online-lp2063331 branch 2 times, most recently from 70febe2 to 6ac25d7 Compare June 17, 2024 22:26
This caused a bug where a user could "disable" both ipv4 and
ipv6 but the network device config still contained references
to the nameserver configuration, causing it to still show up
in the final config written.
Automatically disables interfaces that are not ready by the time we
reach the networking screen. Otherwise, the written netplan implies
all interfaces are required for start up and will cause
systemd-networkd-wait-online.service to timeout on boot (LP: #2063331).
@Chris-Peterson444 Chris-Peterson444 changed the title Network wait online lp2063331 network: ensure disconnected interfaces are disabled Jun 21, 2024
@Chris-Peterson444 Chris-Peterson444 marked this pull request as ready for review June 21, 2024 21:18
@Chris-Peterson444
Copy link
Contributor Author

There are some other improvements I think we could make to make the network screen more robust but I'll open a separate PR for those. These changes alone should resolve LP:#2063331.

It's possible that clients do not interact with the network controller -
even if the controller is interactive - and simply mark the controller
as configured (currently the desktop installer does this). Subiquity's
policy is to disable interfaces without a global IP address by the
time the network screen is shown. However, other than special handling
for autoinstall cases, this logic is only invoked the first time
the screen is shown. This makes sure the config written to the target
device adheres to policy.

This change purposefully does not apply the config in the live
environment. It's likely Desktop does not interact with the network
controller to avoid interactions between networkd and NetworkManager.
Handling of this logic should be for future commits.
@Chris-Peterson444 Chris-Peterson444 merged commit 74fa46d into canonical:main Jun 28, 2024
10 checks passed
@Chris-Peterson444 Chris-Peterson444 deleted the network-wait-online-lp2063331 branch June 28, 2024 21:24
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.

3 participants