Right, this is possible and a very good idea!
The following short code snippet would return the command name of the
application which holds the lock.
import os
import fnctl
import struct
flk = struct.pack('hhQQi', fcntl.F_WRLCK, os.SEEK_SET, 0, 0, 0)
fd = open("/var/lib/dpkg/lock", "r")
pid = struct.unpack("hhQQi", fcntl.fcntl(fd, fcntl.F_GETLK, flk))[5]
fd.close()flk = struct.pack('hhQQi', fcntl.F_WRLCK, os.SEEK_SET, 0, 0, 0)
fd_cmd = open("/proc/%s/cmdline" % pid, "r")
command = fd_cmd.readline()
fd_cmd.close()
--
"waiting for service to start" text in pending operations is misleading
https://bugs.launchpad.net/bugs/444261
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs