I am installing Ubuntu 20.04 server via UEFI HTTP booting, subiquity and a NoCloud data source. The actual install works and I get the base OS running.

I also need to configure some things after installation is complete, or on first boot after the installer has rebooted however.

I have tried various things in user-data:

    - path: /target/etc/example.conf
      permissions: 644
      content: |
        example content
    - path: /target/var/lib/cloud/scripts/per-once/test.sh
      permissions: 755
      content: |
        date > /tmp/i_ran
        echo test1
    - echo test2 > /tmp/test2
    - cloud-init-per once testing echo test3
    - [ cloud-init-per, once, testing2, touch, /tmp/test4 ]
    - [ curtin, in-target, --target=/target, --, cloud-init-per, once, testing3, touch, /tmp/testing5 ]
    - echo test5 > /target/etc/test5.conf
    - curtin in-target --target=/target -- cloud-init-per once testing9 touch /tmp/testing9

The commands run (as seen in the subiquity debug log) but nothing seems to leave a mark on the installed system. e.g. no files in /tmp or /etc and no messages in the post reboot logs that I have found. I have tried write_files with, and without /target before it.

What is the intended method to write arbitrary files on the target or run arbitrary commands after install?

1 Answer 1


I'm not sure if this is the official method but what is now working to write a file to the target system is:

    - echo test5 > /target/etc/test5.conf

I had tried that before and it didn't work but I can only assume there was some other error I missed that caused it to fail on that test.

Using curtin in-target --target=/target -- cmd as part of late-commands works for running commands.

I haven't managed to get any of the other methods (e.g. cloud-init-per, write_files) to work. This solves my immediate need however.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .