Add Ubuntu SSO user from the gadget snap

Hello, I am building an UC22 image and would like to add my own Ubuntu SSO user to the image.

By default, UC prompt a console configuration UI at boot, so we can enter our Ubuntu SSO email, but I would like to have this automated.

In my gadget snap I already disabled the console-conf. The system-user documentation mention how to add a system user, but it appears to be only supported from an external USB drive.

SInce my image is currently in the dangerous grade I tried to provide a cloud init config as mentioned in the Gadget snaps documentation. While I verified that my cloud.conf was properly placed in my Gadget snap it seems to have no effect on my image. I still cannot ssh using my username and my Ubuntu SSO private key.

For the snapcraft.yaml of my gadget I added:

  cloud-init:
    source: cloud-init
    plugin: nil
    override-build:
      install -m 644 cloud.conf "$CRAFT_PART_INSTALL"/cloud.conf

With the following cloud.conf content:

#cloud-config
datasource_list: [NoCloud]
users:
  - snapuser: MY_UBUNTU_SSO_EMAIL

And I try to ssh with:

ssh -i ~/.ssh/MY_PRIVATE_KEY UBUNTU_SSO_USERNAME@IP

What am I doing wrong here?

How can I debug an install I cannot log into?

Hi,

To debug it, you might be able to leave console-conf enabled. If you that invalidates the cloud-init snapuser config somehow, why not use the other supported method temporarily and create the auto-import.assert just to enable you to debug the install issue at least ?

Also, just to share another general option, you could distribute a system-user assertion and some automation in a snap with snapd-control or account-control interface access. But, you probably need a brand store for that, and you don’t say if you have one.

Cheers, Just