Linux Could Not Get Lock Error: Complete Fix Guide

How to fix the 'Could not get lock /var/lib/dpkg/lock' error in Linux systems