How to download specific Ubuntu versions (e.g. 22.04.1)

Hello all,
I’m wondering if there is a way to point to a very specific version of Ubuntu (e.g. 22.04.1 vs. 22.04.2) when downloading images. If not, is there at least a way to query or figure out which specific minor version a downloaded image is on?

Hi @mkgilbert and welcome to MAAS community.

There is no way to point to a very specific version and MAAS always tries to sync latest versions to be available for deployment.

However if your main goal is to have more control over deployed versions (e.g. to have reproducible deployments) and you don’t want to automagically deploy 22.04.03 once it is available in the upstream and synced by MAAS, I think that there are still couple options available.

  1. Use your own SimpleStreams as a custom mirror.
  2. Build custom Ubuntu image from desired version.

@troyanov, thank you for the warm welcome and helpful answer!
For using SimpleStreams, I get the impression from the documentation you linked to that it just mirrorrs what is currently on maas.io. Do you know if SimpleStreams provides a way for me to be more picky about which version I’m downloading?

@mkgilbert yes, SimpleStreams will mirror data from images.maas.io but it is possible to control what you sync (also it will sync only when you ask it to sync)

From MAAS doc:

To know in advance what the sstream-mirror command will grab, or if you want to save bandwidth and time by avoiding bad selections, include the --dry-run option. When you are satisfied, remove that option to initiate the download.

I think the only way to check how filtering works is going through the codebase: https://git.launchpad.net/simplestreams/

It seems to be possible to use Hooks as well.

= Hooks =
To use the “command hooks mirror” for invoking commands to synchronize, between
one source and another, see bin/sstream-sync.

So my idea is to try something like this:

  1. Setup a mirror that will sync with some filtering rules (or with some hook)
  2. Then for every version (20230325, 20221211, 20230324, etc) donwload the squashfs
    e.g. https://images.maas.io/ephemeral-v3/stable/jammy/amd64/20221002/squashfs
  3. unsquashfs -f -d /tmp/foo squashfs and cat /tmp/foo/etc/lsb-release
  4. Remove unwanted versions from streams/v1/com.ubuntu.maas:stable:v3:download.json

Thats the only hack I can think of…


For the reference:
https://images.maas.io/ephemeral-v3/stable/jammy/amd64/20221002 is 22.04.1 LTS
https://images.maas.io/ephemeral-v3/stable/jammy/amd64/20230328 is 22.04.2 LTS

❯ unsquashfs -f -d /tmp/foo squashfs
❯ cat etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
2 Likes

Did a quick check (please note, I am skipping actual image download here on purpose, as well as skipping GPG signature verification):

./bin/sstream-mirror\
  --mirror=https://images.maas.io/ephemeral-v3/stable/\
  --no-verify\
  --no-item-download\
  com.ubuntu.maas\
  foo-mirror

Will produce the following:

❯ ll foo-mirror/streams/v1/
com.ubuntu.maas:stable:1:bootloader-download.sjson
com.ubuntu.maas:stable:centos-bases-download.sjson
com.ubuntu.maas:stable:v3:download.sjson
index.sjson

Downloaded com.ubuntu.maas:stable:v3:download.sjson is exact copy of https://images.maas.io/ephemeral-v3/stable/streams/v1/com.ubuntu.maas:stable:v3:download.json.

I think modifying the file by removing unwanted versions will do the trick

2 Likes

@troyanov, wow! You’re answers were so in depth and extremely helpful…I’m very grateful :grinning_face_with_smiling_eyes:

Something like that hack was exactly what I was looking for.

1 Like

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