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,444
arash
  • 21

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,444