Ubuntu 19.04 incorrect sources.list [duplicate]

I did an upgrade of Ubuntu on WSL from 18.10 to 19.04 with do-release-upgrade.

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco

But now I notice that repositories/sources.list are still pointing to cosmic.

$ grep -li cosmic /etc/apt/sources.list /etc/apt/sources.list* /etc/apt/sources.list*/*
/etc/apt/sources.list
/etc/apt/sources.list
grep: /etc/apt/sources.list.d: Is a directory
/etc/apt/sources.list.distUpgrade
/etc/apt/sources.list.save


$ grep -li disco /etc/apt/sources.list /etc/apt/sources.list* /etc/apt/sources.list*/*
grep: /etc/apt/sources.list.d: Is a directory 

So I guess something must have failed during the upgrade that I didn't notice.

How can I dig out any upgrade errors and fix them?
Where can I find the sources list for 19.04?


Solution 1:

Where can I find the sources list for 19.04?

Steps required:

  • Run these commands in WSL console only. Otherwise, the file/folder permissions will be incorrect. Also, use chmod to correct any file permission.
  • Open Ubuntu cloud image website: https://cloud-images.ubuntu.com/releases/19.04/release/
  • Download the ubuntu-19.04-server-cloudimg-amd64-root.TAR.XZ file. Because it is smaller than others ;)
  • Extract the /etc/apt folder with tar -xvf ubuntu-19.04-server-cloudimg-amd64-root.tar.xz etc/apt command. Do not add the leading slash in the folder path.
  • Now copy the sources.list file or any other required files as you need.

Solution 2:

If you just want to update your existing sources.list to point to the new distro after you've already upgraded, you can do this:

Warning: Tread carefully! Always backup your file first.

sudo sed -i "s/cosmic/$(lsb_release -cs)/" /etc/apt/sources.list

The form of the sed command is: "s/<old value>/<new value>/"

To backup your file first, you can simply do: sudo cp /etc/apt/sources.list ~/

You can also see this answer for an idea of what the sources.list should look like:

What is the correct output of cat /etc/apt/sources.list?

Solution 3:

By following the @Biswaprio's answer, here I put the content of sources.list file for ubuntu 19.04 so that others don't need to go through the whole process again.

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ disco main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ disco main restricted

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

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ disco universe
# deb-src http://archive.ubuntu.com/ubuntu/ disco universe
deb http://archive.ubuntu.com/ubuntu/ disco-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ disco-updates 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://archive.ubuntu.com/ubuntu/ disco multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco multiverse
deb http://archive.ubuntu.com/ubuntu/ disco-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-updates multiverse

## 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://archive.ubuntu.com/ubuntu/ disco-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu disco partner
# deb-src http://archive.canonical.com/ubuntu disco partner

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