Is editing sources.list a good idea?
This doubt is hitting me since 2-3 days, so I decided to test it myself. What I did is I installed Ubuntu 16.04.4 in VMWare and edited /etc/apt/sources.list
and replaced xenial
with bionic
using:
sudo sed -i 's/xenial/bionic/g' /etc/apt/sources.list
Then I ran
sudo apt-get update && sudo apt-get upgrade
I was able to upgrade to 18.04, confirmed by using lsb_release -a
. However, I encountered some problems like:
apt does not have a stable CLI interface. Use with caution in scripts.
unmet dependency of python3-aptdaemon.pkcompat
Release 'bionic-backports' for 'appstream' not found
Broken Unity
I solved all the errors and installed gnome
and gdm3
.
So, I just want to know is it a good idea to edit sources.list
? I know that my system might broke but is there any other specific reason not to use this.
Note: I tested this on Ubuntu 16.04 in VMWare to clear my doubts only.
Solution 1:
Editing /etc/sources.list
is one step to migrate to a subsequent release in Debian...but not in Ubuntu. You can still use it, but it's not recommended because most users shouldn't need to deal with precisely the problems you encountered.
Instead, Ubuntu provides a tool (the do-release-upgrade
command) that will properly change the sources, download and install the upgrade, and remove orphans, all in a predictable and reproducible way to prevent corner-case problems. This tool is the recommended way to upgrade to a newer release of Ubuntu.
Solution 2:
I will use term "source version" for the version that you have used before upgrading and the "destination version" for the version that you have used after upgrading.
Ways of upgrading Ubuntu versions:
First way: Editing sources.list
Commonly called Debian way of upgrading or sometimes, The Brute Force Method.
This way:
- Makes your system supplied by packages of destination version.
- Some third-party repositories might not have the channel for destination version, so you occasionally encounter unmet dependencies problem and in all cases you cannot upgrade the packages to newer version. (For example,
wine-hq
repository only recently added support for Bionic).- You will not be able to complete updating your repository without removing third-party repositories, as you will experience
404 Not found
error.
- You will not be able to complete updating your repository without removing third-party repositories, as you will experience
Some notes: Disable third-party repository.
Works: It either works or not.
Recommendation level: too low.
Second way: Doing do-release-upgrade:
Commonly called Ubuntu way of upgrading:
This way:
- For repositories:
- Switches to
sources.list
new repository entries - Automatically removes obsolete entries
- For packages:
- Removes possible broken packages
- Updates packages index (equivalent to
sudo apt full-upgrade
) - Upgrades system (equivalent to
sudo apt full-upgrade
) - Removes old packages:
- Old kernels
- Packages existed in the source version of Ubuntu, but not existed in the destination version.
- Deals with Nvidia Drivers.
- Release specific jobs:
- Plays with some configurations
- Runs release specific scripts:
- For example, replaces Unity Desktop with Gnome Desktop.
However, a lot of people are experiencing problems with do-release-upgrade
:
Works: It works... with bugs.
Recommendation level: between low and middle.
Third way: Clean Install
This is the most recommended way of upgrading your system.
Note #1: Do not forget to Backup.
Note #2: You will most likely spend equal time to fix errors called by above-mentioned methods. If so, why hesitating to do a clean installation?
Works: Always works.
Recommendation level: very high.