Ошибка обновления пакетов ubuntu

Кто не встречал ошибок в процессе обновления Ubuntu? Ошибки обновления в Ubuntu и иных дистрибутивах Linux встречаются часто и не вызывают удивления. В статье описан ряд часто встречающихся ошибок и способы их решения.

Данная статья является частью серии, посвященной новичкам в Ubuntu, и она призвана помочь лучше понять работу с дистрибутивом.

В данном туториале мы рассмотрим часто встречающиеся ошибки, которые можно встретить при обновлении Ubuntu. Они зачастую происходят тогда, когда пытаешься добавить софт или репозитории самостоятельно.

Если во время обновления системы появляются ошибки, паниковать не стоит. Ошибки случаются часто и решения есть. Вы научитесь как решить часто встречающиеся ошибки.

Ошибка 0: Failed to download repository information

Многие пользователи Ubuntu обновляют систему через графическую программное средство обновления. Вам приходит оповещения, что стали доступными обновления для вашей системы и теперь можно нажать на кнопку для начала скачивания и установки.

Обычно так и происходит, но иногда можно увидеть подобную ошибку:

Failed to download repository information. Check your internet connection

Скорее всего ошибка покажется странной, так как интернет работает, но вас все равно просят его проверить.

Заметили, что я назвал ее “Ошибка 0”? Это потому что это по сути не ошибка. То есть, скорее всего, она не связана с подключением к интернету. Тем не менее помимо этого путающего сообщения больше информации нет.

Если вы видите данное сообщение, а подключение к интернету в порядке, то значит пришло время надевать шляпу детектива и пошевелить мозгами.

Нам придется использовать командную строку. Для того чтобы ее быстро открыть можете воспользоваться сочетанием клавиш ctrl+alt+T. Исполните в ней данную команду:

sudo apt update

Дождитесь завершения процесса. Рассмотрите последние 3-4 строки вывода. Они покажут действительные причины ошибки sudo apt-get update. Вот пример:

Дальше туториал будет посвящен способам решения ошибок, указанных в нескольких последних строчках вывода командной строки.

Ошибка 1: Problem With MergeList

Когда вы запустите обновление в терминале, то можете увидеть ошибку “Problem With MergeList”:

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.’

По какой-то причине файл в директории /var/lib/apt/lists сломался. Вы можете удалить все файлы в указанной директории и запустить обновление снова. Исполните указанные команды одна за другое:

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

Проблемы должны исчезнуть

Ошибка 2: Hash Sum mismatch

Вы можете встретиться с ошибкой “Hash Sum mismatch”. Ее решение аналогично тому, что мы написали выше.

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

Скорее всего ошибка происходит из-за несовпадения на серверах кэша метаданных. Для исправления ситуации используйте данные команды:

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

Ошибка 3: Failed to fetch with error 404 not found

Если вы попытаетесь добавить репозиторий, который недоступен в вашей текущей версии Ubuntu, то увидите ошибку 404 not found:

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.

Вы добавили PPA в надежде установить приложение, но оно недоступно для вашей версии Ubuntu, и появилась ошибка. Вот почему следует заранее проверять доступно ли PPA для вашей версии Ubuntu или нет. Как удостовериться, что для вашей версии есть PPA, можно посмотреть здесь.

Так или иначе решением данной проблемы является удаление проблемной PPA из списка репозиториев. Название PPA вы найдете в сообщении об ошибке. Зайдите в средство Software & Updates:

Откройте Software & Updates

Здесь пройдите во вкладку Other Software и поищите PPA. Уберите галочку, чтобы PPA удалилась из системы.

Удалите PPA с помощью Software & Updates

Ваш список программ после этого обновится. Теперь, если вы снова запустите обновление, ошибка исчезнет.

Ошибка 4: Failed to download package files

Failed to download package files

В данной ситуации доступна новая версия программы, но эта версия не распространена на все зеркала. Если вы не используете зеркало, то решить эту проблему просто — сделайте источником программы основной сервер.

Пройдите в Software & Updates там измените сменить сервер с которого происходит скачивание на main (основной):

Ошибка 5: GPG error: The following signatures couldn’t be verified

Добавление PPA может также привести к оповещению “GPG error: The following signatures couldn’t be verified” во время обновления:

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

Все что надо в данном случае сделать, так это добавить публичный код в систему. Возьмите ключ из сообщения. В сообщении выше это 68980A0EA10B4DE8.

Данный ключ можно использовать так:

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

