Local APT mirror configured on MAAS doesn't show on deployed machine

Hello there,

I create a local APT mirror for the main component of the recent Ubuntu LTS releases using Aptly and the following bash script:

~$ aptly mirror list
List of mirrors:
 * [netronome]: https://deb.netronome.com/apt/ stable
 * [ubuntu-bionic-main]: http://archive.ubuntu.com/ubuntu/ bionic
 * [ubuntu-focal-main]: http://archive.ubuntu.com/ubuntu/ focal
 * [ubuntu-jammy-main]: http://archive.ubuntu.com/ubuntu/ jammy
 * [ubuntu-noble-main]: http://archive.ubuntu.com/ubuntu/ noble
!#/bin/bash
distros=("bionic" "focal" "jammy" "noble")

for distro in ${distros[@]}; do
    echo "Refreshing for mirror ubuntu-$distro-main"
    aptly mirror update ubuntu-$distro-main
done

echo "Finished refreshing mirrors"

for distro in ${distros[@]}; do
    echo "Creating snapshot for mirror ubuntu-$distro-universe"
    aptly snapshot drop ubuntu-$distro-main
    aptly snapshot create ubuntu-$distro-main from mirror ubuntu-$distro-main
done

echo "Finished creating snapshots"

for distro in ${distros[@]}; do
    aptly publish drop $distro ubuntu
    echo "Publishing snapshot ubuntu-$distro-main"
    aptly publish snapshot ubuntu-$distro-main ubuntu
done

The mirror is hosted by Nginx. By manually configure the source.list, it works fine:

ubuntu@beast4:~$ sudo apt update
Get:1 http://{mirror_hostname}/ubuntu focal InRelease [3928 B]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 132 kB in 0s (363 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
~$ apt policy nano
nano:
  Installed: 4.8-1ubuntu1
  Candidate: 4.8-1ubuntu1
  Version table:
 *** 4.8-1ubuntu1 500
        500 http://{mirror_hostname}/ubuntu focal/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

But, on a freshly deployed machine, it doesn’t show in the /etc/apt/source.list, and its GPG key was not loaded as well.

~$ gpg --list-keys
gpg: directory '/home/ubuntu/.gnupg' created
gpg: keybox '/home/ubuntu/.gnupg/pubring.kbx' created
gpg: /home/ubuntu/.gnupg/trustdb.gpg: trustdb created

MAAS was configured as belows:

Maybe I should not list 4 distros together?

Any ideas? Or I misunderstand the expected behaviour of package repos feature?

Many thanks!

Sorry, my fault.
The customised APT sources will be installed under /etc/apt/sources.list.d/.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.