For my ubuntu container I have a profile with a cloud-init configuration to set apt.primary.uri
. However I cannot get it to work with debian containers.
Can anyone share an example how to change the uri in /etc/apt/sources.list
for debian?
My profile is more or less like this:
config:
cloud-init.user-data: |
#cloud-init
apt:
primary:
- arches: [amd64, i386, default]
uri: https://myapt.example.com/deb.debian.org/debian
user.user-data: |
#cloud-init
apt:
primary:
- arches: [amd64, i386, default]
uri: https://myapt.example.com/deb.debian.org/debian
I know that there is a duplication, but I forgot what that was necessary. Some old ubuntu, I believe, needed one, not the other.
Correction of the example (#cloud-init
=> #cloud-config
)
config:
cloud-init.user-data: |
#cloud-config
apt:
primary:
- arches: [amd64, i386, default]
uri: https://myapt.example.com/deb.debian.org/debian
user.user-data: |
#cloud-config
apt:
primary:
- arches: [amd64, i386, default]
uri: https://myapt.example.com/deb.debian.org/debian
Now I can see that it works for images:debian/11/cloud
, however it does not work for images:debian/12/cloud
.
/var/log/cloud-init.log
2023-07-29 20:32:54,014 - cc_apt_configure.py[DEBUG]: got primary mirror: https://myapt.example.com/archive.debian.org/debian
2023-07-29 20:32:54,014 - cc_apt_configure.py[DEBUG]: got security mirror: None
2023-07-29 20:32:54,014 - cc_apt_configure.py[DEBUG]: Apt Mirror info: {'PRIMARY': 'https://myapt.example.com/archive.debian.org/debian', 'SECURITY': 'https://myapt.example.com/archive.debian.org/debian', 'MIRROR': 'https://myapt.example.com/archive.debian.org/debian'}
2023-07-29 20:32:54,015 - handlers.py[DEBUG]: finish: modules-config/config-apt-configure: SUCCESS: config-apt-configure ran successfully
Resulting /etc/apt/sources.list
# Generated by distrobuilder
deb http://deb.debian.org/debian bookworm main
deb http://deb.debian.org/debian bookworm-updates main
deb http://deb.debian.org/debian-security/ bookworm-security main
tomp
August 1, 2023, 8:06am
4
The images from images:
remote are not maintained by the LXD team.
You could open an issue here https://github.com/lxc/distrobuilder/issues if you think that cloud-init is not working for that image.
1 Like
OK, thanks Thomas. I’ll do that.