Как только ключ будет добавлен, запустите обновление и все должны быть в порядке.

Ошибка 6: BADSIG error

Еще одна знаковая ошибка при обновлении Ubuntu — это “BADSIG error”, которая выглядит примерно так:

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

Все репозитории подписаны GPG, и по какой-то причине система считает их неверными. Необходимо обновить ключи подписей. Проще всего это сделать путем повторной генерации списка apt get (с ключами подписей) и он должен иметь верный ключ.

Используйте следующие команды одну за другой:

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

Ошибка 7: Partial upgrade error

Обновление через терминал может привести к такому:

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

Для исправления ошибки исполните в терминале данную команду:

sudo apt-get install -f

Ошибка 8: Could not get lock /var/cache/apt/archives/lock

Данная ошибка происходит, когда еще одна программа использует APT. Допустим вы устанавливаете что-то через Ubuntu Software Center и в одновременно пытается запустить apt в терминале.

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

Проверьте не использует ли apt другая программа. Это может быть команда в терминале, Software Center, Software Updater, Software & Updates или иной другой соф, который занимается установкой и удалением приложений.

Если можете такие программы закрыть, закрывайте. Если что-то в процессе, то дождитесь завершения.

Если ничего найти не можете, используйте данную команду для того, чтобы прекратить все подобные процессы:

sudo killall apt apt-get

Это хитрая проблема, так что придется попотеть. Если это не поможет, то рекомендуем эту статью.

Встречали ли вы другие ошибки при обновлении?

Так завершается обзор часто встречающихся ошибок при обновлении Ubuntu. Надеюсь данная статья поможет вам с ними справится.

Вы не встречали других ошибок при обновлении Ubuntu недавно, о которых здесь не говорится? Расскажите в комментариях.

Who hasn’t 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, I’ll 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. You’ll 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

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

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.

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, that’s what usually happens. But sometimes you’ll see an error like this:

Failed to download repository information Ubuntu 13.04

Failed to download repository information. Check your internet connection.

That’s 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’? It’s because it’s 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, it’s time to put on your detective hat and use your grey cells (as Hercule Poirot would say).

You’ll 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. Here’s an example:

W GPG Error The following signatures couldn't be verified because the public key is not available:

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, you’ll 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:

Software & Updates in Ubuntu GNOME
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
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 shouldn’t see the error.

Error 4: Failed to download package files error

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

failed to download package files error in Ubuntu 14.04

In this case, a newer version of the software is available but it’s 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 while downloading package files

Error 5: GPG error: The following signatures couldn’t be verified

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

W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldn’t 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. You’ll 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:

Partial Upgrade Error Linux
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 hasn’t been covered here? Do mention it in comments and I’ll try to do a quick tutorial on it.

I had finished the update to Ubuntu 20.04 and was trying to update the packages as well but I encountered an error with one of my packages being held. This is the output after running «sudo apt upgrade»:

Reading package lists...
Done Building dependency tree
Reading state information...
Done Calculating upgrade... 
Done The following packages have been kept back:   
gdb gir1.2-peas-1.0 libpeas-1.0-0 libsmbclient libwbclient0 samba-libs 
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

I have tried running multiple commands to clear broken packages/dependencies, including:

sudo apt clean
sudo apt autoclean
sudo apt autoremove

Nothing seems to work (not even dist-upgrade does anything) and when I tried manually updating the packages I got the following message:

sudo apt-get install gdb

The following packages have unmet dependencies:
 gdb : Depends: libpython3.8 (>= 3.8.0~a1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have tried many more things without any results so I was wondering what my options are.

Running apt cache policy gbd libpython3.8 produces the output:

gdb:
  Installed: 8.1-0ubuntu3.2
  Candidate: 9.1-0ubuntu1
  Version table:
     9.1-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
 *** 8.1-0ubuntu3.2 100
        100 /var/lib/dpkg/status
libpython3.8:
  Installed: (none)
  Candidate: 3.8.2-1ubuntu1
  Version table:
     3.8.2-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

asked Apr 27, 2020 at 10:24

Eugene's user avatar

EugeneEugene

1111 gold badge1 silver badge5 bronze badges

2

I had this problem too and this is how i fixed it

Befor all don’t forget this two points :

— 1 — Do not reboot your PC until you finish all the steps

— 2 — Do not forget to update your grub befor rebooting by executing :
sudo update-grub2

The problem here is that when you upgrade ubuntu from 18.04 to 20.04 the system did not replace every instance of bionic with focal : it did not replace libpython3.8-stdlib (3.8.2-1+bionic1) by libpython3.8-stdlib (= 3.8.2-1ubuntu1.1)
So the solution is to replace it manually :)
The steps to do this are :

