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

I am new to Linux, can anyone be kind enough to help me know how to install software from the terminal?

I tried to install java by entering the command in the terminal

sudo apt-get install openjdk-7-jdk

but i get errors ,

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 also tried root

su -

but it says that the password is incorrect, so what is root ?

Advance Thanks for the help Guys.

share|improve this question
up vote 1 down vote accepted

By using sudo, you are temporarily becoming root for the duration of that command, just like you'd switched to root with su - root, executed the command, and switched back with exit.

Out of the box, Ubuntu doesn't configure a password for root, so you cannot log in as root directly like you're attempting to do with su. You either have to use sudo, or configure a password for the root user. It is recommended that you simply use sudo.

Are you sure you used sudo when trying to run the install command?

share|improve this answer
To summarize, are you sure you used sudo when you ran the first command? If so, then maybe another package manager is running at the same time, though this seems unlikely. – thomasrutter Mar 18 '13 at 1:21
Thanks, that worked. – Raviteja Mar 18 '13 at 7:53

You will get that error if you have the gui (graphic user interface) open. Check the desktop, is synaptic package manager open?

share|improve this answer

Your Answer


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.