You have been subscribed to a public bug:

This is a feature request to add more information about which process is
locking /var/lib/dpkg/lock instead of just saying "Could not get lock"
when having package reporting issues.

The name and PID of the process and possibly its parent processes would
give users more information as to what was using the lock.

Here is an example of the kind of additional information that would help
the user find out what was locking apt:

# lsof /var/lib/dpkg/lock
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apt-get 15935 root    4uW  REG   0,47        0   87 /var/lib/dpkg/lock

# ps -f --pid 15935
UID        PID  PPID  C STIME TTY          TIME CMD
root     15935  1843  0 14:20 ?        00:00:00 apt-get upgrade

# ps -f --pid 1843 
UID        PID  PPID  C STIME TTY          TIME CMD
root      1843     0  0 Jan23 ?        00:00:00 bash


Right now, when clicking on the alert "1 computer is having issues reporting 
packages" for this lock issue, the Exit Code is 100 and the Error output is:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily 
unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another 
process using it?

In one scenario, a user had https://mathias-
kettner.de/checkmk_check_apt.html running on his servers every minute
and didn't know about it until he used auditd to see what was locking
/var/lib/dpkg/lock.

Reproducer:

Issue can be reproduced by leaving an apt-get process at the Yes/No
prompt on a computer:

# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 486 kB of archives.
After this operation, 1024 B of additional disk space will be used.
Do you want to continue? [Y/n]

** Affects: landscape-client
     Importance: Wishlist
         Status: Confirmed

** Affects: apt (Ubuntu)
     Importance: Undecided
         Status: Fix Released


** Tags: lds-squad rls-pp-incoming
-- 
Add info about process locking /var/lib/dpkg/lock when having package reporting 
issues
https://bugs.launchpad.net/bugs/1659014
You received this bug notification because you are a member of Ubuntu Touch 
seeded packages, which is subscribed to apt in Ubuntu.

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to