-1

When I want to install any program on my Ubuntu, There comes an Error saying I have to add it to My repository, I find its PPA from launchpad.net and then type it in the terminal. it says the file is being imported, then after a while says: the file imported. Naturally, I have to update my repository now, but I can't. Yesterday when I tried to update it some errors were shown saying that some index files failed to download or 404 not found. I had some troubles with it and tried to fix it but couldn't. I worked on some codes in the terminal( I am new to this), and I think I made it worse, because now when I write sudo apt-get update in The Terminal, It shows a different message, here it is : E : the method driver /usr/lib/apt/methods/htt could not be found. Prior to this, I mean yesterday, I spent the whole day trying to fix it and read almost every single answer to any question asked about this issue but it didn't help. I tried to make changes to " Ubuntu software and update" but at the end when I wanted to save the changes made, through pressing " reload" a message would be shown saying " failed to download repository information, check your Internet connection, it was while I was sure that the I was connected to a WiFi network. I also tried to change the main server to a local server but at the end when saving there was the same problem. Briefly, I have just installed this windows and I don't know what to do, I can't even play music with this, niether I can download or install any apps, I really need your help. Thank you.

This is a copy of my terminal:

arash@arash-X450CC:~$ sudo apt-get update

E: The method driver /usr/lib/apt/methods/htt could not be found.

arash@arash-X450CC:~$ sudo apt-get install chrome

Reading package lists... Done

Building dependency tree       

Reading state information... Done

E: Unable to locate package chrome

arash@arash-X450CC:~$ ^C

arash@arash-X450CC:~$ ^C

arash@arash-X450CC:~$ sudo apt-get update

[sudo] password for arash: 

E: The method driver /usr/lib/apt/methods/htt could not be found.

arash@arash-X450CC:~$ sudo apt-get update

E: The method driver /usr/lib/apt/methods/htt could not be found.

arash@arash-X450CC:~$ sudo apt-get upgrade

Reading package lists... Done

Building dependency tree       

Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

arash@arash-X450CC:~$ sudo apt-get update

E: The method driver /usr/lib/apt/methods/htt could not be found.

arash@arash-X450CC:~$ apt-get upgrade

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 did the last part over. upgrade,update,upgrade. here is the result:

arash@arash-X450CC:~$ sudo apt-get upgrade

[sudo] password for arash: 

Reading package lists... Done

Building dependency tree       

Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

arash@arash-X450CC:~$ sudo apt-get update

E: The method driver /usr/lib/apt/methods/htt could not be found.

arash@arash-X450CC:~$ sudo apt-get upgrade

Reading package lists... Done

Building dependency tree       

Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

for example I want to install vlc player, here comes the output:

arash@arash-X450CC:~$ sudo apt-get install vlc

Reading package lists... Done

Building dependency tree       

Reading state information... Done

E: Unable to locate package vlc

I did the first part( writing the two commands in the terminal-before going to software and updates), here is the output:

arash@arash-X450CC:~$ cd /etc

arash@arash-X450CC:/etc$ sudo tar cjvf apt-back.tar.bz2

[sudo] password for arash: 

tar: Cowardly refusing to create an empty archive

Try 'tar --help' or 'tar --usage' for more information.

arash@arash-X450CC:/etc$ 


Then I went to software and updates, made sure those four parts you said are ticked in the checkboxes next to them, then went to the other tab, I mean other software, unticked all of them and pressed reload to save changes. But after a while there came an error. Here's the detailed error message:

W:Failed to fetch http://archive.ubuntu.com/ubuntu/dists/utopic/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.88.149 80]

, E:Some index files failed to download. They have been ignored, or old ones used instead.

here is the output after doing what you said

chmod +x myscript.sh

./myscript.sh


#!/bin/bash


mkdir ~/apt.back

cd ~/apt.back

sudo mv --backup=numbered /etc/apt/sources.list ../apt.back/

