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 unit validation issue. #492

Open
martafolf opened this issue Sep 26, 2023 · 0 comments
Open

Systemd unit validation issue. #492

martafolf opened this issue Sep 26, 2023 · 0 comments

Comments

@martafolf
Copy link

martafolf commented Sep 26, 2023

Creating systemd objects like targets can cause confusing errors where enable is true but an install section is missing under --strict checking.

Take the following example butane:

variant: fcos
version: 1.5.0

systemd:
    units:
        - name: test.target
          enabled: true
          contents: |
              [Unit]
              Description=Test Target
              Requires=multi-user.taget
              After=multi-user.target
              AllowIsolate=yes
storage: 
    links:
        - target: /etc/systemd/system/test.target
          path: /etc/systemd/system/default.target
          overwrite: true

In this file we create a new test.target and then via the symlink from default.target we specify it as the system default target. (Would there be interest in ignition/butane handling this case natively? I.e. default: true for a target configuration)

Because of it becoming the default target, an [Install] section is not required as there are no WantedBy's to fulfill, or any other option to add for this to work.

In this configuration it seems the right setup to have it enabled, the symlink seems to yeld odd failures if the target is not enabled too at the ignition step, despite the unit file being placed in the same location, although I suspect that is a different issue and I am in the process of debugging that further.

That aside, the problem is evident when creating an ignition file with the --strict option passed:

# butane --strict < test.bu
warning at $.systemd.units.0.contents, line 8 col 21: unit "test.target" is enabled, but has no install section so enable does nothing
Config produced warnings and --strict was specified

It seems that by not containing a valid [Install] section the check fails, this makes sense for service files or other units, however for targets this is not necessarily a requirement.

Let me know if I've misunderstood this property, or if you need any further information from me, thank you. 😄

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

No branches or pull requests

1 participant