Skip to content

feat(raspberry-pi-os): Disable fallback netcfg + remove apt mirror config - #6482

Merged
blackboxsw merged 3 commits into
canonical:mainfrom
paulober:rpios-disable-fallback-netcfg
Dec 8, 2025
Merged

feat(raspberry-pi-os): Disable fallback netcfg + remove apt mirror config#6482
blackboxsw merged 3 commits into
canonical:mainfrom
paulober:rpios-disable-fallback-netcfg

Conversation

@paulober

@paulober paulober commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

Proposed Commit Message

feat(raspberry-pi-os): Disable fallback netcfg + remove apt mirror cfg

Disables the fallback netcfg in the cloud.cfg template for
Raspberry Pi OS and it removes the apt mirror config because
RPi OS ships as already installed images and there is no
scenario where users are expected to rely on cloud-init
for providing the apt config.

Additional Context

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

@tdewey-rpi

@github-actions github-actions Bot added the documentation This Pull Request changes documentation label Sep 23, 2025
…nfig

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
@paulober
paulober force-pushed the rpios-disable-fallback-netcfg branch from 255a3c9 to a937825 Compare September 26, 2025 09:44
@github-actions

Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions Bot added the stale-pr Pull request is stale; will be auto-closed soon label Oct 11, 2025
@paulober

Copy link
Copy Markdown
Contributor Author

@blackboxsw

@github-actions github-actions Bot removed the stale-pr Pull request is stale; will be auto-closed soon label Oct 16, 2025
@github-actions

Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions Bot added the stale-pr Pull request is stale; will be auto-closed soon label Oct 30, 2025
@paulober

Copy link
Copy Markdown
Contributor Author

@blackboxsw

@github-actions github-actions Bot removed the stale-pr Pull request is stale; will be auto-closed soon label Oct 31, 2025
@github-actions

Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions Bot added the stale-pr Pull request is stale; will be auto-closed soon label Nov 14, 2025
@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Nov 17, 2025

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hello @paulober and @tdewey-rpi. I would like to merge this PR and have a couple of minor requests.

  1. Can we update the suggested commit message in this PR description to document the reason why Raspberry Pi OS no longer wants to point APT to http://archive.raspberrypi.com/debian/ It still appears there are some packages hosted there. In the absence of such APT configuration what is the expected alternatives for RPI OS to obtain such packages.

  2. This PR or branch doesn't allow me to resolve and push my minor review suggestions to it. Can one of the RPI folks push the following changes to this branch (which captures my inline review comments)

diff --git a/cloudinit/distros/raspberry_pi_os.py b/cloudinit/distros/raspberry_pi_os.py
index a35c81cea..f5a5a20fa 100644
--- a/cloudinit/distros/raspberry_pi_os.py
+++ b/cloudinit/distros/raspberry_pi_os.py
@@ -86,7 +86,7 @@ class Distro(debian.Distro):
         LOG.debug("%s value is: %s", key, disable_fallback_netcfg)
 
         if not disable_fallback_netcfg:
-            return net.generate_fallback_config(self)
+            return net.generate_fallback_config()
 
         LOG.info(
             "Skipping generation of fallback network config as per "
diff --git a/tests/unittests/distros/test_raspberry_pi_os.py b/tests/unittests/distros/test_raspberry_pi_os.py
index 0d87395d5..0d7888436 100644
--- a/tests/unittests/distros/test_raspberry_pi_os.py
+++ b/tests/unittests/distros/test_raspberry_pi_os.py
@@ -94,9 +94,12 @@ class TestRaspberryPiOS:
             assert distro.add_user("pi") is False
             assert "Failed to setup user" in caplog.text
 
-    @mock.patch("cloudinit.net.generate_fallback_config")
+    @mock.patch(
+        "cloudinit.net.generate_fallback_config",
+        return_value={"version": 1, "config": "fake"},
+    )
     def test_fallback_netcfg(self, m_fallback_cfg, caplog):
-        # This test is based on Photon OS test_fallback_netcfg
+        """Avoid fallback network unless disable_fallback_netcfg is False."""
         cls = fetch("raspberry_pi_os")
         distro = cls("raspberry-pi-os", {}, None)
         key = "disable_fallback_netcfg"
@@ -106,7 +109,7 @@ class TestRaspberryPiOS:
             "Rely on Raspberry Pi OS's default network configuration."
         )
 
-        # Don't use fallback if no setting given
+        # The default skips fallback network config when no setting is given.
         caplog.clear()
         assert distro.generate_fallback_config() is None
         assert expected_log_line in caplog.text
@@ -118,5 +121,8 @@ class TestRaspberryPiOS:
 
         caplog.clear()
         distro._cfg[key] = False
-        assert distro.generate_fallback_config() is not None
+        assert distro.generate_fallback_config() == {
+            "version": 1,
+            "config": "fake",
+        }
         assert expected_log_line not in caplog.text

Once we have confirmation on the suggested drop of APT mirrors and the updated PR description we will merge this PR.

Many thanks!

Comment thread cloudinit/distros/raspberry_pi_os.py
Comment thread doc/rtd/reference/network-config.rst Outdated
Comment thread tests/unittests/distros/test_raspberry_pi_os.py Outdated
Comment thread tests/unittests/distros/test_raspberry_pi_os.py Outdated
Comment thread tests/unittests/distros/test_raspberry_pi_os.py Outdated

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Needs fixing for justification in PR suggested commit message for dropping RPI APT mirrors. Minor unittest/comment nits and avoiding passing self into net.generate_fallback_config()

Comment thread cloudinit/distros/raspberry_pi_os.py Outdated
@blackboxsw blackboxsw self-assigned this Nov 17, 2025
@paulober

Copy link
Copy Markdown
Contributor Author
  1. Can we update the suggested commit message in this PR description to document the reason why Raspberry Pi OS no longer wants to point APT to http://archive.raspberrypi.com/debian/ It still appears there are some packages hosted there. In the absence of such APT configuration what is the expected alternatives for RPI OS to obtain such packages.

Updated. RPi OS only ships as installed images where we want apt config stuff to work as it did before so there is no scenario where I expect / want users to rely on cloud-init to provide the apt config.

Apply patch provided by @blackboxsw to correct the call to
generate_fallback_config() and update the corresponding unit tests.

Authored-by: Chad Smith <chad.smith@canonical.com>
Authored-by: Chad Smith <chad.smith@canonical.com>
@paulober
paulober requested a review from blackboxsw November 25, 2025 23:04

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you @paulober for these additional updates and providing background in the commit message.

@blackboxsw
blackboxsw merged commit d7bc162 into canonical:main Dec 8, 2025
21 checks passed
blackboxsw pushed a commit to blackboxsw/cloud-init that referenced this pull request Dec 12, 2025
canonical#6482)

Disable the fallback netcfg in the cloud.cfg template for
Raspberry Pi OS and remove the apt mirror config because
RPi OS ships as already installed images and there is no
scenario where users are expected to rely on cloud-init
for providing the apt config.

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
holmanb pushed a commit that referenced this pull request Dec 18, 2025
#6482)

Disable the fallback netcfg in the cloud.cfg template for
Raspberry Pi OS and remove the apt mirror config because
RPi OS ships as already installed images and there is no
scenario where users are expected to rely on cloud-init
for providing the apt config.

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation This Pull Request changes documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants