My apologies for the incoming wall of text but I'm hoping to find a solution to a strange problem that "might" be a bug. I'm in the process of creating an offline (air-gapped) automated install of Ubuntu 24.04.1 LTS using a combination of PXE booting the ISO and pointing it to a user-data file that contains my autoinstall and user-data configuration for a fully automated bare-metal installation.
Anyone familiar with this process knows that its a multi-phase install process, with phase 1 being the base install processing anything in the "autoinstall:", formatting disks and copying files from the ISO to the disk, etc... and phase 2 basically processing anything defined in the "user-data:" section of your user-data file. Additionally, it is possible to configure packages to be installed during the phase 1 install phase (for example openssh-server). That said, as noted on the AutoInstall reference page (https://canonical-subiquity.readthedocs-hosted.com/en/latest/reference/autoinstall-reference.html#ssh):
Note that Desktop installation ISOs do not include openssh-server, so installations of Desktop require Ubuntu archive access for install-server to be successful.
So if I understand correctly, all this means is that in order to install openssh-server, or any package not contained on the ISO the installer needs to be able to reach an Ubuntu noble archive to be able to download and install the package.
Now as mentioned, I'm trying to perform the automated install in an air-gapped network. I have mirrored the Ubuntu noble repositories from the internet and made them available in the air-gap network. I have also validated that it works by performing a manual install of Ubuntu 24.04.1 LTS and updating the /etc/apt/sources.list.d/ubuntu.sources file to point to the air-gapped mirror and successfully performing an apt update/upgrade and installing openssh-server (and ansible).
So the issue I need to overcome is to somehow configure the Phase 1 (autoinstall:) portion to use my local mirror as a source for package installation.
This process on how to do this is documented here:
https://canonical-subiquity.readthedocs-hosted.com/en/latest/reference/autoinstall-reference.html#apt https://curtin.readthedocs.io/en/latest/topics/apt_source.html
However, after several hours of trying various combinations of trying to configure the "apt:" section in my user-data file what I'm observing is that anything put into the "apt:" section seems to only be applied to the /target/etc/apt/ configurations, not the live session. The apt cache seems to only hold the packages that are available on the ISO. Because of this, specifying additional "packages:" to be installed causes the autoinstall to fail.
Here are the various configurations I've tried:
Using the deb format:
#cloud-config
autoinstall:
apt:
preserve_sources_list: false
mirror-selection:
primary:
- uri: "http://mirror.local.net/ubuntu"
arches: [default]
fallback: offline-install
geoip: false
Using the deb822 format:
#cloud-config
autoinstall:
apt:
sources:
local.sources:
source: |
Types: deb
URIs: http://mirror.local.net/ubuntu
Suites: $RELEASE $RELEASE-updates $RELEASE-backports $RELEASE-security $RELEASE-proposed
Components: main restricted universe multiverse
Signed-by: /usr/share/keyrings/ubuntu-archive-keyring.gpg
preserve_sources_list: false
fallback: offline-install
geoip: false
In my testing, it "appears" that when I specify the deb formatted "apt:", there's no indication in the installer console that it even tries to contact the mirror at any point to either update the cache (apt update) or to install the package. When I specify the deb822 formatted "apt:", one of the first things the installer appears to do is validate it can contact mirror.local.net, as well as archive.ubuntu.com and security.ubuntu.com.
So my thoughts were that using the deb822 formatted "apt:" would seem to be the right thing to do however, later in the install when it goes to install any defined packages I can clearly see in the logs:
Sep 05 10:30:00 ubuntu subiquity_log.4233[15323]: Get1 file:/cdrom nobel InRelease
Sep 05 10:30:00 ubuntu subiquity_log.4233[15323]: Ign1 file:/cdrom nobel InRelease
Sep 05 10:30:00 ubuntu subiquity_log.4233[15323]: Get2 file:/cdrom nobel Release [1072 B]
Sep 05 10:30:00 ubuntu subiquity_log.4233[15323]: Get2 file:/cdrom nobel Release [1072 B]
Sep 05 10:30:00 ubuntu subiquity_log.4233[15323]: Reading package lists...
...
Sep 05 10:30:00 ubuntu subiquity_log.4233[15312]: Running command ['unshare', '--fork', '--pid', '--mount-proc=/target/proc', '--', 'chroot', '/target', 'apt-get', '--quiet', '--assume-yes', '--option=Dpkg::options::=--force-unsafe-io', '--option=Dpkg::Options::=-force-confold', 'install', '--download-only', 'openssh-server'] with allowed return codes [0] (capture=False)
Sep 05 10:30:00 ubuntu subiquity_log.4233[15432]: Reading package lists...
Sep 05 10:30:00 ubuntu subiquity_log.4233[15432]: Building dependency tree...
Sep 05 10:30:00 ubuntu subiquity_log.4233[15432]: Reading state information...
Sep 05 10:30:00 ubuntu subiquity_log.4233[15432]: E: Unable to locate package openssh-server
When the installer crash's while still in the Live session, if I pop into the terminal and check the following, there are no references to "mirror.local.net" in any of the following files:
/etc/apt/sources.list
/etc/apt/sources.list.d/ubuntu.sources
/target/etc/apt/sources.list
/target/etc/apt/sources.list~
/target/etc/apt/sources.list.d/ubuntu.sources.curtin.orig
The only reference I can find to what I specified in the "apt:" section can only be found in /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url.cfg file which appears to be a copy of the user-data file.
The other observation I've made is that if I move all of the extra software installation into Phase 2 of the install (1st boot after base install) where the user-data section "stuff" gets processed, the local.sources file does exist in the /etc/apt/sources.list.d directory and if I perform a runcmd: apt install openssh-server -y
then the packages install fine.
My question is has anyone else observed this issue or does anyone else have a working airgapped/offline Ubuntu 24.04.1 LTS installation and can verify that they can install openssh-server from an internal Ubuntu repository mirror?
I fully admit that I might be running into a bug with the new installer but I wanted to rule out me being an idiot first. If anyone has an example of a working "apt:" section for specifying a local mirror I'd truly appreciate some guidance.
Thanks for reading and any feedback!
TLDR; "apt:" configurations in autoinstall for Ubuntu 24.04.1 LTS seems to be ignored during the initial install phase.