Add info about process locking /var/lib/dpkg/lock when having package reporting issues

Bug #1659014 reported by David Coronel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
Confirmed
Wishlist
Unassigned
dpkg (Ubuntu)
New
Undecided
Unassigned

Bug Description

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]

Tags: lds-squad
David Coronel (davecore)
information type: Proprietary → Public
affects: landscape → landscape-client
Changed in landscape-client:
status: New → Confirmed
David Britton (dpb)
Changed in landscape-client:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.