Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Error when enter a command - Permission denied, are you root?

I tried to install gcc and other packages on ubuntu booted from a live usb stick. All I see is the following error

ubuntu@ubuntu:~$ apt-get install gcc
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?   

I think this might be because I have not installed ubuntu on my system, its just booted from a usb stick. If that is really the problem here then could someone please give me a solution to install packages in such a scenario. I cannot install ubuntu on my system as I dont have any free partition and I cannot delete the existing ones as I don't have an external storage device to back up my data. Thank you.

share|improve this question

marked as duplicate by gertvdijk, hhlp, Ringtail, stephenmyall, Raja Jan 2 '13 at 16:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

if you have space free on an existent partition, the ubuntu installer can resize it and make another partition using the freed space (or you can do that manually with gparted from your live USB). – laurent Jan 2 '13 at 12:32

You need to use sudo apt-get install gcc or sudo apt-get install build-essential

obs: the error message asks "are you root?". You need to be root or use sudo to use the apt-get command.

share|improve this answer

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