I have setup an auto-install (Ubuntu 20.04 live server) with a user-data file.

My goal is to run a script after the installation is completed. So after the last reboot and the steps that happens there (like snap package installations).

The latest step I can find is the "late-commands" but that runs too early. The installation is not complete.

The script should be started right after "Execute cloud user/final scripts" has ended.

I tried doing a work-around with systemctl but I can't really make it run at the right time in the process.

Any ideas?


There is a user-data config key for the autoinstall file you might be able to use for this.

During the first boot of the installed system, cloud-init will use user-data config file to perform some of the install tasks. Notably, this is how the first user is created.

  version: 1
    - content: |
      path: /cloud_init_flag

See this answer for more details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.