Error while creating a custom ubuntu 18.04 image

I am trying to build an image of ubuntu 18.04 using snapcraft.These are the steps I carried out.

  1. Created a JSON assertion file zl-3x-image-ubuntu1804.json
    { “type”: “model”, “series”: “16”, “authority-id”: “my developer ID”, “brand-id”: “my developer ID”, “model”: “zl-3x-image-ubuntu1804”, “architecture”: “amd64”, “timestamp”: “2022-01-29T11:18:43+00:00”, “base”: “core18”, “grade”: “signed”, “storage-safety”: “prefer-encrypted”, “snaps”: [ { “name”: “pc”, “type”: “gadget”, “default-channel”: “18/stable”, “id”: “UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH” }, { “name”: “pc-kernel”, “type”: “kernel”, “default-channel”: “18/stable”, “id”: “pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza” }, { “name”: “core18”, “type”: “base”, “default-channel”: “latest/stable”, “id”: “DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q” }, { “name”: “snapd”, “type”: “snapd”, “default-channel”: “latest/stable”, “id”: “PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4” } ] }

2.I generated a zl-3x-image-ubuntu1804.model using the following commands cat zl-3x-image-ubuntu1804.json | snap sign -k default > zl-3x-image-ubuntu1804.model

3.My model contains the following type: model authority-id: my developer ID series: 16 brand-id: my developer ID model: zl-3x-image-ubuntu1804 architecture: amd64 base: core18 grade: signed snaps: - default-channel: 18/stable id: UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH name: pc type: gadget - default-channel: 18/stable id: pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza name: pc-kernel type: kernel - default-channel: latest/stable id: DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q name: core18 type: base - default-channel: latest/stable id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4 name: snapd type: snapd storage-safety: prefer-encrypted timestamp: 2022-01-29T11:18:43+00:00 sign-key-sha3-384: -4YCmkxrzL84A5zto9b1AoMzfwqOX1ZrxX7i5wnZ9XQAO0X-QUEFF_C9mHS4-mP0

316fvguUmF0GQfVbWzP5D3ApONgwmEXBwV4Frni8+7Amqe35w1D0wfd7nlY8X8v5vAdgJ1r43gMe
316fvguUmF0GQfVbWzP5D3ApONgwmEXBwV4Frni8+7Amqe35w1D0wfd7nlY8X8v5vAdgJ1r43gMe
316fvguUmF0GQfVbWzP5D3ApONgwmEXBwV4Frni8+7Amqe35w1D0wfd7nlY8X8v5vAdgJ1r43gMe

4.I built a image by the following commands ubuntu-image snap zl-3x-image-ubuntu1804.model I get the following errors
WARNING: proceeding to download snaps ignoring validations, this default will change in the future. For now use – validation=enforce for validations to be taken into account, pass instead --validation=ignore to preserve current behavior going forward Fetching snapd Fetching pc-kernel Fetching core18 Fetching pc error: model requires system-seed partition, but no system-seed or system-data partition found COMMAND FAILED: snap prepare-image zl-3x-image-ubuntu1804.model /tmp/tmpty9gn2tk/unpack

What did I do wrong? How can I resolve it

Creates an Ubuntu Core image, which isn’t the same as a classic Ubuntu 18.04 (or other version).

You are using a UC20 model which implies certain properties of kernel and gadget snaps. You need either a UC18 model + UC18 compatible kernel & gadget snaps, or UC20 model and similarly UC20 compatible gadget & kernel snaps. The guide at https://ubuntu.com/core/docs/image-building describes how to build a UC20 system. UC18 reference models can be found here: https://github.com/snapcore/models also the appliances directory includes some examples of different setups. The generic snaps such as pc-kernel or pc from track 18 are compatible with UC18.

Edit: also please consider using UC20 rather than UC18 for new devices. Unless you have a very specific need to use UC18, if so it’d be great if you could describe your motivation.

1 Like

I don’t find the image assertion for core-18 in the GitHub repo that you mentioned.

An example UC18 assertion for Pi https://github.com/snapcore/models/blob/master/ubuntu-core-18-pi-arm64.json for amd64 you probably want to set:

"architecture": "amd64",
"gadget": "pc=18",
"kernel": "pc-kernel=18",

and update the model and display-name fields obviously.

1 Like

Thank you managed to build successfully

I’m trying to build my own image, which includes my custom kernel compile snap. I was able to build the kernel snap, following:

I built it using core18, based on UC18 due to:

“This plugin is only available to core and core18 based snaps”.

Now I’m trying to build a core18 image that includes my kernel snap. I hit the “model requires system-seed partition” error, found this post, and successfully built an image with your solution above. Then I tried to change the grade to dangerous (so it allows me to include my kernel snap) and it fails with “cannot specify a grade for model without the extended snaps header”.

I added the extended snaps header, then it failed with “cannot specify separate ‘gadget’ header once using the extended snaps header”.

When I remove the “gadget”: “pi=18-pi3” line from my model.json, it goes back to “error: model requires system-seed partition, but no system-seed or system-data partition found”.

Can someone please point me to instructions to create a UC18 system-seed partition? I think that’s what I have to do, I just don’t know where to look for this.

Of course any alternative is also welcome.