I have my own ISO based on Ubuntu 22.04 that I generated myself. Here is my Autoinstall -
#cloud-config
autoinstall:
version: 1
identity:
hostname: foo-ubuntu
password: "ToReplace"
username: abcabc
source:
id: ubuntu-server-minimal
early-commands:
- cat /cdrom/casper/install-sources.yaml | awk 'NR>1 && /^-/{exit};1' > /run/my-sources.yaml
- mount -o ro,bind /run/my-sources.yaml /cdrom/casper/install-sources.yaml
late-commands:
- cp -r /cdrom/copy_to_iso/ /target/opt/
user-data:
runcmd:
- |
mkdir -vp /opt/INIT/
mv -v /opt/copy_to_iso/upgrade_or_install_packages/ /opt/
mv -v /opt/copy_to_iso/foo_installation/* /opt/INIT/
mv -v /opt/copy_to_iso/abc_scripts /opt/abc_scripts
rm -rvf /opt/copy_to_iso
bash -x /opt/abc_scripts/copy_system_files.sh
bash -x /opt/abc_scripts/setup_system_config.sh install_mode
During early-commands
and late-commands
, I have a local repository with all the needed packages under /cdrom/copy_to_iso/packages. During the user-data
section, the location is /opt/packages.
When I install the ISO on a server without an internet connection, the installation ends perfectly well, and all the necessary packages are installed. On the other hand, when I install the ISO on a server with internet connection, I see in the logs that it found a more up-to-date package externally in the internet, and it makes the section of installing the packages from /opt/packages fail.
I saw some related questions on the internet, but I wish to make all the sections in autoinstall work only with my local repository. Here is something that I tried -
how to disable unattended-upgrades during autoinstall (user-data, cloud-config)
Please look on "alternate option to use your local mirror". My problem is that I don't work with http in my local repository, but with "file".
I tried -
#cloud-config
autoinstall:
apt:
disable_components: [restricted,multiverse]
disable_suites: [backports,security]
primary:
- arches:
- default
uri: file:///cdrom/copy_to_iso/packages/
and also file:/cdrom/copy_to_iso/packages/
- nothing works, and it still installs packages from external repositories.
How should I write it in my case?