Ubuntu – Software Center keeps crashing


Last week I typed in a command for /ect/apt/sources.list.d/playonlinux.list into my terminal and ever since then Ubuntu Software Center Keeps crashing.
The report says

<class System Error> (E:Type'<!DOCTYPE' ia not known on line 1 in source list /etc/apt/sources.list.d/playonlinux.list)

I need help to prevent it from crashing.

Best Answer

I'm pretty sure the problem is you've added an incompatible source or text was added to your /ect/apt/sources.list.d/ directory. It's causing problems updating your software repo cache. Remove the added file/sources, then you should be able to update (apt-get update) normally.

The error sounds like there's some type of HTML on line 1 of /etc/apt/sources.list.d/playonlinux.list that got in there somehow; that shouldn't be there. If you know what lines or sources were added, you can use any text editor to edit the source files (sudo nano /etc/apt/sources.list.d/playonlinux.list for example), or a file browser to remove the whole file if it doesn't belong there.

This apt-get command should help, "it updates the package cache and checks for broken dependencies." and might reproduce your error message:

  • sudo apt-get check

    When I added some junk to my sources.list, it gave me this helpful info, pointing to the file & line that had the first error (after fixing run it again in case there's more errors):

    $ sudo apt-get check
    Reading package lists... Error!
    E: Type '<bd' is not known on line 4 in source list /etc/apt/sources.list
    E: The list of sources could not be read.
    E: The package lists or status file could not be parsed or opened.

Or you can use GUI tools to manage them (may not work if they're corrupted with HTML now) see this link for help https://help.ubuntu.com/community/Repositories/Ubuntu

Or this link for help using command line / terminal tools https://help.ubuntu.com/community/Repositories/CommandLine

Be very careful with your software sources, I'd make a backup copy of everything in /ect/apt/sources.list and /ect/apt/sources.list.d/ first, just in case. Not knowing what your Ubuntu version is I'm not sure what the "defaults" should be, or whether you've added extra PPA's or other sources.

Backup the sources.list files

Just copy them to a backup folder somewhere, in your home folder, or this should work:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
sudo cp -R /etc/apt/sources.list.d /etc/apt/sources.list.d.old

Restoring the default Ubuntu sources.list

  • For Ubuntu, if you do this it should generate a new fresh sources.list file

    1. delete the old files (sudo rm /etc/apt/sources.list and sudo rm -R /etc/apt/sources.list.d but BACKUP FIRST).

    2. Then do either of:

      • Run the Software Sources (from the programs menu / dash, or sudo software-properties-gtk or sudo software-sources) select/check-mark some repos, pick a server and update.

      • OR Generate a new one at http://repogen.simplylinux.ch/ using your version & country (to pick local mirrors), then copy & paste it into your new sources.list with
        gksudo gedit /etc/apt/sources.list
        or in a terminal with
        sudo nano /etc/apt/sources.list

The site http://repogen.simplylinux.ch/ has a LOT of optional PPA's too, looks quite useful. [courtesy How do I restore the default repositories? ]

Related Question