Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
61
rated 0 times [  61] [ 0]  / answers: 1 / hits: 161608  / 3 Years ago, mon, august 23, 2021, 5:27:17

I have an apt-get install process that seems to be hopelessly wedged at the processing triggers for python-support step.



My inclination is to kill it, but in the past, simply kill-ing an apt-get install process has caused me much grief. (IIRC assorted lock files are left behind, etc.)



Is there a safer way to stop this process?


More From » apt

 Answers
4

Killing processes


Generally speaking for killing a process, there's no safer way to kill a process than with a regular kill (SIGTERM). In case it's an interactive process it usually allows you to stop it even safer by sending a SIGINT signal, usually sent by pressing Ctrl + C. This signal is being trapped by the process itself can listen to it - and usually stop gracefully. (thanks Eliah)


DPKG database


Regarding the package management is a sort of special case. The DPKG database that the APT commands use under water can always detect whether an operation hasn't finished. Every package has an actual state which is marked in as well as a current state, e.g. unpacked, configured, etc. By killing the APT frontend, the database will be in a broken, but in known state. The lock files will only be released once it's all back in a clean state - you should get this fixed until it allows new operations.


The way to fix is just firing a process to get all packages in the configured state. Practically speaking, if you've interrupted an apt-get operation, you can just finish it later using


sudo dpkg --configure -a

It knows how to recover from the broken state to an all-configured state and in that sense just continue from where it was interrupted. The lock files are left there until you finished that, and that's for a reason - to prevent new operations with the DPKG database in an unclean state.


About SIGKILL (9)


Sending a SIGKILL (decimal representation 9) is very unsafe. This signal is cannot be caught by the process, but the whole process will be cleaned up by the operating system (kernel) whether the process likes it or not. The state of the files on the file system can be left in a corrupt state. Never send these signals unless it's not listening to other more graceful signals anymore.


[#32735] Tuesday, August 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
assionortly

Total Points: 423
Total Questions: 121
Total Answers: 115

Location: Chad
Member since Wed, Sep 30, 2020
4 Years ago
;