If ever you tried to perform an apt operation and encountered the error below, it can be due to an unattended upgrade (i.e., system upgrade) locked the package database to prevent conflict.
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1234 (unattended-upgr)
You can kill the process by first searching for it with ps aux | grep unattended.
Then kill the process forcefully with sudo kill -9 1234 (1234 is the process id from the search step).