chrony package removal fails

Bug #1873810 reported by Balint Reczey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chrony (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * I was cherry-picking a fix we needed due to the recent systemd
   changes to timesyncd. There was also a fix-of-the-fix a bit later which
   is missing and therefore breaking package removal.

 * The fix is as simple as adding the "remove" target to the case statement
   on the empty target and thereby avoiding breakage.

[Test Case]

 * apt install chrony
 * apt install systemd-timesyncd
   # this should list and work:
   The following packages will be REMOVED:
     chrony
 * apt install chrony
 * apt remove chrony

[Regression Potential]

 * It is a silly bug due to cherry picking a fix without the fix-of-the-
   fix. I honestly see no regression due to re-adding "remove" target.

[Other Info]

 * This does not necessarily have to be on the -release. Nothing to stop
   generating the ISO at least. But I'd appreciate if we could accept it
   into -proposed asap to hopefully (if we rebuild once) pick it up.
   The reason is that I haven't seen reports, but can think of odd
   dependency chains like
    1. install chrony (will remove systemd-timesyncd)
    2. remove chrony fails
    3. but installing systemd-timesyncd fails as well
   It can be hard to get this resolved and the change is small.
   So I'd appreciate if we could avoid it completely.

root@f:~# apt install systemd-timesyncd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  chrony
The following NEW packages will be installed:
  systemd-timesyncd
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/27.9 kB of archives.
After this operation, 290 kB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: chrony: dependency problems, but removing anyway as you requested:
 systemd depends on systemd-timesyncd | time-daemon; however:
  Package systemd-timesyncd is not installed.
  Package time-daemon is not installed.
  Package systemd-timesyncd which provides time-daemon is not installed.
  Package chrony which provides time-daemon is to be removed.

(Reading database ... 83798 files and directories currently installed.)
Removing chrony (3.5-6ubuntu5) ...
postrm called with unknown argument `remove'
dpkg: error processing package chrony (--remove):
 installed chrony package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 chrony
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

---

In a fresh 20.04 lxc/chroot install, then remove chrony:

# apt install chrony
...
# apt install systemd-timesyncd
Reading package lists... Done
uilding dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  chrony
The following NEW packages will be installed:
  systemd-timesyncd
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 27.9 kB of archives.
After this operation, 290 kB disk space will be freed.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 systemd-timesyncd amd64 245.4-4ubuntu1 [27.9 kB]
Fetched 27.9 kB in 0s (951 kB/s)
dpkg: chrony: dependency problems, but removing anyway as you requested:
 systemd depends on systemd-timesyncd | time-daemon; however:
  Package systemd-timesyncd is not installed.
  Package time-daemon is not installed.
  Package systemd-timesyncd which provides time-daemon is not installed.
  Package chrony which provides time-daemon is to be removed.

(Reading database ... 31279 files and directories currently installed.)
Removing chrony (3.5-6ubuntu5) ...
postrm called with unknown argument `remove'
dpkg: error processing package chrony (--remove):
 installed chrony package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 chrony
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ff-chrony:~# history
    1 apt install chrony
    2 apt install systemd-timesyncd
    3 history
root@ff-chrony:~# dpkg -l chrony
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=====================================================
rH chrony 3.5-6ubuntu5 amd64 Versatile implementation of the Network Time Protocol

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks rbalint, confirmed

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

# targets: purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear

but
    purge)
    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

Broken by:
commit d70baea9c674ffc6cc6db5a8c3eb5d3590002a12
Author: Vincent Blut <email address hidden>
Date: Sat Apr 4 21:56:46 2020 +0200

    d/postrm: Stop starting systemd-timesyncd in postrm (Closes: #955773)

Fixed by:
commit 9894b23bcf0689f11b47c197d0d62f11b9ca0368
Author: Vincent Blut <email address hidden>
Date: Sat Apr 4 22:15:58 2020 +0200

    d/postrm: Reinstate the remove target

description: updated
Changed in chrony (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package chrony - 3.5-6ubuntu6

---------------
chrony (3.5-6ubuntu6) focal; urgency=medium

  * d/postrm: Reinstate the remove target (LP: #1873810)

 -- Christian Ehrhardt <email address hidden> Mon, 20 Apr 2020 15:58:52 +0200

Changed in chrony (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.