so I'm trying some python 2 scripts in my Ubuntu VM. I installed python 2. One of the scripts need the module pathlib. Tried to install it but got a error message:

~/Desktop$ sudo apt-get install -y python-pathlib
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 8632 (unattended-upgr)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

I like to know that means and of course I like to know why this happened. I'm grateful for any help!



You see this error because some other program is trying to update Ubuntu. When a command or application is updating the system or installing a new software, it locks the dpkg file (Debian package manager).

This locking is done so that two processes don’t change the content at the same time as it may lead to unwarranted situation and a possible broken system.

Read more here about this error and how to resolve it.

  • Thanks but after all methods tried out I still get the following error, which prevents me from installing pathlib: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python-pathlib – simonericmoon Jun 7 at 12:23
  • What is the output of apt-cache search python-pathlib ? – blnks Jun 7 at 12:24
  • python-pathlib2 - Backport of the "pathlib" stdlib module (Python 2) – simonericmoon Jun 7 at 12:28
  • So try sudo apt install python-pathlib2 – blnks Jun 7 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.