1 — save the names of the packages that depend on the library in a text file to reinstall them later
run : sudo apt-get autoremove libpython3.8-stdlib
a message will show you all this packages :

(( apg apparmor apport apport-gtk ...xserver-xorg-video-vmware xwayland yelp yelp-xsl ))

copy them in a text file, then tap » yes » to uninstall the bionic version of libpython3.8-stdlib

2- install the focal version by :

sudo apt-get install libpython3.8-stdlib

3- now install the packages saved in the text file one by one : you can create a screipt file like this :
(( ….

sudo apt-get install gir1.2-gck-1
sudo apt-get install gir1.2-gcr-3
sudo apt-get install gir1.2-gdm-1.0
sudo apt-get install gir1.2-geoclue-2.0
sudo apt-get install gir1.2-gnomebluetooth-1.0

… ))

Do not forget to install the ubuntu-desktop if it is not in the package text file
sudo apt-get install ubuntu-desktop(Not required)

4- update your grub , run : sudo update-grub2

5- finally reboot your pc

That’s all :)

Community's user avatar

answered May 21, 2020 at 11:22

Mohamed Ali's user avatar

4

I too had this problem due to using the deadsnakes ppa and fixed it using a few simple steps:

# sudo apt list --upgradable
  Listing... Done
  gdb/focal-updates 9.2-0ubuntu1~20.04 amd64 [upgradable from: 8.1.1-0ubuntu1]
  gir1.2-peas-1.0/focal,focal 1.26.0-2 amd64 [upgradable from: 1.22.0-2]
  libpeas-1.0-0/focal,focal 1.26.0-2 amd64 [upgradable from: 1.22.0-2]
  libsmbclient/focal-updates,focal-security 2:4.11.6+dfsg-0ubuntu1.6 amd64 [upgradable from: 2:4.7.6+dfsg~ubuntu-0ubuntu2.21]
  libwbclient0/focal-updates,focal-security 2:4.11.6+dfsg-0ubuntu1.6 amd64 [upgradable from: 2:4.7.6+dfsg~ubuntu-0ubuntu2.21]
  samba-libs/focal-updates,focal-security 2:4.11.6+dfsg-0ubuntu1.6 amd64 [upgradable from: 2:4.7.6+dfsg~ubuntu-0ubuntu2.21]

# python3 --version
  Python 3.8.8

# sudo apt list | grep python3.8
  ==> few entries were pointing to bionic

# sudo rm -f /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa*

# sudo apt-get install gdb/focal gir1.2-peas-1.0/focal libpeas-1.0-0/focal python3.8/focal python3.8-minimal/focal libpython3.8/focal libpython3.8-minimal/focal libpython3.8-stdlib/focal

# sudo apt update

# sudo apt list --upgradable

# sudo apt upgrade

# sudo apt upgrade samba-libs

# sudo apt list --upgradable 
  Listing... Done
# sudo apt update
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  All packages are up to date.

# sudo apt list | grep python3.8
  ==> all entries should point to focal

answered Apr 12, 2021 at 18:58

sprucegoose's user avatar

I ended up in a similar situation because I had installed Python 3.8 from the deadsnakes PPA in 18.04, so the system Python 3.8 packages were held back. I had to run

sudo apt-get purge libpython3*

to get rid of the deadsnakes packages.

Beware! As Mohamed Ali warned, this will remove most of the Ubuntu packages and make your system unusable. Don’t reboot before you have reinstalled the system.

Then I reinstalled the system with

sudo apt install ubuntu-desktop

Everything works well now after a clean start.

answered Aug 20, 2020 at 16:18

mrts's user avatar

mrtsmrts

2812 silver badges6 bronze badges

Just an FYI, another possible reason for held back packages, they can be manually held back too:

sudo apt-mark hold (package) will hold a package: it blocks upgrading it for any reason. You can use dpkg to install an older version of some package or packages if you want, but usually as soon as you ran your updates it’d be updated to the current version; apt-mark hold’ing it prevents this, but also prevents upgrading it during an Ubuntu upgrade if the holds aren’t removed first).

apt-mark showholds lists any active holds.

apt-mark unhold (package) un-holds a package: the system is free to update those packages again.

I’ve used this twice; once, to reinstall and hold squid 3.xx on my Ubuntu 20.04 system, since squid 4.xx did not work for my use case. On a ARM Chromebook, it came with nice nvidia drivers that even supported CUDA if you kept its customized Linux kernel and Ubuntu 16.04-era X server..; I upgraded to 18.04 holding back like a dozen X-related packages… boom! Fully up-to-date Ubuntu 18.04 with the Ubuntu 16.04 X stuff so the nvidia driver kept running, even the CUDA. holds can be pretty sweet if you need them.

Zanna's user avatar

Zanna

68.9k56 gold badges215 silver badges327 bronze badges

answered Jan 5, 2021 at 1:48

hwertz's user avatar

hwertzhwertz

1861 silver badge2 bronze badges

I was able to upgrade one system today and I noticed something in the process that I will share …

The one system that I upgraded from 18.04 to 20.04 required several (about 5) sets of update && upgrade. During the final two, I received notice that there was much more to update and indications of file uploads in addition to what I had already done. During the last «sudo apt upgrade» command in Terminal, I received a notice of a large number of upgrades. It didn’t indicate that they were the upgrade to 20.04, but it turned out that they were. To get this to happen, Updates needed to be set «For any version.» This machine is working!

The second computer I simply wiped. Did a backup of data only to another disk and inserted a live USB and followed the instructions. I did this after getting repeated error messages that there were broken packages and missing files. I needed to end the frustration.

The third machine is an old one. This laptop has been upgraded from 14.04 to 16.04, to 18.04 (all LTS’s). There’s lots of legacy stuff, including some i386 files and programs. This one will not upgrade! Random error messages include one file not upgraded; 7 files not upgraded; 12 files not upgraded; Upgrades to the development release are only available from the latest supported release; going to Software Updater (GUI) I will receive notice of additional files to be loaded, sometimes 3, sometimes 6, and every number in between; and I receive notice that there is something wrong with my internet connection or the server; etc. Much of this is the same process that I went through with the first computer.

And, this is my guess …
The 20.04 release is so new and so many people are downloading it that the server cannot handle the traffic (I’ve tried other servers with the same results). The updates and upgrades are being fed to my computer piecemeal. Here’s what I’ve done:
— In Terminal — sudo update && upgrade, then sudo do-release-upgrade -d
— In Updater (GUI) — Click settings and then Updates, alternately setting Updates to «… any new version» and then to «… long term support version»; also try a different server.

It’s exasperating, but I think the only thing we can do is continue to work with the computer, putting in the same commands; alternate using the Terminal and the Updater (GUI) until eventually we get to the holy grail … and UPGRADE!

answered Apr 29, 2020 at 23:18

edempco's user avatar

3

For all its benefits, occasionally Ubuntu can throw some errors when updating the system that can confuse and even worry a new user. I recall the first time I had “broken packages” with a lack of experience – I ended up nuking the OS and reinstalling, vowing never to use the command line again. The reality is far less dramatic, especially now that Ubuntu has matured from the days of 8.04 when I first installed it.

What follows are common error messages and how to fix them with minimal fuss.

Package Hash Mismatch

As common as this sounds, Ubuntu will unfortunately produce this error generically, meaning it gives little information about the problem, should there not be an Internet issue.  In order to diagnose this, return to the Terminal and type:

A long series of text will scroll across the screen, but within this will be the following line or similar:

W:Failed to fetch package:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch
W:Failed to fetch package:/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

In order to fix this, you can enter this into the Terminal:

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

This will remove all the cached packages and force the system to re-download them again.

Failed to Download Repository Information

This error is more straightforward and usually due to a PPA that you have added which is no longer available or simply not responding.

failed-ubuntu-min

If this a PPA issue, then simply identify which of the PPAs is failing and remove it from sources. Do this as above by entering:

Failed to Download Package Information

This is another straightforward package error. Simply go to the sources and change the source to the Main Server.

ubuntu-failed-pack-min

ubuntu-sources-min

Changing this means that future downloads might be slightly slower, due to the main server being busier than a local one, but it should be more stable and have a longer up-time than local servers which can be occasionally patchy.

Partial Upgrade Error

When running an update within the Terminal, users can be presented with the following error:

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

Run this command to fix the problem:

Could Not Get Lock /var/cache/apt/archives/lock

