Commit 24ca662
committed
Fix race condition causing sshd start failure during provisioning
* Run first-boot tasks via systemd so sshd never races with host-key
regeneration. The old `rc.local` script ran after network.target, but
in parallel with other regular system services, like ssh.service.
Therefore, ssh.service often started (and restarted) while
`/root/firstboot.sh` was deleting keys. cloud-init’s set-passwords
module made this worse by restarting ssh mid-run.
* Replace `rc.local` with a oneshot firstboot.service (delete keys,
create new keys, reconfigure sysstat) that runs Before=ssh.service
and leaves the `/root/firstboot_done` file as a marker.
* Add a cloud-config.service drop-in so cloud-init's config stage waits
for firstboot.service, and
* Update walinuxagent.service to wait for firstboot.service, ensuring
ssh keys have been regenerated. This guarantees sshd, cloud-init, and
WALinuxAgent all start only after the first-boot tasks succeed.1 parent 4ccb5ce commit 24ca662
File tree
7 files changed
+30
-24
lines changed- stemcell_builder/stages
- base_ubuntu_firstboot
- assets
- etc
- systemd/system
- root
- system_azure_init
- assets/etc
- systemd/system/cloud-config.service.d
- waagent
7 files changed
+30
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 0 additions & 6 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
0 commit comments