TranslateProject/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md
DarkSun 01dcba7822 选题: 20191022 Beginner’s Guide to Handle Various Update Related Errors in Ubuntu
sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md
2019-10-22 00:57:42 +08:00

12 KiB
Raw Blame History

Beginners Guide to Handle Various Update Related Errors in Ubuntu

Who hasnt come across an error while doing an update in Ubuntu? Update errors are common and plenty in Ubuntu and other Linux distributions based on Ubuntu. Here are some common Ubuntu update errors and their fixes.

This article is part of Ubuntu beginner series that explains the know-how of Ubuntu so that a new user could understand the things better.

In an earlier article, I discussed how to update Ubuntu. In this tutorial, Ill discuss some common errors you may encounter while updating Ubuntu. It usually happens because you tried to add software or repositories on your own and that probably caused an issue.

There is no need to panic if you see the errors while updating your system.The errors are common and the fix is easy. Youll learn how to fix those common update errors.

Before you begin, I highly advise reading these two articles to have a better understanding of the repository concept in Ubuntu.

Understand Ubuntu repositories

Understand Ubuntu repositories

Understand Ubuntu repositories

Learn what are various repositories in Ubuntu and how they enable you to install software in your system.

Read More

Understanding PPA in Ubuntu

Understanding PPA in Ubuntu

Understanding PPA in Ubuntu

Further improve your concept of repositories and package handling in Ubuntu with this detailed guide on PPA.

Read More

Error 0: Failed to download repository information

Many Ubuntu desktop users update their system through the graphical software updater tool. You are notified that updates are available for your system and you can click one button to start downloading and installing the updates.

Well, thats what usually happens. But sometimes youll see an error like this:

Failed to download repository information. Check your internet connection.

Thats a weird error because your internet connection is most likely working just fine and it still says to check the internet connection.

Did you note that I called it error 0? Its because its not an error in itself. I mean, most probably, it has nothing to do with the internet connection. But there is no useful information other than this misleading error message.

If you see this error message and your internet connection is working fine, its time to put on your detective hat and use your grey cells (as Hercule Poirot would say).

Youll have to use the command line here. You can use Ctrl+Alt+T keyboard shortcut to open the terminal in Ubuntu. In the terminal, use this command:

sudo apt update

Let the command finish. Observe the last three-four lines of its output. That will give you the real reason why sudo apt-get update fails. Heres an example:

Rest of the tutorial here shows how to handle the errors that you just saw in the last few lines of the update command output.

Error 1: Problem With MergeList

When you run update in terminal, you may see an error “problem with MergeList” like below:

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.

For some reasons, the file in /var/lib/apt/lists directory got corrupted. You can delete all the files in this directory and run the update again to regenerate everything afresh. Use the following commands one by one:

sudo rm -r /var/lib/apt/lists/*
sudo apt-get clean && sudo apt-get update

Your problem should be fixed.

Error 2: Hash Sum mismatch

If you find an error that talks about Hash Sum mismatch, the fix is the same as the one in the previous error.

W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch,
W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages Hash Sum mismatch,
E:Some index files failed to download. They have been ignored, or old ones used instead

The error occurs possibly because of a mismatched metadata cache between the server and your system. You can use the following commands to fix it:

sudo rm -rf /var/lib/apt/lists/*
sudo apt update

Error 3: Failed to fetch with error 404 not found

If you try adding a PPA repository that is not available for your current Ubuntu version, youll see that it throws a 404 not found error.

W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

You added a PPA hoping to install an application but it is not available for your Ubuntu version and you are now stuck with the update error. This is why you should check beforehand if a PPA is available for your Ubuntu version or not. I have discussed how to check the PPA availability in the detailed PPA guide.

Anyway, the fix here is that you remove the troublesome PPA from your list of repositories. Note the PPA name from the error message. Go to Software & Updates tool:

Open Software & Updates

In here, move to Other Software tab and look for that PPA. Uncheck the box to remove the PPA from your system.

Remove PPA Using Software & Updates In Ubuntu

Your software list will be updated when you do that. Now if you run the update again, you shouldnt see the error.

Error 4: Failed to download package files error

A similar error is **failed to download package files error **like this:

In this case, a newer version of the software is available but its not propagated to all the mirrors. If you are not using a mirror, easily fixed by changing the software sources to Main server. Please read this article for more details on failed to download package error.

Go to Software & Updates and in there changed the download server to Main server:

Error 5: GPG error: The following signatures couldnt be verified

Adding a PPA may also result in the following GPG error: The following signatures couldnt be verified when you try to run an update in terminal:

W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldnt be verified because the public key is not available: NO_PUBKEY 68980A0EA10B4DE8

All you need to do is to fetch this public key in the system. Get the key number from the message. In the above message, the key is 68980A0EA10B4DE8.

This key can be used in the following manner:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8

Once the key has been added, run the update again and it should be fine.

Error 6: BADSIG error

Another signature related Ubuntu update error is BADSIG error which looks something like this:

W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key
W: GPG error: http://ppa.launchpad.net precise Release:
The following signatures were invalid: BADSIG 4C1CBC1B69B0E2F4 Launchpad PPA for Jonathan French W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release

All the repositories are signed with the GPG and for some reason, your system finds them invalid. Youll need to update the signature keys. The easiest way to do that is by regenerating the apt packages list (with their signature keys) and it should have the correct key.

Use the following commands one by one in the terminal:

cd /var/lib/apt
sudo mv lists oldlist
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

Error 7: Partial upgrade error

Running updates in terminal may throw this partial upgrade error:

Not all updates can be installed
Run a partial upgrade, to install as many updates as possible

Run the following command in terminal to fix this error:

sudo apt-get install -f

Error 8: Could not get lock /var/cache/apt/archives/lock

This error happens when another program is using APT. Suppose you are installing some thing in Ubuntu Software Center and at the same time, trying to run apt in terminal.

E: Could not get lock /var/cache/apt/archives/lock  open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/

Check if some other program might be using apt. It could be a command running terminal, Software Center, Software Updater, Software & Updates or any other software that deals with installing and removing applications.

If you can close other such programs, close them. If there is a process in progress, wait for it to finish.

If you cannot find any such programs, use the following command to kill all such running processes:

sudo killall apt apt-get

This is a tricky problem and if the problem still persists, please read this detailed tutorial on fixing the unable to lock the administration directory error in Ubuntu.

Any other update error you encountered?

That compiles the list of frequent Ubuntu update errors you may encounter. I hope this helps you to get rid of these errors.

Have you encountered any other update error in Ubuntu recently that hasnt been covered here? Do mention it in comments and Ill try to do a quick tutorial on it.


via: https://itsfoss.com/ubuntu-update-error/

作者:Abhishek Prakash 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出