5

This question already has an answer here:

I ran into some problems with 14.04 version of Ubuntu Gnome. I couldn't run updates for weeks and whenever I tried I was greeted with the response "Check your internet connection". I found a lot of solutions for the problem here but they didn't work for me. So, I upgraded to 16.04 this morning using a bootable USB and I chose the option to upgrade rather than clean up my HDD. On the newer version, I indeed tried to update it but I got this error now...

sudo apt-get update
E: Malformed entry 63 in list file /etc/apt/sources.list (Component)
E: The list of sources could not be read.

When I ran the following command, I got this output

find /etc/apt/  -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list.d/staticfloat-ubuntu-julia-deps-xenial.list

     1  deb http://ppa.launchpad.net/staticfloat/julia-deps/ubuntu xenial main
     2  # deb-src http://ppa.launchpad.net/staticfloat/julia-deps/ubuntu xenial main

/etc/apt/sources.list

     1  # deb cdrom:[Ubuntu-GNOME 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160720)]/ xenial main multiverse restricted universe
     2  # deb cdrom:[Ubuntu-GNOME 14.04 LTS _Trusty Tahr_ - Release i386 (20140416.2)]/ trusty main multiverse restricted universe
     3  
     4  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     5  # newer versions of the distribution.
     6  deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
     7  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
     8  
     9  ## Major bug fix updates produced after the final release of the
    10  ## distribution.
    11  deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    12  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    13  
    14  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    15  ## team. Also, please note that software in universe WILL NOT receive any
    16  ## review or updates from the Ubuntu security team.
    17  deb http://de.archive.ubuntu.com/ubuntu/ xenial universe
    18  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial universe
    19  deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe
    20  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe
    21  
    22  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
    23  ## team, and may not be under a free licence. Please satisfy yourself as to 
    24  ## your rights to use the software. Also, please note that software in 
    25  ## multiverse WILL NOT receive any review or updates from the Ubuntu
    26  ## security team.
    27  deb http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
    28  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
    29  deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    30  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    31  
    32  ## N.B. software from this repository may not have been tested as
    33  ## extensively as that contained in the main release, although it includes
    34  ## newer versions of some applications which may provide useful features.
    35  ## Also, please note that software in backports WILL NOT receive any review
    36  ## or updates from the Ubuntu security team.
    37  deb http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    38  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    39  
    40  deb http://de.archive.ubuntu.com/ubuntu/ xenial-security main restricted
    41  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-security main restricted
    42  deb http://de.archive.ubuntu.com/ubuntu/ xenial-security universe
    43  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-security universe
    44  deb http://de.archive.ubuntu.com/ubuntu/ xenial-security multiverse
    45  deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-security multiverse
    46  
    47  ## Uncomment the following two lines to add software from Canonical's
    48  ## 'partner' repository.
    49  ## This software is not part of Ubuntu, but is offered by Canonical and the
    50  ## respective vendors as a service to Ubuntu users.
    51  deb http://archive.canonical.com/ubuntu xenial partner
    52  deb-src http://archive.canonical.com/ubuntu xenial partner
    53  
    54  ## This software is not part of Ubuntu, but is offered by third-party
    55  ## developers who want to ship their latest software.
    56  deb http://extras.ubuntu.com/ubuntu xenial main
    57  deb http://archive.canonical.com/ xenial partner
    58  # deb-src http://archive.canonical.com/ trusty partner
    59  deb-src http://extras.ubuntu.com/ubuntu xenial main
    60  deb http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu xenial main
    61  # deb-src http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu trusty main
    62  # deb-src http://archive.ubuntu.com/ubuntu trusty universe
    63  deb http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu xenial
    64  # deb-src http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu trusty/
    65  
    66  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    67  # newer versions of the distribution.
    68  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
    69  
    70  ## Major bug fix updates produced after the final release of the
    71  ## distribution.
    72  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    73  
    74  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    75  ## team, and may not be under a free licence. Please satisfy yourself as to
    76  ## your rights to use the software. Also, please note that software in
    77  ## universe WILL NOT receive any review or updates from the Ubuntu security
    78  ## team.
    79  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial universe
    80  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe
    81  
    82  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
    83  ## team, and may not be under a free licence. Please satisfy yourself as to 
    84  ## your rights to use the software. Also, please note that software in 
    85  ## multiverse WILL NOT receive any review or updates from the Ubuntu
    86  ## security team.
    87  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
    88  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    89  
    90  ## N.B. software from this repository may not have been tested as
    91  ## extensively as that contained in the main release, although it includes
    92  ## newer versions of some applications which may provide useful features.
    93  ## Also, please note that software in backports WILL NOT receive any review
    94  ## or updates from the Ubuntu security team.
    95  # deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    96  
    97  ## Uncomment the following two lines to add software from Canonical's
    98  ## 'partner' repository.
    99  ## This software is not part of Ubuntu, but is offered by Canonical and the
   100  ## respective vendors as a service to Ubuntu users.
   101  # deb http://archive.canonical.com/ubuntu xenial partner
   102  # deb-src http://archive.canonical.com/ubuntu xenial partner
   103  
   104  deb http://security.ubuntu.com/ubuntu xenial-security main restricted
   105  # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
   106  deb http://security.ubuntu.com/ubuntu xenial-security universe
   107  # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
   108  deb http://security.ubuntu.com/ubuntu xenial-security multiverse
   109  # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

