Import system-user in Ubuntu Core 22 Raspberry Pi

Hello.

I’ve created an Ubuntu Core 22 image with console-conf disabled so I can add a system-user.

I’ve followed the steps described here and I already have the auto-import.assert file.

Both pi.model & auto-import.assert are signed with the same key.

When I plug an USB drive with auto-import.assert in the root path nothing happens and the image is unusable.

What am I doing wrong?

1 Like

Hi ed10vi,

While I have not attempted using an auto-import.assert via USB, I have however had luck placing it directly into the built Ubuntu Core image by mounting it as a loop device:

  1. Find the next available loop device on your system with losetup -f
  2. Mount your core .img file to the available loop device with sudo losetup /dev/loopXX /path/to/your.img
  3. Make a directory to mount your loopdev and mount it sudo mkdir /mnt/core && sudo mount /dev/loopXX /mnt/core
  4. Copy over your auto-import.assert file into your mounted image: sudo cp auto-import.assert /mnt/core
  5. May not be needed but I always run sudo sync for good measure to ensure the kernel writes to the loop device.
  6. Unmount your image, and release the loopdev: sudo umount /mnt/core, sudo losetup -D /dev/loopXX

When you next boot your image, your custom user credentials should be present on the system.

As for the USB itself, as far as I know, it needs to be FAT32 formatted and the file needs to be in the root of the stick itself. I also believe the model defined in the assertion needs to match up with the model that built the image. It sounds like you have made sure the keys are all the same which is good.

I hope this helps!

1 Like

It’s working. the problem was the image wasn’t seeding correctly

1 Like

Fantastic, glad you sorted it out!

Two things I forgot to mention in my initial reply, but will put here for anyone in future trying this out:

You’ll need to run partprobe over the loop-mounted .img to expose the ubuntu-seed partition (usually /dev/loopXXp2) and mount that to your /mnt/xxx directory.

I might be wrong, but dropping a system-user.assert as an auto-import.assert on the ubuntu-seed partition of an image might only be supported if the model assertion is graded as dangerous, however I may be completely wrong.