Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am having troubles running the following command on my Linux Mint partition:

sudo apt-get update && apt-get upgrade

This is the first I have ever encountered this, and I run this command every two to three days to keep my system up to date. Currently, I am getting the error message:

Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
Unable to lock the administration directory (/var/lib/dpkg/), are you root?

I am able to verify my username, (whoami returns my username), and I haven't been able to find any leads through Google or the StackExchange sites I have tried (superuser and stackoverflow). I'm perplexed.

Could this be some sort of security breach? Or (I am hoping) is my limited sysadmin knowledge the culprit? I would appreciate any input I can get, but if I have to I can wipe the partition entirely and reinstall (all of my important data is religiously redundant elsewhere, and if need be I have run scenario tests where I can restore everything in a couple of hours if need be).

Advice?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Root privileges are needed for apt-get upgrade too, so:

sudo apt-get update && sudo apt-get upgrade
share|improve this answer
    
My apologies, it is working. Did this just get changed in an update? I never had to type sudo twice before... Response will get answer accepted. –  BMB Feb 24 '12 at 14:57
2  
I'm afraid you're wrong, && separates two commands and sudo applies to a single command (see man sudo) so if it did work before, it was surely for another reason. In other words sudo can't know if there's something after, only the shell can. –  cYrus Feb 24 '12 at 15:07
    
My apologies, I'd been on 3 hours of sleep over a 48 hour period due to work and school, and now looking back I think I had mis-typed it prior to trying a reboot, and then just "up arrowed" for command recall after reboot, which only brought back the same misguided attempt. Thank you for your input, I feel foolish... –  BMB Feb 24 '12 at 23:48

I had the same issue but it was a single installation command. Later after some searching I found that this issue can happen when another software is being installed either from the software manager or synaptic package manager. As ubuntu allows installing software only one at a time, hence the error. If the other installation is stuck or canceled, the process will still be blocked. In that case one can use the command

sudo fuser -vki /var/lib/dpkg/lock

to kill the process. I found this here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.