APT sources.list corrupted

Asked by thgang

Hello,

I've only been using Xubuntu for a couple of weeks now, so I apologise if I'm not I'm having some problems opening the 'Add/Remove' package and 'Synaptic Package Manager'.

The error that comes up with is:

'E: Type ‘rm’ is not known on line 58 in source list /etc/apt/sources.list
E: The list of sources could not be read.
Go to the repository dialogue to correct the problem.
E: _cache->open() failed, please report.

I've tried to type the command 'sudo apt-get -f install' as I've seen it in the other questions but the error that crops up is similiar to the above:

E: Type ‘rm’ is not known on line 58 in source list /etc/apt/sources.list
E: The list of sources could not be read.

Any help would be great!!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
thgang
Solved:
Last query:
Last reply:
Revision history for this message
Ralph Janke (txwikinger) said :
#1

Thanks for your question.

There is something wrong on line 58 of the file /etc/apt/sources.list.

Probably something was inadvertently entered there. Edit the file with an editor of your choice, but make sure you start the editor with sudo.

If you like you can also paste the file here and we can tell you want to delete.

Thanks

Revision history for this message
thgang (thgang) said :
#2

Hi Ralph,

Thanks for the reply.

To the best of my knowledge, I have not touched this file but I guess thats technology for you. I'm afraid I do not know how to edit the file and what editor to use, could you please elaborate on this and tell me how I can get to the file.

Thankyou

Revision history for this message
M Hickford (hickford) said :
#3

an easy text editor to use is gedit. /etc/apt/sources.list is a system file, so you'll need to run the editor as root, ie.

gksudo gedit /etc/apt/sources.list &

Inspect the file, all lines should resemble something like

deb http://archive.ubuntu.com/ubuntu feisty main restricted multiverse universe
deb-src http://archive.ubuntu.com/ubuntu feisty main restricted multiverse universe

(these are from my sources.list)

Lines are off the form type of repository (deb OR deb-src (source)), URL, list of sections

Lines beginning with a # are comments.

Comment out line 58 and any other erratic lines.

Matt

Revision history for this message
thgang (thgang) said :
#4

The text editor does not work, I've tried it several times. Is there any other way to get to the file.

Revision history for this message
Ralph Janke (txwikinger) said :
#5

try to use

sudo nano /etc/apt/sources.list

Revision history for this message
thgang (thgang) said :
#6

Yes, I've found the file. It seems very complicated, and I do not know which part to copy. I can see the comments at the start but after this, it becomes a blurb of coding which I don't know whether it is important or not.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#7

