flock does not lock dpkg lock file properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
util-linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Test:
sudo flock /var/lib/dpkg/lock -c \
'echo 1; apt-get -o Debug::
Expected behavior:
apt-get fails in stage 2.
Workaround (needs moreutils package, which is not installed by default):
sudo lckdo /var/lib/dpkg/lock /bin/sh -c \
'echo 1; apt-get -o Debug::
Similarly, flock does not recognize lock set by e.g. apt-get.
man lckdo:
"Now that util-linux contains a similar command named flock, lckdo is deprecated, and will be removed from some future version of moreutils."
So developer can not rely on lckdo.
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: util-linux 2.20.1-
ProcVersionSign
Uname: Linux 4.4.0-96-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.25
Architecture: amd64
CurrentDesktop: XFCE
Date: Sat Sep 30 16:30:50 2017
EcryptfsInUse: Yes
InstallationDate: Installed on 2014-09-21 (1105 days ago)
InstallationMedia: Ubuntu-Studio 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.1)
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile.
dpkg does not use flock(); it uses the lock file /var/lib/dpkg/lock.