Skip to content
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

systemd/system/sshkeys: Make execution more robust #112

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

pothos
Copy link
Member

@pothos pothos commented Nov 17, 2023

The service failed when the unit to start was masked. Since it involves
networking, the service can fail and if it does we should restart. It
also seems that the service relied on
update-ssh-keys-after-ignition.service to run update-ssh-keys once to
create the subfolder and could possibly race with it.

Prevent execution when it has no chance to succeed because the unit to
start is masked but in all other cases try to restart on failure. Also
order behind update-ssh-keys-after-ignition.service.

How to use

Backport

Testing done

with

variant: flatcar
version: 1.0.0
systemd:
  units:
    - name: sshkeys.service
      dropins:
        - name: test.conf
          contents: |
            [Unit]
            After=update-ssh-keys-after-ignition.service
            ConditionPathIsSymbolicLink=!/etc/systemd/system/[email protected]
            [Service]
            Restart=on-failure

and verifying that the service does not run when the unit to start is masked.
@tormath1 also checked that the spurious failure experienced when update-ssh-keys-after-ignition.service is slower than sshkeys.service didn't occur again.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

The service failed when the unit to start was masked. Since it involves
networking, the service can fail and if it does we should restart. It
also seems that the service relied on
update-ssh-keys-after-ignition.service to run update-ssh-keys once to
create the subfolder and could possibly race with it.

Prevent execution when it has no chance to succeed because the unit to
start is masked but in all other cases try to restart on failure. Also
order behind update-ssh-keys-after-ignition.service.
@pothos pothos merged commit db7a12e into flatcar-master Nov 17, 2023
@pothos pothos deleted the kai/sshkeys branch November 17, 2023 14:41
pothos added a commit to flatcar/scripts that referenced this pull request Nov 17, 2023
This pulls in
flatcar/init#112
to only run [email protected] when not masked and
also retry on failure.
pothos added a commit to flatcar/scripts that referenced this pull request Nov 17, 2023
This pulls in
flatcar/init#112
to only run [email protected] when not masked and
also retry on failure.
pothos added a commit to flatcar/scripts that referenced this pull request Nov 17, 2023
This pulls in
flatcar/init#112
to only run [email protected] when not masked and
also retry on failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants