diff --git a/sonic_package_manager/manager.py b/sonic_package_manager/manager.py index 467c29a8d265..b4b33c079798 100644 --- a/sonic_package_manager/manager.py +++ b/sonic_package_manager/manager.py @@ -435,6 +435,17 @@ def uninstall(self, name: str, force=False): # After all checks are passed we proceed to actual uninstallation try: + # Stop and disable the service. + # First to make sure we are not uninstalling + # package before the service has fully stopped + # since "config feature state" command is not blocking. + # Second, we make sure the service is in disabled state + # so that after reinstall and enablement hostcfgd will enable + # it and start it. + # TODO: once there is a way to block till hostcfgd will stop + # the service, replace it with new approach. + self._systemctl_action(package, 'stop') + self._systemctl_action(package, 'disable') self._uninstall_cli_plugins(package) self.service_creator.remove(package) self.service_creator.generate_shutdown_sequence_files(