Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've installed Ubuntu recently and I've been trying to install some programs using apt-get but it never seems to work, not even apt-get update works, here's what I get when I try to install something, in this case: java's jdk-7 using:

apt-get install openjdk-7-jre-headless

here's what I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
mkhas@mkhas-Inspiron-3520:~/Downloads$ sudo apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  ca-certificates-java icedtea-7-jre-jamvm java-common openjdk-7-jre-lib tzdata-java
Suggested packages:
  default-jre equivs sun-java6-fonts ttf-dejavu-extra fonts-ipafont-gothic
  fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts
  ttf-bengali-fonts
The following NEW packages will be installed:
  ca-certificates-java icedtea-7-jre-jamvm java-common openjdk-7-jre-headless
  openjdk-7-jre-lib tzdata-java
 0 upgraded, 6 newly installed, 0 to remove and 24 not upgraded.
 Need to get 44.1 MB of archives.
 After this operation, 63.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
 WARNING: The following packages cannot be authenticated!
   openjdk-7-jre-lib ca-certificates-java tzdata-java java-common openjdk-7-jre-         headless
  icedtea-7-jre-jamvm
Install these packages without verification [y/N]? y
0% [Connecting to lb.archive.ubuntu.com (91.189.91.13)] 

And it just get stuck at 0%

Edit: Yes, the internet is working fine on my system.

One thing I tried is changing the mirror server from which it's supposedly retrieving the packages from lb.archives.ubuntu.com to archives.ubuntu.com in /etc/apt/sources.list but it says that that file is read only and I can't make any changes to it.

I tried updating apt-get through

apt-get update 

but I get this whenever I try to do that:

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
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?

EDIT: Issue resolved, I wasn't using sudo apt-get update and was only using apt-get update

share|improve this question

migrated from serverfault.com May 8 '13 at 17:43

This question came from our site for professional system and network administrators.

    
is internet working on your system? –  Abhishek Anand Amralkar May 8 '13 at 10:02
    
Are you using sudo apt-get update ? –  NickW May 8 '13 at 10:07
1  
For the moment, your initial apt-get install is still locking those files, do a sudo ps ax | grep apt and you should see the process that is locking those files. Try and kill -TERM the PID, if not, do a kill -9.. then run sudo apt-get update –  NickW May 8 '13 at 10:23
add comment

1 Answer 1

The apt-get command requires root privileges, so you need to run it with sudo. For example:

sudo apt-get update

Then you can install your packages:

sudo apt-get install openjdk-7-jre-headless
share|improve this answer
add comment

Your Answer

 
discard

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