I can reproduce my original example on Xenial on a different machine, and now I see that it is a race. Whether I drop the sleeps or not, it sometimes gives me "Job for cups.service canceled." and sometimes:
Warning: Stopping cups.service, but it can still be activated by: cups.path -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1642966 Title: package cups-daemon 2.1.3-4 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1642966/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs