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

/run is not ephemeral on *BSD #4180

Closed
igalic opened this issue Jun 12, 2023 · 4 comments
Closed

/run is not ephemeral on *BSD #4180

igalic opened this issue Jun 12, 2023 · 4 comments
Labels
bug Something isn't working correctly

Comments

@igalic
Copy link
Collaborator

igalic commented Jun 12, 2023

Bug report

cloud-init sets up a Paths.run_dir which on Linux is the ephemeral /run directory.
On BSD, the corresponding directory would be /var/run, but we don't change that path. /run is non-standard. (See hier(7))

That means that cloud-init potentially behaves very differently on BSD

Steps to reproduce the problem

  1. boot a cloud-init enabled BSD system.
  2. disable cloud-init.
  3. /run/cloud-init still exists

Environment details

  • Cloud-init version: all
  • Operating System Distribution: *BSD
  • Cloud provider, platform or installer type: all
@igalic igalic added bug Something isn't working correctly new An issue that still needs triage labels Jun 12, 2023
@blackboxsw
Copy link
Collaborator

Cloud-init will still write each file on reboot for BSD like other distributions.

But, if cloud-init is disabled via /etc/cloud/cloud-init.disabled (or by kernel commandline) or can no longer detect any datasource, it's likely *BSD will have stale files around in /run/cloud-init across reboot that Linux distributions would have magically cleared.

@aciba90
Copy link
Contributor

aciba90 commented Jun 15, 2023

[1] At least on Ubuntu systems, /var/run is a symlink of /run.

What about changing /run/cloud-init to /var/run/cloud-init? In that way, cloud-init would satisfy the ephemeral behavior on Linux and *BSD, assuming [1] holds for every Linux distro we support.

@loth
Copy link

loth commented Jul 27, 2023

This would fix #4231 if implemented

@igalic
Copy link
Collaborator Author

igalic commented Jul 27, 2023

can you try by replacing /run with a link to /var/run ? that one should be ephemeral, in that it's cleared before cloudinitlocal

igalic added a commit to igalic/cloud-init that referenced this issue Dec 8, 2023
On *BSD, `/run` is not ephemeral, but the way cloud-init behaves, it
expects it to be.
This is hack is partial fix for canonicalGH-4180 / canonicalGH-4231.
But to be good Unix citizens, we should still make /run relocatable in
the code and in the installer.

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Dec 8, 2023
On *BSD, `/run` is not ephemeral, but the way cloud-init behaves, it
expects it to be.
This is hack is partial fix for canonicalGH-4180 / canonicalGH-4231.
But to be good Unix citizens, we should still make /run relocatable in
the code and in the installer.

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Dec 14, 2023
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Dec 15, 2023
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
Co-authored-by: Brett Holman <brett.holman@canonical.com>
igalic added a commit to igalic/cloud-init that referenced this issue Dec 19, 2023
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
Co-authored-by: Brett Holman <brett.holman@canonical.com>
igalic added a commit to igalic/cloud-init that referenced this issue Jan 4, 2024
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Jan 4, 2024
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Jan 4, 2024
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
igalic added a commit to igalic/cloud-init that referenced this issue Jan 4, 2024
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes canonicalGH-4180
Fixes canonicalGH-4231
@holmanb holmanb closed this as completed in 8937b5e Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants