[Bug 2070320] Re: Autoinstall with apt deb822 source on noble does not override '/etc/apt/sources.list.d/ubuntu.sources' despite 'preserve_sources_list: false'
Chris Peterson
2070320 at bugs.launchpad.net
Wed Nov 13 23:05:21 UTC 2024
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
Foundations Bugs, which is subscribed to subiquity in 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'
Status in subiquity package in Ubuntu:
Invalid
Bug description:
When using the following apt section on autoinstall, it does not
replace the existing ubuntu sources despite the preserve_sources_list
variable being set to false. It does appear to replace
/etc/apt/sources.list, but this file is no longer used in Ubuntu
24.04.
======
apt:
preserve_sources_list: false
fallback: abort
geoip: false
sources:
landscape.sources:
source: |
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
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----
======
What ends up happening is the system will install from the Landscape
mirror, but the other sources are not removed.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/2070320/+subscriptions
More information about the foundations-bugs
mailing list