Linux operating system ( Ubuntu)

2019-09-19 09:30发布

问题:

I am tying sudo apt-get install gparted command on terminal but it is not working properly and showing this error. What could be the problem?

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

回答1:

Restarting the system should solve the problem. If the restarting doesn't help, try this link

You can delete the lock file with the following command:

sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory

sudo rm /var/cache/apt/archives/lock



回答2:

i got the same issue when i upgraded my 32-bit ubuntu16.04 to 64-bit configurations.

You need to just delete the lock files in the directory /var/lib/dpkg/lock-frontend .this worked for me.

And also i recommend you to just hit the sudo apt-get upgrade command to upgrade the packages you have to be latest ones.



回答3:

maybe you have another installation in course, because the last question "is another process using it?" or maybe you didn't noted the system is updating itself.



回答4:

I got these messages after I started removing my own service from my Ubuntu 16.04 LTS box (did sudo rm /etc/init.d/mysvc; sudo update-rc.d mysvc remove), but forgot to kill the daemon that was spawned by mysvc. So the removal of mysvc has not been completed. After I killed the daemon, these messages were gone. HTH, :)