0

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

L. D. James
  • 25,036
arash
  • 21
  • 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
  • During the process of update some of the repository addresses do change and will give that error. But subsequent apt upgrade and apt update will automatically fix the proper repository addresses. We could tell better what's happening if we could see a few lines at least 10 of the lines exactly the way it appears on your screen. – L. D. James Sep 18 '16 at 16:19
  • Will you perform these commands and copy and paste the output to the bottom of your question. sudo apt-get upgrade then sudo apt-get update then apt-get upgrade. Notice there is two upgrade commands. One of the upgrades may fix the links then the next update will rebuild the your repository cache. – L. D. James Sep 18 '16 at 16:19
  • By the way, if the problem is related to your dns (internet configuration) we should be able to tell by the exact output on your console. – L. D. James Sep 18 '16 at 16:21
  • I captured a picture from the terminal, you might want to take a look at it, I sent it to your email address. – arash Sep 18 '16 at 16:27
  • How can I know if the problem is with my dns? – arash Sep 18 '16 at 16:27
  • You will have to copy and paste the output to your question so that others can participate, assist in the fix and benefit from the resolution. As far as DNS, you could probably spend a lot of time studying networking, or you can provide us with the exact errors you're getting and we could tell and advise you how to resolve your issue. – L. D. James Sep 18 '16 at 16:31
  • I added a copy of what you said. Now what to do?\ – arash Sep 18 '16 at 16:38
  • The last command apt-get upgrade command was missing the sudo. Can you execute it again and add the output to your question? Also, there's a change the repository that you tried to add might be broken. I'll be able to tell this by the output that you show. As far as DNS, I can't see that you are not having a problem with that. – L. D. James Sep 18 '16 at 16:45
  • I did what you said over. upgrade,update,upgrade. copied it to the question – arash Sep 18 '16 at 16:50
  • The last command in your question is showing apt-get upgrade and the output of that. It needs to be sudo apt-get upgrade and the output of that. – L. D. James Sep 18 '16 at 16:54
  • What is the name of the application that you are trying to install with this ppa? – L. D. James Sep 18 '16 at 16:57
  • Also, what is the ppa link that was provided by launchpad.net? – L. D. James Sep 18 '16 at 16:59
  • I can't install any application. For example I want to install vlc player. It should be said that I can't even install applications from ubuntu software center. – arash Sep 18 '16 at 16:59
  • Run this: sudo apt-get install vlc. Please add the output of that to your question. – L. D. James Sep 18 '16 at 17:01
  • I did what you said. – arash Sep 18 '16 at 17:08
  • Thanks the problem and resolution is clear. Give me a minute to provide you with easy to follow steps for the resolution. – L. D. James Sep 18 '16 at 17:09
  • A few more minutes. I'm testing the resolution. – L. D. James Sep 18 '16 at 17:43
  • I have provided an answer with formatted steps to resolve your issue. – L. D. James Sep 18 '16 at 17:51
  • Comments are not for extended discussion; this conversation has been moved to chat. – Thomas Ward Sep 19 '16 at 13:51

1 Answers1

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
L. D. James
  • 25,036
  • 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 05: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
  • I opened the terminal and wrote the first command, then wrote the second command and pressed ctrl+O to save, It said that the file name is myscript.sh I presses enter, but when I tried to open it by writing ./my script.sh down, it said 'permission denied' – arash Sep 19 '16 at 21:15
  • @arash Before executing the script you have to run this on the script: chmod +x myscript.sh. – L. D. James Sep 19 '16 at 21:19
  • I got an output. will write it in the question – arash Sep 19 '16 at 21:22
  • @arash There's something missing. Looking at what you posted I can only see the commands. There should have been something else displayed on your screen... either error messages or some update. Especially after the last command which is sudo apt-get update. – L. D. James Sep 19 '16 at 21:28
  • what should I do now? – arash Sep 19 '16 at 21:30
  • What did you see on the screen after you executed this command: ./myscript.sh? What did you see between the command and the prompt that came after you ran the command? – L. D. James Sep 19 '16 at 21:32
  • Comments are not for extended discussion; this conversation has been moved to chat. – Seth Sep 19 '16 at 21:41
  • Please look at the question now Then after pressing enter nothing happened so I wrote the next command ./myscript.sh but nothing happened again. the I added the other command, I mean the large one and you saw the output(in the question) – arash Sep 19 '16 at 21:48
  • Please use the link moved to chat, posted by Seth for update questions and comments on implementing the answer. – L. D. James Sep 19 '16 at 21:56