Commit e7cb5894 authored by segfault's avatar segfault

Prevent service autostart during installation

parent bae40642
......@@ -143,6 +143,9 @@ class OnionService(DBusObject, metaclass=abc.ABCMeta):
with self.prevent_service_autostart():
# Prevent service autostart after container is restarted
self.TransactionStatus = _("Configuring service")
......@@ -53,6 +53,15 @@ class SystemdManager(object):
raise SystemdError("Failed to start %s (timeout: %s). systemctl status: %s" %
(, START_TIMEOUT, self._get_service_status_output()))
def disable(self):
logger.debug("Disabling %s",
if sh.systemctl("-M", self.container, "show", "-p", "CanStart") != "CanStart=yes":
# The disable command fails if there is no unit file installed (e.g. because it's not automatically
# installed by the APT package but by us later), so we do nothing if the unit cannot be started anyway
logger.debug("Not disabling %s because the unit cannot be started anyway (probably no unit file installed)")
sh.systemctl("-M", self.container, "disable", self.service)
def is_running(self) -> bool:
if not container_is_running(self.container):
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment