Skip to content

Instantly share code, notes, and snippets.

@haeramkeem
Created June 3, 2022 00:28
Show Gist options
  • Save haeramkeem/0285c18b05d4f73cc57937f226d5f646 to your computer and use it in GitHub Desktop.
Save haeramkeem/0285c18b05d4f73cc57937f226d5f646 to your computer and use it in GitHub Desktop.
dpkg: error: dpkg frontend lock is locked by another process
#!/bin/bash
# dpkg: error: dpkg frontend lock is locked by another process
# Ref: https://askubuntu.com/a/291584
# Check PID of the running dpkg process
lsof /var/lib/dpkg/lock
# See status of the process
ps cax | grep ${PID}
# If it's still running:
kill ${PID}
kill -9 ${PID}
# Check kill result
ps cax | grep ${PID}
# Remove lock file
sudo rm /var/lib/dpkg/lock
# Fix dpkg
sudo dpkg --configure -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment