Common Linux errors: cocould not get lock/var/lib/dpkg/lock and lockdpkg
Installing vim on Ubuntu is a problem:
Root @ ubuntu:/# vimThe program 'vim 'can be found in the following packages: * vim-gnome * vim-tiny * vim-athena * vim-athena-py2 * vim-gnome-py2 * vim-gtk * vim-gtk-py2 * vim-gtk3 * vim-gtk3-py2 * vim-nox * vim-nox-py2Try: apt install <selected package> root @ ubuntu:/# apt install vimE: cocould not get lock/var/lib/dpkg/lock-open (11: Resource temporarily unavailable) E: unable to lock the admi Nistration directory (/var/lib/dpkg/), is another process using it? Root @ ubuntu :/#
This problem may occur when another program is running, causing the resource to be locked and unavailable. The reason for the resource lock may be that the last installation or update was not completed properly, and this problem occurs. The solution is actually very simple:
Enter the following two commands on the terminal:
Root @ ubuntu:/# sudo rm/var/cache/apt/archives/lockroot @ ubuntu:/# sudo rm/var/lib/dpkg/lock
Run the command to install the vim text editor again.