The Main Concept of this error is simple
it’s normally say Could not get lock /var/lib/dpkg/lock
normally fixed with
$ sudo reboot
but sometime that doesn’t work
then you should do
$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/dpkg/lock*
this should do the job done by 99% of chance
but if you are the one that doing this does nothing?
$ sudo dpkg –configure -a
$ sudo apt update
this should do the job done