-
Notifications
You must be signed in to change notification settings - Fork 912
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
cleanup(scripts): cleanup systemd unit in DEB + RPM packages #2138
cleanup(scripts): cleanup systemd unit in DEB + RPM packages #2138
Conversation
Welcome @happy-dude! It looks like this is your first PR to falcosecurity/falco 🎉 |
Hey team, submitting my first PR to Falco. I didn't file an issue tied to this PR primarily since I discovered this while trying to incorporate Falco into my company's build pipeline. The systemd service unit got into a weird state after installing various builds from source and these changes should help maintain/clean that up. The changes to the DEB postinst/prerm/postrm scripts were primarily generated by debhelper. I believe a long-term fix would be to have debhelper generate + validate the debian contents, but that introduces another dependency and requires a few changes to the CPack config. Additionally, there is not debhelper equivalent for Fedora / RPM as far as I know. I'm pretty confident that these can be done by translating what debhelper generated to their Please let me know any of your thoughts or concerns and I'll do my best to address them! |
Hi @happy-dude, thank you for the contribution! As first steps, I'd ask you to un-draft your PR and to sign-off your commit, so that all the checks can proceed. |
9bf88e0
to
0ee8b11
Compare
Thanks Jason, I've
Appreciate the guidance! |
/milestone 0.33.0 |
fi | ||
fi | ||
|
||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then |
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.
Isn't this the same if statement as above? Can we merge them?
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.
I don't think this debhelper-generated block is functionally the same as the configure block that already exists;
I did a little reading here to find out more about how these maintainer-script conditions are called: https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#summary-of-ways-maintainer-scripts-are-called
- configure: all files and dependencies unpacked and configured
- abort-upgrade: all files unpacked, dependencies configured in a unexpected state, attempt to correct or configure again later -- I believe I have ran into situations like these when
apt-get
states that a package was not installed properly and continues to (attempt to) install it during subsequentapt-get
runs. This has happened to with falco itself, although I'm cannot recall how I ended up in that situation (perhaps through installing the upstream package, my own compiled-from-source-package, and playing around with the systemd unit definition at various locations) - abort-deconfigure: package still needs configuring, attempt to correct or configure later
- abort-remove: if package is an unexpected configured state, abort removal and keep it "installed"
Because of this, I don't think this is equivalent to the code above.
For the code above that is associated with installing/adding the kernel module to DKMS, it makes sense to associate these steps for after the falco package has been installed and configured properly. (The other states implies that there are problems during the installation/configuration of the package.)
Other than that, visually, I wanted to keep the auto-generated debhelper contents separate.
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.
I'm not super familiar with how systemd works, but this looks like a very valuable improvement! Looking forward to hear other reviewers' opinions too.
Apologies for the delay in working on the RPM-equivalent series of changes. I'll review https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd to see if there are any tidbits; thus far, it seems like calling |
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.
Overall, this is a very nice improvement! Tiny yet super useful!
Thanks for the contribution, i really like it!
bb382f7
to
0ee8b11
Compare
@dwindsor IIRC you are an RHEL user, right? 😸 |
A few of the situations I'd like to make sure are in an okay systemd situation:
Thanks for testing 🙏 |
ei @happy-dude thank you for this! I will take a look in the next few days 🚀 |
Closing and reopening to trigger the CI /close |
@leogr: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@leogr: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/help |
@happy-dude So, i finally made some tests: Old behaviorInstall:
Uninstall:
New behaviorInstall:
Uninstall:
All in all, this is a nice improvement!
? Like, can we kill Falco (or stop the systemd unit) in the pre-rm scripts? EDIT: uh, it seems you are already doing that:
and
weird, it has no effect :/ EDIT2: @happy-dude i see: i think we should move the above checks/actions before calling |
Signed-off-by: Stanley Chan <[email protected]>
Signed-off-by: Stanley Chan <[email protected]>
ea33d12
to
ba86738
Compare
Thanks @FedeDP for the feedback! The made the changes accordingly and hope everything works as expected. |
Thanks @happy-dude for the quick response even if we took this long to review :) i think this is now ready! |
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.
/approve
LGTM label has been added. Git tree hash: 41a9557294ffa793e0ec462d0837281c83002429
|
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, Happy-Dude, jasondellaluce The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area build
What this PR does / why we need it:
This PR builds off the work introduced in #1448, which converted Falco's initscripts to a systemd unit.
Currently, when removing, reinstalling, and/or upgrading the Falco package via DEB or RPM, the systemd unit file can be left in an unhygienic state and the user needs to perform a
sudo systemctl daemon-reload
.This change re-introduces the falco service cleanup that the DEB and RPM packages perform for it's systemd unit when (re)installing and removing the packages.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: Yes