Skip to content

debian: remove invoke-rc.d calls from postrm scripts#66352

Merged
SrinivasaBharath merged 1 commit intoceph:mainfrom
tchaikov:debian-invoke-rc.d
Feb 13, 2026
Merged

debian: remove invoke-rc.d calls from postrm scripts#66352
SrinivasaBharath merged 1 commit intoceph:mainfrom
tchaikov:debian-invoke-rc.d

Conversation

@tchaikov
Copy link
Copy Markdown
Contributor

Previously, we called invoke-rc.d ceph stop in postrm scripts to support sysvinit-based installations. However, this fails on systemd- based systems, which are now the default on modern Debian distributions.

When invoke-rc.d detects systemd as the init system, it delegates to systemctl, converting invoke-rc.d ceph stop to "systemctl stop ceph.service". Since Ceph provides ceph.target and template units (ceph-osd@.service, ceph-mon@.service, etc.) rather than a monolithic ceph.service, this command always fails with exit code 5 (LSB EXIT_NOTINSTALLED).

This failure prevents the auto-generated cleanup sections added by debhelper from executing properly, which can leave the system in an inconsistent state during package removal.

Changes:

  • Remove the invoke-rc.d call entirely. Systemd will handle service cleanup through its own mechanisms when the package is removed.
  • Remove redundant exit 0 statement (the script exits successfully by default, and set -e is no longer needed without commands that might fail).
  • Remove vim modeline comment, as it's unnecessary for a 3-line script.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@tchaikov
Copy link
Copy Markdown
Contributor Author

cc @ThomasLamprecht

@ThomasLamprecht
Copy link
Copy Markdown
Contributor

If one would be really "nice" one could check for the system running systemd or something else, but IMO it does not really make sense to run ceph on Debian without systemd.
Besides that, any downstream distribution can just re-add these (or similar ones) fitting their init stack more closely.

But all files that basically just have the #DEBHELPER# template stanza left [0] could be also deleted, as that's the default anyway.

[0]: i.e. look like:

#!/bin/sh

set -e

#DEBHELPER#

@jatinkumarsingh
Copy link
Copy Markdown

hey can i help u out mate

Previously, we called "invoke-rc.d ceph stop" in postrm scripts to
support sysvinit-based installations. However, this fails on systemd-
based systems, which are now the default on modern Debian distributions.

When invoke-rc.d detects systemd as the init system, it delegates to
systemctl, converting "invoke-rc.d ceph stop" to "systemctl stop
ceph.service". Since Ceph provides ceph.target and template units
(ceph-osd@.service, ceph-mon@.service, etc.) rather than a monolithic
ceph.service, this command always fails with exit code 5
(LSB EXIT_NOTINSTALLED).

This failure prevents the auto-generated cleanup sections added by
debhelper from executing properly, which can leave the system in an
inconsistent state during package removal.

Changes:

- Remove the invoke-rc.d call entirely. Systemd will handle service
  cleanup through its own mechanisms when the package is removed.
- Remove redundant "exit 0" statement (the script exits successfully
  by default, and "set -e" is no longer needed without commands that
  might fail).
- Remove vim modeline comment, as it's unnecessary for a 3-line script.
- Eventually remove this 3-line script stanza, as this is exactly what
  debhelper provides us.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
@tchaikov
Copy link
Copy Markdown
Contributor Author

changelog:

  • remove the 3-line stanaza as this is what debhelper provides us by default.

@tchaikov
Copy link
Copy Markdown
Contributor Author

tchaikov commented Nov 22, 2025

@ThomasLamprecht hi Thomas, thanks for the insights and suggestion. incorporated your suggestion.

tested at https://shaman.ceph.com/builds/ceph/wip-pr-66352-kefu/0b044bfb0a691f7cd19f34ee1ccf85daf6c2fc01/

i checked by uncompressing the .deb package, and verified that, after removing the .prerm file, the generated prerm is identical to the version generated with the 3-line stanza.

@tchaikov tchaikov requested a review from alimaredia November 27, 2025 02:51
@tchaikov
Copy link
Copy Markdown
Contributor Author

@alimaredia could you help review this change?

Copy link
Copy Markdown
Contributor

@ThomasLamprecht ThomasLamprecht left a comment

Choose a reason for hiding this comment

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

FWIW, this now looks OK to me as is.

@alimaredia alimaredia removed their request for review December 1, 2025 20:21
@alimaredia
Copy link
Copy Markdown
Contributor

@tchaikov I removed my review on this PR. I don't feel I'm able to help out with a review here.

@tchaikov
Copy link
Copy Markdown
Contributor Author

tchaikov commented Dec 3, 2025

thanks @alimaredia !

@cbodley do you happen to know who can help review debian packaging changes in our project?

Copy link
Copy Markdown
Contributor

@cbodley cbodley left a comment

Choose a reason for hiding this comment

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

given the ack from Thomas, i'm happy to approve as long as this goes through qa. is there any additional testing we should do to validate the behavior against systemd?

@tchaikov
Copy link
Copy Markdown
Contributor Author

given the ack from Thomas, i'm happy to approve as long as this goes through qa. is there any additional testing we should do to validate the behavior against systemd?

i installed the packages built with this change in a container, and uninstalled them without errors. also, there are a lot of proxmox users using the postrm script equivalent to the one generated with this change, so they are practically testing the change. i think it should suffice as a proof that this change is correct.

@Naveenaidu
Copy link
Copy Markdown
Contributor

RADOS Approved: https://tracker.ceph.com/issues/74325#note-6

@SrinivasaBharath SrinivasaBharath merged commit 40d8bc0 into ceph:main Feb 13, 2026
13 checks passed
@tchaikov tchaikov deleted the debian-invoke-rc.d branch February 14, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants