I am afraid of upgrading my Ubuntu because half of the time when I upgrade, I get a broken system that I must reinstall. So I always do it on weekends and very rarely.
I have a Dell XPS 13 9310 and the last two times I tried to upgrade I got a black screen while doing it, and had to reinstall Ubuntu, because it wouldn't boot anymore.
Are there tips so I can try to prevent this from happening again?
Before upgrading to a newer release disable third-party repositories (PPAs) with the following command:
Sometimes the upgraded system will contain many unnecessary files, config files which aren't working with the new system, etc. Config files which aren't working are identified by the Ubuntu installer when upgrading. When I upgraded from Ubuntu 18.04 to Ubuntu 20.04 it took about an hour and I received one notification about a config file that needed to be edited. I copy/pasted the suggested edit into a text file and edited the config file after the upgrade was completed. It should be noted that if I hadn't watched the terminal output for the entire hour that it took to upgrade to 20.04 I would have missed the suggested edit which worked perfectly.
After the upgrading process is completed run the following commands:
Re-enable third-party repositories with the following command, which will remove the
#
character from the lines that begin with deb.Change all instances of the old release codenames of the third-party repositories to the new release codenames. For example for an upgrade from Ubuntu 18.04 to Ubuntu 20.04 the old release codename is
bionic
and the codename of the upgraded release isfocal
. To change all instances of bionic to focal in third-party repositories run the following commands:If you get an error message like:
you will need to remove these repositories from your software sources with command(s) of the form:
For removing unnecessary files from the upgraded system I use the following commands:
sudo apt autoremove
sudo apt clean
deborphan
- Install this package management tool withsudo apt install deborphan
.Running these commands after upgrading takes me about 5 minutes. My workstation has a lot of installed software. If I had done a fresh install instead of an upgrade configuring all the installed applications on my workstation would have taken me 2-3 days.
A successful upgrade is almost entirely dependent of your level of understanding of the Ubuntu operating system. Problems caused by an upgrade can almost always be solved if you have the level of skill necessary to solve them. When I am upgrading Ubuntu I keep a second laptop running alongside the computer being upgraded, so that I can immediately search Ask Ubuntu for the solution as soon as something goes wrong.