When you start using Ubuntu or an Ubuntu-based distribution, soon you’ll find yourself using apt commands to install software like this:
sudo apt install package_name
You’ll probably also install additional software using the 3-step PPA command:
sudo add-apt-repository ppa:PPA_Name/ppa
sudo apt update
sudo apt install package_from_ppa
And when you start adding random external repositories, you’ll encounter update errors sooner or later.
Now, you can search for the error on the internet and perhaps fix it as well. Most of the time, you won’t understand what causes the problem and how it was fixed.
But if you understand the repository mechanism in Ubuntu, you’ll understand the root cause of the problem and fix it accordingly.
You might find all this information in fragments on It’s FOSS and various forums. But the fragmented information is not easy to understand.
Hence, I created this page to give you a comprehensive understanding of how the repository system works.
This guide also benefits the users of Linux Mint, elementary OS and other distributions based on Ubuntu (and perhaps Debian).
Let's start with the essentials first. Understands the basic concept of the package manager and the repositories. This will build a foundation for you to understand how things work underneath.
Chapter 1: What is a Package Manager?
In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system.
Ubuntu provides the software through repositories. The repositories contain software packages of different kinds. They also have metadata files that contain information about the packages such as the name of the package, version number, description of package and the repository name etc.
The package manager interacts with the metadata and creates a local metadata cache on your system. When you ask it to install a software, the package manager refers to this cache to get the information and then uses the internet to connect to the appropriate repository and downloads the package first before installing it on your system.
This article explains the working of the package manager in a bit more detail. Do check it out.
Chapter 2: Ubuntu’s Default Repositories
From the previous section, you have some idea of the repositories.
You may have guessed that there is not a single repository that contains all the packages. Why not? Because it is categorized to have the packages in different repositories so that they can be enabled or disabled accordingly.
Each Ubuntu version has its own official set of four repositories:
- Main – Canonical-supported free and open-source software.
- Universe – Community-maintained free and open-source software.
- Restricted – Proprietary drivers for devices.
- Multiverse – Software restricted by copyright or legal issues.
Chapter 3: Understanding sources.list
The sources.list is an integral part of Ubuntu's repository mechanism. Several update-related issues find their root cause in the incorrect entries in the sources.list file.
This is why it is important to understand it.
Sources.list is basically a text file that contains the repository details. Each uncommented line represents a separate repository.
But these entries follow a specific format and should not have duplicate entries. Read more about them in the article below.
Chapter 3: Going in-depth with PPA
Though Snaps are pushed by Ubuntu a lot these days, PPAs are still a reliable way to get newer software in Ubuntu.
Many Ubuntu users blindly run three commands to use the PPA and naturally end up with issues like 'repository does not have release file'.
This is an in-depth and one-of-a-kind guide on PPA. It will improve your knowledge tremendously.
Adding External Repositories
Apart from the default repositories and PPAs, you will also add software from their party repositories. Softwares like Brave browser, Docker and many more provide dedicated repositories for Ubuntu.
Understand the mechanism of using external repositories.
Troubleshooting Common Errors
Now that you are familiar with the underlying mechanism, it's time to get familiar with the typical update errors you might encounter while using Ubuntu.
When you see go through the error, you may start getting the hint about the root cause. And when you go through the root cause, you will understand how the specific solution fixes it.
And that's the aim of this page. To give you enough under-the-hood knowledge on the package management system so that you can avoid common errors or effectively fix them.
You'll understand the why along with the how.
Failed to Download Repository Information
If you encounter this error, it's just the beginning of your investigation.
While the internet connection could be the issue in some cases, chances are that you have an issue because of some repository you added or wrong entries in the sources.list.
You should jump into the terminal and (try to) refresh the package cache.
sudo apt update
Look at the last few lines of the output. It will give you the error message (lines starting with E:). When you have the error message, your troubleshooting begins.
Repository Does Not Have a Release File
A common error Ubuntu users encounter while blindly adding PPAs to the system without checking if the PPA exists for their Ubuntu version or not.
E: The repository ‘http://ppa.launchpad.net/numix/ppa/ubuntu focal Release’ does not have a Release file.
Let me give you a hint. The repository is not configured for the Ubuntu version being used.
Problem With MergeList
If you see an error like this:
E:Encountered a section with no Package: header,
E:Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages,
E:The package lists or status file could not be parsed or opened.
It indicates that somehow the cached file mentioned in the second line got corrupted. The fix is to empty the cache and repopulate it.
Target Packages is configured multiple times
Alright! Technically, not an error. It's just a warning. But it is still quite common and could trouble many new Ubuntu users.
This is a good example for putting your newly acquired knowledge here.
There are duplicate entries in the sources.list files and that's causing the issue. The solution is to delete all the duplicate lines keeping just one.
Continue Learning
I hope you have a slightly better understanding of the repository mechanism in Ubuntu. The next time you encounter an error and come across a solution, you are more likely to understand what's going on.
Next, you should learn to use the apt command for package management. There's more than just apt install or apt remove.
You may also go a bit into detail about package management.
Since Ubuntu is pushing for Snaps more than ever, learn the essential Snap commands.
Flatpak applications are also gaining popularity and you may come across them sooner or later.
💬 I hope you enjoyed learning about the repository mechanism and has more clarity on package management. Do share your thoughts in the comment section.
from It's FOSS https://ift.tt/AvW5kx0
via IFTTT
Tidak ada komentar:
Posting Komentar