Paste it all. You can also use pastebin (http://pastebin.com/) and we will show you what to correct. Just give us the URL of the page pastebin created.

Revision history for this message
thgang (thgang) said :
#8

I hope I've done this right!!

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse

#AUTOMATIX REPOS START

deb http://wine.lowvoice.nl/apt feisty main

deb http://www.getautomatix.com/apt feisty main

deb http://archive.canonical.com/ubuntu feisty-commercial main

deb http://archive.ubuntu.com/ubuntu feisty-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu feisty-updates universe multiverse

deb http://archive.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
rm #we dont need it anymore, so conserve disk space

   #

Revision history for this message
Cesare Tirabassi (norsetto) said :
#9

Remove these lines:

rm #we dont need it anymore, so conserve disk space
   #

I take the occasion to remind you that automatix is not supported by ubuntu.
Unfortunately it causes corruptions and may hinder updates/upgrades.

Revision history for this message
thgang (thgang) said :
#10

Sorry, but I'm having some trouble removing the lines permanently. Could you just explain this.

Revision history for this message
Ralph Janke (txwikinger) said :
#11

Open the file with

sudo nano /etc/apt/sources.list

Go down to the lines to be deleted. Delete them, save and exit with ctrl-x

Revision history for this message
Cesare Tirabassi (norsetto) said :
#12

As Ralph told you, use:

sudo nano /etc/apt/sources.list

Make the changes.
Press CTRL-X, when asked to "Save modified buffer?" answer Y
Use the same file name (/etc/apt/sources.list)
If asked to confirm the overwrite answer Y

Revision history for this message
thgang (thgang) said :
#13

I made the changes and saved it. I tried to see if it worked by running the 'Add/Remove' Package, but it didn't work.
I restarted my PC, to see whether the changes would take effect, but no such luck.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#14

Do you mean you see the same error or is there a new one?
If you still see the same error then the file was either not edited or not save correctly. In this case paste it here again.

Revision history for this message
thgang (thgang) said :
#15

Yes actually, it's a new one, the error showing up is:

E: Line 1 too long in source list /etc/apt/sources.list.
E: The list of sources could not be read.
Go to the repository dialogue to correct the problem.
E: _cache->open() failed, please report.

The /etc/apt/sources.list reads:

OBOB# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse

#AUTOMATIX REPOS START

deb http://wine.lowvoice.nl/apt feisty main

deb http://www.getautomatix.com/apt feisty main

deb http://archive.canonical.com/ubuntu feisty-commercial main

deb http://archive.ubuntu.com/ubuntu feisty-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu feisty-updates universe multiverse

deb http://archive.ubuntu.com/ubuntu feisty-security main restricted universe multiverse

Revision history for this message
Cesare Tirabassi (norsetto) said :
#16

Yes, when you edited the file you have inserted these characters on the first line:

OBOB

Just delete them, check that there is no other mistake, and you should be ready to go.

Revision history for this message
thgang (thgang) said :
#17

No, it still isn't working. I deleted that as well as checking I didn't make any other mistakes.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#18

Just telling us isn't working or I still have a problem is not helping.
Tell us what kind of error message you are getting, if any.

Revision history for this message
thgang (thgang) said :
#19

Sorry for being vague. Basically, it still gives the same error code after I made the first set of changes. The error code is:

E: Line 1 too long in source list /etc/apt/sources.list.
E: The list of sources could not be read.
Go to the repository dialogue to correct the problem.
E: _cache->open() failed, please report.

Thanks

Revision history for this message
Ralph Janke (txwikinger) said :
#20

Just delete the first couple of lines. They don't do anything anyway (everything starting with # is a comment)

Revision history for this message
Cesare Tirabassi (norsetto) said :
#21

Then, again, the file is corrupted. If you open it you will see that the first line will not be ok.
Lets do it the other way around.
Copy the text here below (do NOT include the --- CUT HERE --- lines) and paste it in a new file (call it foo):

--- CUT HERE ---
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse
--- CUT HERE ---

Save the file. Check that the file content is equal to the text above (do it with a cat foo command).
If you are happy give this command: sudo mv -f foo /etc/apt/sources.list
Check again that /etc/apt/sources.list is ok (again with a cat /etc/apt/sources.list command) and give the command:

sudo apt-get update

If you get an error check again the file and come back to me with the error.

Revision history for this message
thgang (thgang) said :
#22

Ok, I'm a beginner, so don't know how to create the file, do I paste it into mousepad?, could you elaborate on this please. Sorry about this!!

Revision history for this message
Cesare Tirabassi (norsetto) said :
#23

Don't be sorry.
Lets do it simpler. Open the file with the command:

sudo mousepad /etc/apt/sources.list

delete everything in that file. Killl them all, shred them to pieces (I don't know mousepad, so I don't know how exactly you would do it, try selecting all and then deleting with the DEL key).
Now copy the text I've given you and paste it in mousepad. Check everything is ok, save it.
Check again with a cat /etc/apt/sources.list, if looks good give the command: sudo apt-get update

Revision history for this message
thgang (thgang) said :
#24

I've done exactly what you said, I ran the command '/etc/apt/sources.list' and the terminal goes through coding before it disappears. I then put the command 'sudo apt-get update' but an error shows, this is:

E: Line 1 too long in source list /etc/apt/sources.list.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#25

I'm afraid then that there is nothing we can do any further for you.
Unfortunately I believe that installing automatix broke your system, the only thing I can suggest you is to remove automatix:

sudo apt-get remove --purge automatix

I would encourage you to be careful in installing non-ubuntu packages in the future.

Revision history for this message
thgang (thgang) said :
#26

I realise that automatix is a problem, and i will remove it as soon as possible, but at the moment I cannot remove or install anything because of the sorces.list.

The error message that is showing (whether I'm running the command to remove automatix 'sudo apt-get remove --purge automatix' or running the 'Add/Remove' application) is:

E: Line 1 too long in source list /etc/apt/sources.list.
E: The list of sources could not be read.

Go to the repository dialogue to correct the problem.
E: _cache->open() failed, please report.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#27

Is it the same if you give this command:

sudo dpkg -r --purge automatix

or even

dpkg -r --purge --force-all automatix

?

Revision history for this message
Marc Fournier (mfournier) said :
#28

Let's try something else. First make a copy of your sources.list:

sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup

Then this command should repair your source list. Copy paste it in a terminal (all in one block without modifying anything). It will prompt you for your password. You can run it several times if not sure about what happened:

cat << EOF | sudo tee /etc/apt/sources.list
deb http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
deb http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
EOF

Then to try to repair dpkg database, please run:

sudo apt-get update
sudo apt-get -f install
sudo apt-get --purge remove automatix

Hope this helps ! Let us know !
Marc

Revision history for this message
thgang (thgang) said :
#29

Hi Marc,

Marc, you are my knight in shining armour. Thankyou very much, I have tried so hard to get this fixed and everybody that has replied (especially Cesare Tirabissi) have been very helpful.

Everything works fine now, and I know that I won't be installing Automatix or other software which might be dangerous again!!!

Thanks Again,
Andy

Revision history for this message
Best thgang (thgang) said :
#30

a

Revision history for this message
fusion (fusion-fake) said :
#31

thanks allot marc : ) had similair problem

Revision history for this message
AstroTurf (suspibor) said :
#32

Hello I think you have solved my problem
Th alot

Revision history for this message
Rizwan Hassan Malik (rhmalik) said :
#33

Thanks alot guys your solution helped my problem as well. Though I could not undertand what it did,. but it worked . I did this :-
sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup

Then this command should repair your source list. Copy paste it in a terminal (all in one block without modifying anything). It will prompt you for your password. You can run it several times if not sure about what happened:

cat << EOF | sudo tee /etc/apt/sources.list
deb http://gb.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
deb http://gb.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
EOF

Then to try to repair dpkg database, please run:

sudo apt-get update
sudo apt-get -f install
sudo apt-get --purge remove automatix

thanks alot guys

Revision history for this message
maithili (shalu0032) said :
#34

If the error is "no MPM package installed" when you restart your apache or type '' is not known on line 1 in /etc/apt/sources.list, then go to system->administrator->synaptic packege manager->settings->repositories->select all in ubuntu software and updates and then close it.It will update all the missed packeages.Then you can install apache2 and its MPM packages