I came across this error “dpkg: error: dpkg frontend is locked by another process” whilst working with Nessus/Tenable and trying to get an agent deployed, but it caught me off guard because I had nothing else running on the machine and couldn’t quite understand how the dpkg could be locked up.

Never the less to fix this, I had to identify what package/process was locking up dpkg, so to do this I ran the following and then killed it off.
Run “sudo lsof /var/lib/dpkg/lock-frontend” and you’ll hopefully see the process. For me it was process ID 5181.

Kill the process “sudo kill 5181”

Then try re-running the the dpkg command.
