Ceph (artful) fails to uninstall

Asked by Alin Trăistaru on 2018-03-15

On Artful, Ceph fails to uninstall properly:

=====================================
$ sudo apt purge ceph*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ceph-fs-common' for glob 'ceph*'
Note, selecting 'ceph-common' for glob 'ceph*'
Note, selecting 'ceph-mds' for glob 'ceph*'
Note, selecting 'ceph-mgr' for glob 'ceph*'
Note, selecting 'ceph-mon' for glob 'ceph*'
Note, selecting 'ceph-osd' for glob 'ceph*'
Note, selecting 'ceph-test' for glob 'ceph*'
Note, selecting 'ceph-deploy' for glob 'ceph*'
Note, selecting 'ceph-base' for glob 'ceph*'
Note, selecting 'ceph-resource-agents' for glob 'ceph*'
Note, selecting 'ceph' for glob 'ceph*'
Note, selecting 'ceph-fuse' for glob 'ceph*'
Note, selecting 'ceph-client-tools' for glob 'ceph*'
Package 'ceph-client-tools' is not installed, so not removed
Package 'ceph-fs-common' is not installed, so not removed

The following packages will be REMOVED:
  ceph* ceph-base* ceph-common* ceph-deploy* ceph-fuse* ceph-mds* ceph-mgr* ceph-mon* ceph-osd* ceph-resource-agents* ceph-test*
0 upgraded, 0 newly installed, 11 to remove and 1 not upgraded.
After this operation, 303 MB disk space will be freed.
Do you want to continue? [Y/n]

(Reading database ... 193522 files and directories currently installed.)
Removing ceph-resource-agents (12.2.2-0ubuntu0.17.10.1) ...
Removing ceph-mds (12.2.2-0ubuntu0.17.10.1) ...
Failed to stop ceph.service: Unit ceph.service not loaded.
invoke-rc.d: initscript ceph, action "stop" failed.
dpkg: error processing package ceph-mds (--remove):
 subprocess installed pre-removal script returned error exit status 5
Removing ceph-test (12.2.2-0ubuntu0.17.10.1) ...
Removing ceph-deploy (1.5.38-0ubuntu1) ...
Removing ceph-fuse (12.2.2-0ubuntu0.17.10.1) ...
dpkg: ceph-osd: dependency problems, but removing anyway as you requested:
 ceph depends on ceph-osd (= 12.2.2-0ubuntu0.17.10.1).

Removing ceph-osd (12.2.2-0ubuntu0.17.10.1) ...
Failed to stop ceph.service: Unit ceph.service not loaded.
invoke-rc.d: initscript ceph, action "stop" failed.
dpkg: error processing package ceph-osd (--remove):
 subprocess installed pre-removal script returned error exit status 5
dpkg: ceph-base: dependency problems, but removing anyway as you requested:
 ceph-mgr depends on ceph-base (= 12.2.2-0ubuntu0.17.10.1).
 ceph-mon depends on ceph-base (= 12.2.2-0ubuntu0.17.10.1).
 ceph-osd depends on ceph-base (= 12.2.2-0ubuntu0.17.10.1).

Removing ceph-base (12.2.2-0ubuntu0.17.10.1) ...
Failed to stop ceph.service: Unit ceph.service not loaded.
invoke-rc.d: initscript ceph, action "stop" failed.
dpkg: error processing package ceph-base (--remove):
 subprocess installed pre-removal script returned error exit status 5
dpkg: ceph-common: dependency problems, but removing anyway as you requested:
 ceph-base depends on ceph-common (= 12.2.2-0ubuntu0.17.10.1).
 ceph-osd depends on ceph-common (= 12.2.2-0ubuntu0.17.10.1).

Removing ceph-common (12.2.2-0ubuntu0.17.10.1) ...
dpkg: ceph-mon: dependency problems, but removing anyway as you requested:
 ceph depends on ceph-mon (= 12.2.2-0ubuntu0.17.10.1).

Removing ceph-mon (12.2.2-0ubuntu0.17.10.1) ...
Failed to stop ceph.service: Unit ceph.service not loaded.
invoke-rc.d: initscript ceph, action "stop" failed.
dpkg: error processing package ceph-mon (--remove):
 subprocess installed pre-removal script returned error exit status 5
No apport report written because MaxReports is reached already
                                                              dpkg: ceph: dependency problems, but removing anyway as you requested:
 ceph-mds depends on ceph.

Removing ceph (12.2.2-0ubuntu0.17.10.1) ...
Removing ceph-mgr (12.2.2-0ubuntu0.17.10.1) ...
Failed to stop ceph.service: Unit ceph.service not loaded.
invoke-rc.d: initscript ceph, action "stop" failed.
dpkg: error processing package ceph-mgr (--remove):
 subprocess installed pre-removal script returned error exit status 5
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 ceph-mds
 ceph-osd
 ceph-base
 ceph-mon
 ceph-mgr
E: Sub-process /usr/bin/dpkg returned an error code (1)
=====================================

Question information

Manfred Hampl (m-hampl) said : #1

"Failed to stop ceph.service: Unit ceph.service not loaded."

It seems that as part of the removal of the ceph packages (I assume in the prerm script) the ceph demon should be stopped, and this seems to be failing on your system.

When the ceph packages were installed, was the ceph.service demon correctly running?

Alin Trăistaru (alindt) said : #2

I haven't checked, but the install was done on a clean Artful VM, immediately after the first boot, by "sudo apt install ceph*".
Googling around I found that the same problem was reported some time ago with ceph 9.x (#1546112)

Alin Trăistaru (alindt) said : #3

Clean Artful VM, immediately after ceph install from official repos:

==================================================
test@test-virtual-machine:~$ systemctl status ceph.service
Unit ceph.service could not be found.

test@test-virtual-machine:~$ find /etc/systemd/ -iname "*ceph*"
/etc/systemd/system/ceph.target.wants
/etc/systemd/system/ceph.target.wants/ceph-mgr.target
/etc/systemd/system/ceph.target.wants/ceph-mon.target
/etc/systemd/system/ceph.target.wants/ceph-osd.target
/etc/systemd/system/ceph.target.wants/ceph-mds.target
/etc/systemd/system/ceph.target.wants/ceph-fuse.target
/etc/systemd/system/multi-user.target.wants/ceph-mgr.target
/etc/systemd/system/multi-user.target.wants/ceph-mon.target
/etc/systemd/system/multi-user.target.wants/ceph-osd.target
/etc/systemd/system/multi-user.target.wants/ceph-mds.target
/etc/systemd/system/multi-user.target.wants/ceph.target
/etc/systemd/system/remote-fs.target.wants/ceph-fuse.target

test@test-virtual-machine:~$ find /lib/systemd/system/*ceph*
/lib/systemd/system/ceph-disk@.service
/lib/systemd/system/ceph-fuse@.service
/lib/systemd/system/ceph-fuse.target
/lib/systemd/system/ceph-mds.service
/lib/systemd/system/ceph-mds@.service
/lib/systemd/system/ceph-mds.target
/lib/systemd/system/ceph-mgr@.service
/lib/systemd/system/ceph-mgr.target
/lib/systemd/system/ceph-mon.service
/lib/systemd/system/ceph-mon@.service
/lib/systemd/system/ceph-mon.target
/lib/systemd/system/ceph-osd@.service
/lib/systemd/system/ceph-osd.target
/lib/systemd/system/ceph.target
/lib/systemd/system/ceph-volume@.service
==================================================

Manfred Hampl (m-hampl) said : #4

Are there any ceph demons running?

Alin Trăistaru (alindt) said : #5

test@test-virtual-machine:~$ systemctl list-units | grep -i ceph

● rbdmap.service loaded failed failed LSB: Ceph RBD Mapping
  ceph-mds.target loaded active active ceph target allowing to start/stop all ceph-mds@.service instances at once
  ceph-mgr.target loaded active active ceph target allowing to start/stop all ceph-mgr@.service instances at once
  ceph-mon.target loaded active active ceph target allowing to start/stop all ceph-mon@.service instances at once
  ceph-osd.target loaded active active ceph target allowing to start/stop all ceph-osd@.service instances at once

test@test-virtual-machine:~$ systemctl unmask ceph<TAB><TAB>
ceph-fuse.target ceph.target

Best Manfred Hampl (m-hampl) said : #7

Two remarks:

1. There is bug #1754585 about a similar problem, you should click the "affects me too" button to get this bug confirmed

2. You have to be aware that some ceph-related packages are named differently (e.g. *rados*, *rbd* and *rbg*)

Joel Van Boxtel (jeol13) said : #8

affects ubuntu 18.04

bug report issued:
#1756495

Alin Trăistaru (alindt) said : #9

Bug #1754585 confirmed, waiting for a fix.

Alin Trăistaru (alindt) said : #10

Thanks Manfred Hampl, that solved my question.