When another package is using apt, then this error will appear. To explain, perhaps you are installing a .deb package like Google Chrome and then decide to use the Terminal to install something else, like Chromium or Firefox, at the same time.

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

Usually you can wait for the .deb package to finish installing and simply close the Software Center or gdebi if you use this. However, if the problem continues, you can resolve it by entering the following within the Terminal:

sudo rm /var/lib/apt/lists/lock

If this should fail, you can kill the process via:

GPG Error: The Following Signatures Cannot Be Verified

This isn’t really an error as such, just a small matter of configuration. It used to happen a lot with Intel Graphics Drivers when adding the PPA. Trying to update via the Terminal will give:

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

The solution is to get the public key in the system. Take the key from the message above and enter the following:

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

Inevitably, this will change based on what you are trying to verify and trying to import, so use the above as a guide.

Hopefully, this will resolve a lot of errors that users experience and will help avoid dramatic re-installations. How do you solve errors within Ubuntu? Let us know in the comments section, especially if you have other methods.

Matthew Muller

Matt has worked in the tech industry for many years and is now a freelance writer. His experience is within Windows, Linux, Privacy and Android.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Во время установки программ с помощью пакетного менеджера apt в любом из дистрибутивов, использующих этот пакетный менеджер, вы можете столкнуться с ошибкой, что у вас зафиксированы сломанные пакеты. Это пакеты, которые не установились полностью потому что им не хватает зависимостей или процесс установки был по какой-либо причине прерван.

В этой статье мы рассмотрим что делать с такой ошибкой, как её исправить, а также я дам ссылки на другие материалы на сайте, которые помогут справится с проблемой.

Как исправить у вас зафиксированы сломанные пакеты?

1. Обновите списки пакетов

Возможно вам не удалось установить нужные пакеты потому что списки репозиториев устарели, и там ещё не было нужных пакетов. Для обновления списка пакетов выполните:

sudo apt update --fix-missing

2. Установите битые пакеты

После обновления списка пакетов из репозиториев может помочь установка битых пакетов. Этот шаг поможет особенно если вы устанавливали пакет с помощью dpkg и теперь нужно доустановить его зависимости с помощью пакетного менеджера. Для этого есть специальная команда:

sudo apt install -f

3. Очистите лишние пакеты

Установке могут мешать лишние пакеты, которые больше не нужны в системе. Для их удаления выполните:

sudo apt clean

Затем:

sudo apt autoremove

Утилита отобразит список всех битых пакетов, которые не установлены, вы можете попытаться их удалить с помощью команды:

sudo dpkg --remove -force --force-remove-reinstreq имя_пакета

4. Используйте dpkg

Вместо apt вы можете использовать команду dpkg чтобы посмотреть какие пакеты вызывают проблему. Просто выполните:

sudo dpkg --configure -a

Команда покажет проблемные пакеты, а потом вы сможете их удалить той же командой:

sudo dpkg --remove -force --force-remove-reinstreq имя_пакета

5. Разрешите зависимости

Битые пакеты чаще всего появляются из-за того, что пакетный менеджер не может найти для них нужные зависимости. Если вам всё же очень нужно установить такой пакет, просто разрешите эти зависимости. Для этого можно скачать и установить их вручную или если вы уверенны, что зависимости в пакете указаны неверно, можно скачать его распаковать и удалить мешающие зависимости. Подробнее об этом читайте в этой статье.

Выводы

В этой небольшой статье мы рассмотрели что делать если в вашей системе появились битые пакеты и как их исправить. Здесь решение проблемы очень сильно зависит от вашей ситуации, но здесь приведены основные варианты решения, которые должны помочь вернуть пакетный менеджер к работе. Иногда рекомендуют удалить пакет вручную из базы данных dpkg /var/lib/dpkg/status, однако лучше этого не делать и найти путь решить проблему по другому, ручное редактирование подобных файлов может создать ещё больше проблем.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Creative Commons License

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

Об авторе

Основатель и администратор сайта losst.ru, увлекаюсь открытым программным обеспечением и операционной системой Linux. В качестве основной ОС сейчас использую Ubuntu. Кроме Linux, интересуюсь всем, что связано с информационными технологиями и современной наукой.

Понравилась статья? Поделить с друзьями:
  • Ошибка обновления офис 2016 ошибка 0x8007066f
  • Ошибка обновления ответ не является допустимым ответом json
  • Ошибка обновления нвидиа
  • Ошибка обновления модуля защищенного документооборота ошибка
  • Ошибка обновления ми бэнд 4