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

FR-6365 - Prevent daemons from running when installing packages #183

Merged
merged 15 commits into from
Feb 23, 2024

Conversation

upils
Copy link
Collaborator

@upils upils commented Feb 2, 2024

This is another attempt at solving LP: #2049695 with 2 distinct improvements.

  • As explained in the bug, /dev cannot be unmouted because some processes are left running after the packages installation.
    ubuntu-image was not using a policy-rc.d to prevent daemon/services from running after installing some packages.
    See the invokerc.d documentation and this thread explaining systemd is respecting this policy.
    This PR is using policy-rc.d, start-stop-daemon and initctl to try preventing as many services as possible from starting.

  • Even though services should not start anymore, we notice some directories/devices might be mounted during the package installation. Additional mountpoints should now be detected and unmounted.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: Patch coverage is 88.04665% with 41 lines in your changes are missing coverage. Please review.

Project coverage is 87.35%. Comparing base (f91d7ff) to head (5a9be67).

Files Patch % Lines
internal/statemachine/helper.go 81.63% 17 Missing and 1 partial ⚠️
internal/helper/helper.go 77.08% 10 Missing and 1 partial ⚠️
internal/statemachine/mount_helper.go 90.72% 6 Missing and 3 partials ⚠️
internal/statemachine/classic_states.go 97.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
- Coverage   88.44%   87.35%   -1.10%     
==========================================
  Files          14       15       +1     
  Lines        3714     3937     +223     
==========================================
+ Hits         3285     3439     +154     
- Misses        376      438      +62     
- Partials       53       60       +7     
Flag Coverage Δ
unittests 87.35% <88.04%> (-1.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@upils upils changed the title FR-6365 - Prevent daemon to run when installing packages FR-6365 - Prevent daemons from running when installing packages Feb 2, 2024
@upils upils self-assigned this Feb 6, 2024
@upils upils force-pushed the list-recursive-mounts branch 2 times, most recently from 190126f to d30713b Compare February 6, 2024 13:23
@upils
Copy link
Collaborator Author

upils commented Feb 7, 2024

Even though the bug is not fully solved, I think this PR should not contain any more improvements, it is big enough.

Another PR should be open if we want to make u-i even more robust to weird behaviors in package installation. Maybe at some point we will resort to umount -l or killing every processes in the chroot but I would like to avoid that.

@upils upils marked this pull request as ready for review February 7, 2024 13:48
sil2100
sil2100 previously approved these changes Feb 19, 2024
Copy link
Collaborator

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

We still need to think if this is the way we want to go, but for now I think it's the right thing. LGTM.

internal/helper/helper.go Show resolved Hide resolved
@upils upils force-pushed the list-recursive-mounts branch 2 times, most recently from e4735cf to 76ab2de Compare February 23, 2024 11:27
@upils upils changed the base branch from main to ppas-deb822 February 23, 2024 11:27
Base automatically changed from ppas-deb822 to main February 23, 2024 13:32
Copy link
Collaborator

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

This one looks good to go. As we discussed elsewhere, I think we need to think about our general approach to the rootfs building: should we continue on being strict and blocking daemons from starting etc., or should we be more destructive and allowing anything but then forcibly killing all processes involved? We'll have to discuss separately.

For now this is better than what we have and a step in a better direction.

@upils upils merged commit b9112a8 into main Feb 23, 2024
10 of 13 checks passed
@upils upils deleted the list-recursive-mounts branch February 23, 2024 15:25
@upils upils mentioned this pull request Mar 11, 2024
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