sudo mv --backup=numbered /etc/apt/sources.list.d/*list ../apt.back/

sudo apt-get update

step 1 this pic is for the first command. I did it with another name. First Image

step 2 the next pic. for the next step after pressing ctrl+o to save. then I pressed enter. Second Image

  • Your message is hard to read because you don't have any vertical white spaces (paragraphs). It's hard to tell where one thought starts and the other stops. You might be having a dns problem as a results of not being able to connect to the repositories. Copy and paste some of the exact error messages you are getting we could deal with each of the specific errors and get the issues resolved. You're making lots of generalizations. Whereas we need specifics, such as an attempt to install a specify program and the exact error message copied and pasted to your question. – L. D. James Sep 18 '16 at 15:50
  • okay, when I wanna update, heres the Error: E : the method driver /usr/lib/apt/methods/htt could not be found. – arash Sep 18 '16 at 15:54
  • Most likely you typed in sudo apt-get update to update. Can you copy at less the last 10 lines of code that appeared after you pressed ENTER and paste it into your question. Add it to the bottom of your question... also making a reference to the exact command you typed in. – L. D. James Sep 18 '16 at 16:02
  • When I press enter there comes only one line, the one i said. – arash Sep 18 '16 at 16:09
  • But before this problem, when I tried to update, there where other issues like : 404 package not found or some index files failed to download. – arash Sep 18 '16 at 16:10
2

Your repository is corrupted. You can fix this by bringing it back to the distribution defaults. The steps below will show how to do this. It will also include backing up the changes you've made so that once it's working you can systematically bring back your custom changes and identify which one(s) is breaking your system.

Make a backup of your current configuration

$ cd /etc
$ sudo tar cjvf apt-back.tar.bz2 ./apt

Now open the Software and Updates

(go to) System Settings -> (click) Software and Updates (click the tab) Ubuntu Software -> (check mark the first 4 items) -> (click the tab) Other Software -> (Remove all check marks)

Close the software center.

Install VLC with

$ sudo apt-get update
$ sudo apt-get install vlc

Restoring your other custom PPA's:

Now for the Other Software items you have custom added, you can bring them back one at a time by placing a check mark on the desired one. If one breaks the system, then leave it out and deal with it individually.

Some of them might be obviously a good one, like Googe Chrome.


Create and run this script to clean out your apt folder. It will backup your files so that you can restore them after it's working.

You can create the script by running:

$ nano myscript.sh

Then copy and past the code below into the editor. Save the script. Then run this to make it executable.

$ chmod +x myscript.sh

Run the script by:

$ ./myscript.sh

The code for the script:

#!/bin/bash

mkdir ~/apt.back
cd ~/apt.back
sudo mv --backup=numbered /etc/apt/sources.list ../apt.back/
sudo mv --backup=numbered /etc/apt/sources.list.d/*list ../apt.back/
sudo apt-get update

After running the script your repository will be empty. Now run the Software updates and checkmark the first 4 items in the Ubuntu Software tab.

Then install vlc with:

$ sudo apt-get update
$ sudo apt-get install vlc
  • I did what you said step by step, when I did the first part(writing the commands in the terminal-before going to software and updates) The output was weird. I copied it to the question. – arash Sep 18 '16 at 19:06
  • I think it has problems with my IP, Would it be useful if I change it? If yes, how can I change it? – arash Sep 18 '16 at 19:29
  • @arash I updated the tar command. It should work now. Are you sure you unchecked all the items in the Other Software list? – L. D. James Sep 18 '16 at 20:32
  • yes I am sure on that. I guess that might be because of my IP, is it possible to change my IP address? – arash Sep 19 '16 at 5:51
  • There's a new section in the answer. Follow the steps in Create and run this script. Post the output of the script. Your current files will then be backed up to an apt.back folder in your home directory. You fix those files at a different time and move them back to your repository after the repository is working. – L. D. James Sep 19 '16 at 10:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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