简体   繁体   中英

Linux, piping together apt-get update and apt-get upgrade

I am trying my hand at deploying a small django app I have created on a remote server using fabric. As this is fresh server and after googling, I observed that I had to run apt-get update && apt-get upgrade commands to update the system packages.

The command I provided using fabric api is

run('apt-get update && apt-get upgrade')

I get

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?

How do I execute this commands so that I do not face this error

In this case you just have to remove the lock:

sudo rm /var/lib/dpkg/lock

and then try to execute the command

Let me know if its helps if not then follow the following:

sudo su sudo rm /var/lib/dpkg/lock apt-get update

and then execute the command update and upgrade command on single line and if its works then go for api

It means another process is already running an apt-get command. Close your other terminal windows, and perhaps any GUI's you have open that use apt-get.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM