core: Provide more meaningful error when failed to kill old QubesDB instance
This process may be running as root in case of default NetVM. But do not kill it forcibly (through sudo or so), because it may also be stale pid file. After all, QubesDB should automatically terminate when its VM is terminated, so this code is already some error handling. Fixes QubesOS/qubes-issues#1331
This commit is contained in:
parent
2b7bd1f1f5
commit
5c549e1134
@ -1738,7 +1738,15 @@ class QubesVm(object):
|
||||
try:
|
||||
if os.path.exists(pidfile):
|
||||
old_qubesdb_pid = open(pidfile, 'r').read()
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user