[Discuss] How does dpkg...
Patrick
Nixnik-sneaking at sneakEmail.com
Tue Feb 18 07:29:54 PST 2014
On Mon, 17 Feb 2014 11:01:16 -0800
brendan wrote:
> it's probably a lock file, but to check, just get dpkg process to lock things and while it is active strace another dpkg process to see what it's calling to check the lock file.
It just tells me what I already know, that the resource is
temporarily unavailable.
Strangely, I can;
sudo flock -e /var/lib/dpkg/lock -c mousepad
and prevent another flocked instance of mousepad from starting
until the first exits, but package managers [synaptic, gdebi,
apt-get etc] won't respect that method of locking.
I can also use;
fuser /var/lib/dpkg/lock
to see if a package manager's running, but fuser won't say
anything about a file locked using flock. So I'm not going to
use flock. I don't see any way to use fcntl or lockf in a shell
script, although there might be one -- maybe throw in a fragment
of python, where needed.
Apparently, Unix file locking is insane;
http://oilq.org/fr/node/13344
I'm tempted to do this;
mv /var/lib/dpkg /var/lib/DPKG
[which *will* disable all things deb-related, but probably does
it the wrong way], then move it back to /var/lib/dpkg when done.
I'd also have to move ./*/var/lib/DPKG to ./*/var/lib/dpkg within
the snapshots directories.
That's ugly, and kludgy, and a potential nuisance if a backup
script terminates before it can put things back where it found
them -- but that's all I can think of.
Hmm,
Patrick.
--
UNIX was not designed to stop you from doing stupid things,
because that would also stop you from doing clever things.
-- Doug Gwyn
More information about the Discuss
mailing list