Skip to content

Conversation

lodener
Copy link
Contributor

@lodener lodener commented Sep 4, 2025

Description

Small addition to PR #216, verifying the init system to be systemd before using systemctl.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing performed?

  • Unit tests
  • Integration tests
  • Acceptance tests

Checklist:

  • This PR is being made against the main branch, or relevant version branch
  • I have made corresponding changes to the documentation
  • I have added testing for my changes

If you have any questions, or want to get attention for a PR or issue please reach out on the #logging-and-metrics channel in the cloudfoundry slack

Copy link

@chombium chombium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lodener! Thanks for the PR! It's a nice optimization, but I'm not sure if we have jq added in the stemcell and I have to check that.

@ramonskie, @rkoster Can you please help and and tell us if we have jq added in the the stemcells? FWIW I've searched for it in the stemcell builder repo, but I didn't find anything except in dpkg-list-ubuntu-google-additions.txt.

@lodener
Copy link
Contributor Author

lodener commented Sep 4, 2025

Thanks @chombium. After some pointers from @ramonskie on slack, the parsing of the BOSH agent.json file was added to check for the presence of systemd if jq is available.

It checks if jq is available through the command -v jq call, and falls back to the value in /proc/1/comm if it isn't available.

When looking at the stemcells I had on hand, jammy and noble both had the jq binary available, whereas bionic did not. All of them had systemd as their pid 1 command name though (tini in bpm containers), and the service script appeared to wrap the systemctl binary, so to me it appears safe.

But perhaps always assuming a non-systemd init system is safer, and the /proc/1/comm check could just be replaced with something like a simple init string, making it default to service rsyslog restart even if /proc/1/comm shows systemd?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants