Ah, I see, though it doesn't make sense. If cloud-init does the job the installer did not finish his work in my opinion. Either the system is ready or not.
Since you consider the system as installed at the last stage, late-commands, there is probably nothing I can do about it. But could you give me a hint into the right direction then? I read about commands to be executed as first boot but for my life I cannot find it. Is it bootcmd or runcmd but those are not in the user-data section? Or is the term user-data used here for two different things?
EDIT: Alright, I tried the runcmd solution with a simple test command
So, even using the recommended command it won't work since even as root trying to run the command as the user (I guess runcmd is being run as root) there is a permission issue. Probably due to the problem in my opening post about the directory not owned by the user at the time I guess.
EDIT2: Alright. I made a workaround since it simply doesn't work no matter what I tried
I also defined two users, where the first user in the list (*alphabetical ordered by cloud-init) has wrong rights, namely `root:root` set for his home directory and therefore cannot login... Did I do something wrong or should I report a bug for cloud-init?
EDIT3: I leave this in here for others to see. I got the permission issue resolved. This seems to be because during the late-commands I run a custom script which downloads files into the users directory. This causes the directory to be owned by root: for whatever reason. I am looking for another way to provide the files since I need to have them ready in case the machine is started netless on first boot.
Ah, I see, though it doesn't make sense. If cloud-init does the job the installer did not finish his work in my opinion. Either the system is ready or not.
Since you consider the system as installed at the last stage, late-commands, there is probably nothing I can do about it. But could you give me a hint into the right direction then? I read about commands to be executed as first boot but for my life I cannot find it. Is it bootcmd or runcmd but those are not in the user-data section? Or is the term user-data used here for two different things?
EDIT: Alright, I tried the runcmd solution with a simple test command
``` USER/.ssh/ id_rsa -N ''"
autoinstall:
user-data:
runcmd:
- su $USER -c "ssh-keygen -t rsa -q -f /home/$
```
Result: Saving key "/home/ USERNAME/ .ssh/id_ rsa" failed: Permission denied".
So, even using the recommended command it won't work since even as root trying to run the command as the user (I guess runcmd is being run as root) there is a permission issue. Probably due to the problem in my opening post about the directory not owned by the user at the time I guess.
EDIT2: Alright. I made a workaround since it simply doesn't work no matter what I tried
``` d/script. sh
permissions: root d/script. sh
autoinstall:
user-data:
write_files:
- path: /run/tmpfiles.
owner: root
content: |
my content
runcmd:
- /bin7bash /run/tmpfiles.
```
I also defined two users, where the first user in the list (*alphabetical ordered by cloud-init) has wrong rights, namely `root:root` set for his home directory and therefore cannot login... Did I do something wrong or should I report a bug for cloud-init?
```
lock-passwd: false
lock-passwd: false
autoinstall:
user-data:
users:
- name: userone
shell: /bin/bash
passwd: hash
groups: [one, two, three]
- name: usertwo
shell: /bin/bash
passwd: hash
groups: [one, two, three]
```
EDIT3: I leave this in here for others to see. I got the permission issue resolved. This seems to be because during the late-commands I run a custom script which downloads files into the users directory. This causes the directory to be owned by root: for whatever reason. I am looking for another way to provide the files since I need to have them ready in case the machine is started netless on first boot.