This question already has an answer here:
Calling the sudo apt-get update fails to complete. Fails with:
Fetched 2,212 kB in 13s (162 kB/s) 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?
investigation with lsof yields:
$ sudo lsof /var/lib/dpkg/lock COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME unattende 24512 root 4uW REG 8,2 0 5506231 /var/lib/dpkg/lock
The process is revealed to be the unattended-upgrade package:
$ ps aux | grep 24512 root 24512 0.0 0.0 98652 5764 ? DN 07:33 0:01 /usr/bin/python /usr/bin/unattended-upgrade
The last bits in the most recent log file are (tail /var/log/unattended-upgrades/unattended-upgrades-dpkg_MOST_RECENT_TIMESTAMP.log):
Installing new version of config file /etc/java-6-openjdk/security/java.security ... Setting up openjdk-6-jre-lib (6b27-1.12.5-0ubuntu0.12.04.1) ... Setting up icedtea-6-jre-cacao (6b27-1.12.5-0ubuntu0.12.04.1) ... Setting up icedtea-6-jre-jamvm (6b27-1.12.5-0ubuntu0.12.04.1) ... Setting up openjdk-6-jre (6b27-1.12.5-0ubuntu0.12.04.1) ... Setting up openjdk-6-jdk (6b27-1.12.5-0ubuntu0.12.04.1) ...
running strace outputs nothing after the attach line:
$ sudo strace -p 24512 Process 24512 attached - interrupt to quit
Turning unattended-upgrades on/off with dpkg-reconfigure executes, but doesn't solve the problem.
$ sudo dpkg-reconfigure unattended-upgrades
This computer has been up and running for over 100 days, but there have been recent power outages to the surrounding areas recently that took out the internet.
How can I safely end the process and remove the file lock?