Is it possible to launch official ubuntu images using incus?

I have added official ubuntu image url to incus remote list .

ubuntu (current) | Ubuntu Cloud Images | simplestreams | none | YES | NO | NO

Trying to launch ubuntu image using incus command

incus launch ubuntu:22.04 ubuntu-jammy
Error: The remote isn’t a private server

I am able to launch ubuntu images using images: , is it possible to launch images using ubuntu: using incus?

incus remote list

±-----------------±-----------------------------------------±--------------±------------±-------±-------±-------+
| NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | GLOBAL |
±-----------------±-----------------------------------------±--------------±------------±-------±-------±-------+
| images | https://images.linuxcontainers.org | simplestreams | none | YES | NO | NO |
±-----------------±-----------------------------------------±--------------±------------±-------±-------±-------+
| local | unix:// | incus | file access | NO | YES | NO |
±-----------------±-----------------------------------------±--------------±------------±-------±-------±-------+
| ubuntu (current) | https://cloud-images.ubuntu.com/releases| simplestreams | none | YES | NO | NO |
±-----------------±-----------------------------------------±--------------±------------±-------±-------±-------+

Please suggest on this?

You shouldn’t incus remote switch to an image server as otherwise it will try to create the instance on the image server, failing with the error you’re getting.

So run incus remote switch local to be back to your local system.

That said, I expect incus image list ubuntu: to be empty as the Ubuntu image servers don’t publish images with the Incus metadata.

You can manually go to Ubuntu 22.04 LTS (Jammy Jellyfish) release [20240319], then download ubuntu-22.04-server-cloudimg-amd64.squashfs and ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz and then manually import those locally with:

incus image import --alias ubuntu-2204 ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz ubuntu-22.04-server-cloudimg-amd64.squashfs

After which you can do:

incus launch ubuntu2204 ubuntu-jammy

There are a few places I noticed where this could be tidied up.

  1. In the incus documentation, it says

    All images from the ubuntu and ubuntu-daily image servers have cloud-init support

    But that doesn’t help if you can’t use those image servers with incus - and the link to “image servers” doesn’t mention them.

  2. Here it says:

    The incus CLI command is pre-configured with several remote image servers.

    However there’s only one: images. (There’s local as well, but that isn’t remote).

  3. When bootstrapping incus, it tells you to try “incus launch images:blah”. However in git, it looks like some of the translations are out of date. For example:

./po/fr.po:"Pour démarrer votre premier conteneur, essayer : lxc launch ubuntu:16.04"
./po/fr.po:#~ "To start your first container, try: lxc launch ubuntu:20.04\n"
./po/fr.po:#~ "Or for a virtual machine: lxc launch ubuntu:20.04 --vm"
./po/fr.po:#~ "Pour démarrer votre premier conteneur, essayer : lxc launch ubuntu:16.04"
./po/fr.po:#~ msgid "To start your first instance, try: lxc launch ubuntu:20.04"
./po/fr.po:#~ "Pour démarrer votre premier conteneur, essayer : lxc launch ubuntu:16.04"
./po/fr.po:#~ "    lxc init ubuntu:16.04 u1"
./po/fr.po:#~ "    lxc init ubuntu:16.04 u1"
./po/fr.po:#~ "    lxc launch ubuntu:16.04 u1"
./po/fr.po:#~ "    lxc launch ubuntu:16.04 u1"
./po/fr.po:#~ msgid "To start your first instance, try: lxc launch ubuntu:18.04"
./po/fr.po:#~ "Pour démarrer votre premier conteneur, essayer : lxc launch ubuntu:16.04"

The translation file doesn’t matter as those are former translated strings and not currently visible messages.

Sorry about point 1. I noticed that recently too but I did not push a fix.

Hmm, how is one supposed to know or find out that 2 mentioned downloads (.squashfs and .tar.xz) are a replacement for ‘ubuntu:22.04’ launch command arg ?

Hi!

The ubuntu:22.04 string means the Ubuntu container images for Ubuntu 22.04.
Therefore, the URL from Ubuntu Cloud Images is actually the following (22.04/release/).

https://cloud-images.ubuntu.com/releases/22.04/release/

Then,

  1. you get the metadata file with the extension .lxd.tar.gz (it’s architecture-specific).
  2. you get the runtime/rootfs file. It’s any of the files with extensions .squashfs, -root.tar.xz, .img or .tar.gz.

Let’s see!

$ incus image import --alias test1 ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz ubuntu-22.04-server-cloudimg-amd64-root.tar.xz
$ incus image import --alias test2 ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz ubuntu-22.04-server-cloudimg-amd64.squashfs
$ incus image import --alias test3 ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz ubuntu-22.04-server-cloudimg-amd64.img
$ incus image import --alias test4 ubuntu-22.04-server-cloudimg-amd64-lxd.tar.xz ubuntu-22.04-server-cloudimg-amd64.tar.gz

Then, let’s get Incus to show the details. There’s a difference in size. Also, that .img is a VM image, not a container image.

$ incus image list -c lfdast test
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
| ALIAS | FINGERPRINT  |            DESCRIPTION             | ARCHITECTURE |   SIZE    |      TYPE       |
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
| test1 | 684d268f375f | Ubuntu 22.04 LTS server (20241002) | x86_64       | 372.27MiB | CONTAINER       |
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
| test2 | 7ff91d595eaf | Ubuntu 22.04 LTS server (20241002) | x86_64       | 414.68MiB | CONTAINER       |
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
| test3 | 09fe1f5c8f5f | Ubuntu 22.04 LTS server (20241002) | x86_64       | 623.39MiB | VIRTUAL-MACHINE |
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
| test4 | 706cd53e2d47 | Ubuntu 22.04 LTS server (20241002) | x86_64       | 567.70MiB | CONTAINER       |
+-------+--------------+------------------------------------+--------------+-----------+-----------------+
$ 
1 Like

Note that we’ve been engaging with the Canonical Cloud images team recently and hope to have the needed Incus metadata online on their image server soon.

2 Likes

Hi Simos, thx a lot for your quick response and clarification! Actually what I’m trying to achieve is to add another description to my hobbyist project https://homekube.org that covers a setup using Incus. Interesting coincidence - you wrote a blog post about it years ago how to do using LXD containers: https://blog.simos.info/how-to-make-your-lxd-container-get-ip-addresses-from-your-lan/
:smiley: Now I’m trying to do the same with Incus but so far I’m struggling with the preparation steps :thinking:

Thanks for the kind words!

The Ubuntu images from the Incus repositories are much leaner, as if you are installing images from Ubuntu Minimal, then add packages on demand. Saves disk space and RAM on your baremetal servers. You can use the images:ubuntu/24.04/cloud images (with cloud-init) in order to add extra configuration like auto-installing necessary packages upon launching the containers.

I am trying to replace those old network guides with newer ones for Incus. There are some quality of life improvements since then, that makes it necessary to rewrite the old documents. The top document is already done, A networking guide for Incus – Mi blog lah!

1 Like