3

This has happened twice where I followed instructions on installing software and then having the software center open then close immediately as a result of running the commands from the instructions. The first incident happened when I was trying to install Mono. I followed their instructions up to sudo tee /etc/apt/sources.list.d/mono-xamarin.list. The terminal stopped was not responding so I put the command back in and it just echoed it. So I closed it and tried it again with no luck. So then I wanted to check if the software center had just the Mono cs compiler and that's when the software center started closing immediately after opening and ubuntu gave me this error

E: Type 'sudo' is not known on line 2 in the source list /etc/apt/sources.list.d/mono-xamarin.list
E: The list of sources could not be read
E: The package lists or status file could not be parsed or opened.

I formatted my computer back to an earlier backup being unable to find an answer to this error and not knowing what I did wrong.

Now I tried installing Spotify and they have a similar list of instructions.

  1. Add the Spotify repository

    echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
    

So I did until this point where the terminal was not responding again. I tried 'exit' to close it, but it just echoed the command. After I manually closed it, I checked the software center to see if I had done the same thing again, and I did. Software center will not stay open and returned this same error when I try apt-get autoremove

E: Type 'exit' is not known on line 1 in source list /etc/apt/sources.list.d/spotify.list
E: The list of sources could not be read.
E: The package lists or status file could not be parsed or opened.

My first question is how do I remove/repair the list, and my second is how do I use sudo tee... properly?

muru
  • 207,228

2 Answers2

1

Your first command

sudo tee /etc/apt/sources.list.d/mono-xamarin.list

is wrong. The command waits for an input and writes into

/etc/apt/sources.list.d/mono-xamarin.list

Therefore simply remove the file

sudo rm /etc/apt/sources.list.d/mono-xamarin.list

and start the correct command again and don't forget the

sudo apt-get update

Your second command

echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

is correct. After this command you have the line

deb http://repository.spotify.com stable non-free

in your /etc/apt/sources.list.d/spotify.list. Check with

cat /etc/apt/sources.list.d/spotify.list

The command tee read from standard input and write to standard output and files. Two examples

echo "foo" | tee bar

writes the string foo into the file bar. The previous content will be overwritten.

echo "foo" | tee -a bar

appends the string foo to the given file.

The command tee bar reads from the standard input and writes into the file bar

Start a test with

tee bar

Type some words and stop with Ctrl-C. Now start

cat bar

to see your changes.

Example

% tee bar
foo
foo
bar
bar
^C
% cat bar
foo
bar
A.B.
  • 92,125
0

I think I figured it out. I went to 'other software' in software and updates and removed the misbehaving repository from the list. Then I did sudo apt-get autoremove which it didn't stop at the error this time so I was able to process to sudo apt-get update and I was able to open the software center again and keep it open. I still get the class system error saying 'exit' is not know on line 2 in spotify.list. I still don't know how to remove that.