Could you please suggest what can be done to fix these problems?

marked as duplicate by karel, David Foerster, Pilot6, Fabby, Eric Carvalho Feb 6 '17 at 23:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

12

The lines of interest are:

63  deb http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu xenial
64  # deb-src http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu trusty/

As the error says, you're missing a component (the main, universe, etc. of other repos). However, the CRAN mirrors don't have components, and instead use a trivial repo, so you need to have a trailing / there like the trusty line:

deb http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu xenial/
  • Thanks for the answers @muru, cl-netbox, but, the problem "Failed to download repository, check internet connection" still persists. – crypto Feb 6 '17 at 16:32
  • That would be a different error. – muru Feb 6 '17 at 22:51
5

Correct the wrong entries in the /etc/apt/sources.list file.

Open a terminal and execute the following command :

sudo nano /etc/apt/sources.list  

Remove lines 63 and 64 in the /etc/apt/sources.list file.

Press Ctrl + X to close the file, confirm the change with Y.

Now re-add the repository to the software sources :

sudo nano /etc/apt/sources.list.d/star-st-andrews.list  

Add the following lines (entries) to the empty file :

deb http://www-star.st-and.ac.uk/cran/bin/linux/ubuntu/ xenial/
# deb-src http://www-star.st-and.ac.uk/cran/bin/linux/ubuntu/ xenial/

Press Ctrl + X to close the file, confirm the change with Y.

Reference: CRAN Repositories

If you are still getting an error message when updating the software sources, you should check the /etc/apt/sources.list file and the /etc/apt/sources.list.d folder for other wrong entries. Generally it is recommended to remove external sources before upgrading a system. After the upgrade re-add the sources, which leads to the correct entry in the correct place.

Note: In newer Ubuntu editions the /etc/apt/sources.list file is used for Ubuntu sources.
All external software sources reside as a .list file in the /etc/apt/sources.list.d folder.

  • Why do you recommend removing the two lines, instead of fixing the syntax error ? The repository might be needed by the system. – Soren A Feb 6 '17 at 9:25
  • Line 64 is commented out, so it don't interfere with the update. Look at the answer above concerning the problem with line 63 !! – Soren A Feb 6 '17 at 9:32
  • @SorenA I saw that line 64 is commented out, but line 64 still is wrong. Something went wrong during the upgrade process ... as I wrote, generally it is recommended to remove external sources before upgrading a system - afterwards the external source can be re-added. Thanks for your contribution, I have updated the answer accordingly, also pointed to the correct file location for external software sources - better now ? :) – cl-netbox Feb 6 '17 at 9:52
  • A little, but I still think that @muru's answer is more correct. – Soren A Feb 6 '17 at 9:56
  • @SorenA : Maybe ... yes, it solves the problem as well, but my answer leads to 100 % correct entries. :) – cl-netbox Feb 6 '17 at 9:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.