15

I was try to install mono using the following command:

sudo apt-get install mono-*

I closed the terminal while it was installing. I restarted the install, and I got the error message:

Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

I so far tried running these commands:

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

I am now getting the following error message:

dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

I then used sudo dpkg --configure -a, but now i am getting the following error:

dpkg: error: parsing file '/var/lib/dpkg/updates/0001' near line 0: newline in field name `#padding'"**

I also tried cd /var/lib/dpkg/updates && rm -rf 0045 and sudo dpkg --configure -a , but that was no use.

how do i fix this one?

8
  • 2
    Just curious: if the file is named 0001, why would you do rm 0045? O.o
    – muru
    Sep 9, 2014 at 5:24
  • @Whaaaaaat how can you fix?
    – user332660
    Sep 9, 2014 at 5:27
  • @muru if tried with 0001 then i got error like "rm: cannot remove `0001': Permission denied".
    – user332660
    Sep 9, 2014 at 5:30
  • 2
    First off, don't delete files unless you are absolutely sure that you know what it does and how to recover if it's important.
    – Kaz Wolfe
    Sep 9, 2014 at 5:53
  • 1
    If you want to delete file in /var/lib/dpkg/updates you need root grant, so run rm command with sudo. Be careful, especially if you use -rf. If you mess up, you may also remove all !!!
    – Lety
    Sep 9, 2014 at 11:16

3 Answers 3

34

Make a backup and remove the /var/lib/dpkg/updates/0001 via

sudo mv /var/lib/dpkg/updates/0001 /var/lib/dpkg/updates/0001.X

After that

sudo dpkg --configure -a
sudo apt-get install -f
5

here's how i fixed this problem .. first i removed the whole updates directory ..

rm -r /var/lib/dpkg/updates

after that create a new updates directory

mkdir /var/lib/dpkg/updates

and finally

sudo dpkg --configure -a
0

cleans the apt-get job

 sudo apt-get clean

updates package lists

sudo apt-get update

sudo apt-get install <whatever package>

should get you right

and as @Whaaaaat said you shouldn't delete anything unless you are absolutely sure what it is and what it does, especially if bash is telling you 'you need root permission to even do it'

1
  • I suffered the exact same dpkg error and this does not help anything to solve it. -1. Jun 14, 2019 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .