diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 219690fb..fbca1f15 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1738,7 +1738,15 @@ class QubesVm(object): try: if os.path.exists(pidfile): old_qubesdb_pid = open(pidfile, 'r').read() - os.kill(int(old_qubesdb_pid), signal.SIGTERM) + try: + os.kill(int(old_qubesdb_pid), signal.SIGTERM) + except OSError: + raise QubesException( + "Failed to kill old QubesDB instance (PID {}). " + "Terminate it manually and retry. " + "If that isn't QubesDB process, " + "remove the pidfile: {}".format(old_qubesdb_pid, + pidfile)) timeout = 25 while os.path.exists(pidfile) and timeout: time.sleep(0.2)