Bug 42504

Summary: apt-get stops if synaptic is running during package install.
Product: Sisyphus Reporter: Iakunin Andrei <iakuninaa>
Component: aptAssignee: Ivan Zakharyaschev <imz>
Status: NEW --- QA Contact: qa-sisyphus
Severity: minor    
Priority: P5 CC: boyarsh, glebfm, imz, iv, ldv, placeholder
Version: unstable   
Hardware: x86_64   
OS: Linux   
Bug Depends on: 40348    
Bug Blocks:    

Description Iakunin Andrei 2022-04-20 11:13:03 MSK
Way to reproduce:
Open synaptic, use root password. 
Find some package (for example libgmp-devel) and check for install (!!!)

In konsole execute: $sudo apt-get install something (i tried virt-viewer)
Same for $apt-get remove

First package will be installed, and then apt-get stops.
apt-get do not respond on ^z and ^c. 
apt-get will resume if synaptic will be closed. 
But if user forget about synaptic and kill apt-get(by kill -9 or closing konsole window) system may stay in unstable state. With, for example, two versions of same lib installed.

Proposal -- check if other PM is running at start of apt-get.
Debian, as i remember, does not start apt if synaptic is running.

$apt-get --version
apt 0.5.15lorg2 для linux x86_64 собран Feb  9 2022 23:33:31

$apt-cache show synaptic
Package: synaptic
Section: System/Configuration/Packaging
Installed Size: 5094531
Maintainer: Ivan Zakharyaschev <imz@altlinux.org>
Version: 0.58-alt28:p10+295130.700.2.1@1644479727
Comment 1 Ivan Zakharyaschev 2022-09-01 15:50:55 MSK
Thanks for the report! (I hope someone some day will think about it and implement a solution.)

A few more lock-related observations:

* Now, concurrent install/remove actions can lead to broken state at the end -- https://bugzilla.altlinux.org/40348

* Waiting for locks before starting another instance of apt in Debian -- https://unix.stackexchange.com/q/242539/4319
Comment 2 Ivan Zakharyaschev 2022-09-01 15:58:15 MSK
I'm afraid that having just a lock for apt wouldn't solve a potential race between plain rpm and apt-or-whatever, as described in https://bugzilla.altlinux.org/40348 ; if a more tricky locking scheme is implemented in rpm (like the one suggested there), that would make "apt-get install" (or "rpm -U") at least not start the installation as long as synaptic holds a read-lock on the database. (Probably, that is the reason for the described behavior, but I might be wrong.)