-
Notifications
You must be signed in to change notification settings - Fork 110
Fix race condition causing sshd start failure during provisioning #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ubuntu-jammy
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||
| [Unit] | ||||||||||||||||
| Description=Run first boot tasks | ||||||||||||||||
| ConditionPathExists=!/root/firstboot_done | ||||||||||||||||
| Before=ssh.service | ||||||||||||||||
|
|
||||||||||||||||
| [Service] | ||||||||||||||||
| Type=oneshot | ||||||||||||||||
| ExecStartPre=/bin/sh -c '/bin/rm -f /etc/ssh/ssh_host*key*' | ||||||||||||||||
| ExecStart=/usr/bin/ssh-keygen -A -v | ||||||||||||||||
| ExecStartPost=/usr/sbin/dpkg-reconfigure -fnoninteractive sysstat | ||||||||||||||||
| ExecStartPost=/usr/bin/touch /root/firstboot_done | ||||||||||||||||
| RemainAfterExit=yes | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+9
to
+13
|
||||||||||||||||
| ExecStart=/usr/bin/ssh-keygen -A -v | |
| ExecStartPost=/usr/sbin/dpkg-reconfigure -fnoninteractive sysstat | |
| ExecStartPost=/usr/bin/touch /root/firstboot_done | |
| RemainAfterExit=yes | |
| ExecStart=/bin/sh -c '/usr/bin/ssh-keygen -A -v && /usr/bin/touch /root/firstboot_done' | |
| ExecStartPost=/usr/sbin/dpkg-reconfigure -fnoninteractive sysstat | |
| RemainAfterExit=yes |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [Unit] | ||
| Wants=firstboot.service | ||
| After=firstboot.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding "Before=sshd-keygen.service" to ensure firstboot.service completes key regeneration before the system's default SSH key generation service (sshd-keygen.service) attempts to run. While both services likely check for existing keys, explicitly ordering them would prevent any potential race condition between the two key generation mechanisms.