So I've dug into this and I wouldn't say this is a bug, but just the apt
section being terribly confusing to reason about.

Curtin will always render a sources.list or ubuntu.sources file either
using the template built into the ISO (of the same name) or using what
is provided to the "sources_list" key. Setting "preserve_sources_list:
false" will make sure this file is not overwritten by cloud-init on
first boot.

The "sources" dictionary is only ever additive and does not change the
sources.list/ubuntu.sources file, unless you name your source with the
same name (and I think the smart thing here is done here by appending to
the file instead of overwriting). Further, this section is not affected
by the "preserve_sources_list" key. Any extra sources that end up in
sources.list.d will stay there.

I think behavior this is sensible, if only unclear on first pass. The
template includes the base sources required to install Ubuntu and I
imagine most of the time when a user specifies the "sources" key, they
just want to include sources in addition to the defaults.

That being said, I think you can achieve what you're looking for using
the example from the documentation page
(https://curtin.readthedocs.io/en/latest/topics/apt_source.html),
modified for your use case:


 apt:
  preserve_sources_list: false
  primary:
    - arches [default]
      uri: http://landscape.home/repository/standalone/ubuntu/
  sources:
    landscapekey:
      key: | # full key as block
        -----BEGIN PGP PUBLIC KEY BLOCK-----
        ...
        -----END PGP PUBLIC KEY BLOCK-----


Alternatively, "sources_list" accepts the deb822 format in 24.04, so you could 
do something like this which will give you a little more control:

  apt:
    sources_list: |
        Types: deb
        URIs: http://landscape.home/repository/standalone/ubuntu/
        Suites: noble noble-updates noble-security
        Components: main universe restricted multiverse
        Signed-By: 16234E77E46C9DE644E1F4F4DA787C193976C85B
        Architectures: amd64
    sources:
      landscapekey:
        key: | # full key as block
          -----BEGIN PGP PUBLIC KEY BLOCK-----
          ...
          -----END PGP PUBLIC KEY BLOCK-----


I'm going to mark this bug as Invalid since it's not a regression like I
thought it was.

** Changed in: subiquity (Ubuntu)
       Status: Triaged => Invalid

** Changed in: subiquity (Ubuntu)
     Assignee: Chris Peterson (cpete) => (unassigned)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2070320

Title:
  Autoinstall with apt deb822 source on noble does not override
  '/etc/apt/sources.list.d/ubuntu.sources' despite
  'preserve_sources_list: false'

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/2070320/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to