Unable to locate package ошибка ubuntu

Один из многих способов установки программного обеспечения в Ubuntu – команда apt-get или apt. Установка пакетов с помощью пакетного менеджера намного удобнее и безопаснее, чем поиск и загрузка программ в интернете. Открыв терминал, вы должны вызвать утилиту apt с параметром install написать название программы, чтобы установить ее.

При использовании этой команды иногда возникает ошибка E: Unable to locate package. Ошибка не нуждается в пояснении. Linux-система не может найти пакет, который вы пытаетесь установить. Но почему так? Почему она не видит пакет? Рассмотрим несколько способов решения данной проблемы. В этой статье мы рассмотрим как исправить ошибку Unable to locate package error в Ubuntu.

Дальше пошагово рассмотрим процесс устранения ошибки.

1. Проверьте имя пакета

Это первое, что вы должны сделать. Может, в названии пакета опечатка? Если вы пытаетесь установить vlc и написали vcl, то непременно ничего не получится. Опечатки – распространенная проблема, так что убедитесь в том, что вы не допустили ошибок во время ввода имени пакета.

2. Обновите кэш репозиториев

Если вы в первый раз запустили систему после установки, следует написать команду update:

sudo apt update

Данная команда не обновит Ubuntu полностью. На деле, команда apt update составляет локальный список доступных для установки пакетов.

При использовании команды install, менеджер пакетов apt просматривает кэш, чтобы получить информацию о пакете и его версии, а затем скачать его из репозиториев в сети. Если пакета в кэше нет, система не сможет его установить.

Кэш в только что установленной системе изначально пуст. Именно поэтому вам стоит запустить команду apt update сразу после установки Ubuntu или других дистрибутивов, основанных на Ubuntu (например, Linux Mint).

Даже если система не новая, кэш apt вполне может оказаться устаревшим. В любой момент не лишним будет его обновить.

3. Убедитесь, что пакет доступен в вашей версии Ubuntu

Отлично! Вы проверили название пакета, и оно верно. Вы запустили команду update, чтобы обновить состояние кэша, но все ошибка unable to locate package все еще присутствует. Вполне возможно, что пакет попросту недоступен. Но вы следуете инструкции с какого-то сайта, и у всех получается установить его указанным образом. В чем может заключаться проблема?

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

Первый шаг – проверьте, какая версия Ubuntu у вас запущена. Откройте терминал и введите следующую команду:

lsb_release -a

В результате вы увидите версию Ubuntu и ее кодовое название. Именно кодовое название нам важно больше всего. Как видите, мы используем Ubuntu 18.04 с кодовым именем bionic. У вас может быть иначе, но суть должна быть понятна. Как только вы получили сведения о версии и названии, откройте сайт Ubuntu Packages.

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

Вам будет показано, доступен ли пакет для вашей версии Ubuntu, и если это так, то вместе с этим отобразится репозиторий, в котором он находится. Мы искали средство создания скриншотов Shutter и вот, что вышло для Ubuntu 18.04 Bionic:

В нашем случае, название пакета точно совпало. Это значит, что пакет shutter существует для Ubuntu 18.04 Bionic, но в репозитории Universe.

Если необходимый пакет доступен для вашей версии Ubuntu, но в Universe или Multiverse, эти репозитории необходимо включить:

sudo add-apt-repository universe multiverse

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

sudo apt update

Теперь установка пакета должна пройти гладко.

Ничего не работает, что делать?

Если сайте Ubuntu Packages показывает, что пакета для вашей версии системы нет, то придется найти обходные пути его установки.

Возьмем в качестве примера Shutter. Это отличное средство создания скриншотов для Linux, но его несколько лет не обновляли, поэтому в Ubuntu 18.10 и более новых версиях оно не поддерживается. Как же его установить? К счастью, один сторонний разработчик создал собственный репозиторий (PPA) и установить программу можно с помощью него. Искать пакеты и PPA, в которых они находятся, можно на сайте Launchpad для Ubuntu.

Учтите, что не стоит подключать неофициальные PPA к списку репозиториев. Лучше пользоваться теми, которые есть в вашем дистрибутиве.

Если нет даже PPA, зайдите на официальный сайт программы и проверьте, нет ли там описания альтернативных способов установки. У некоторых проектов есть .deb или AppImage файлы. Другие перешли на Snap пакеты.

Иными словами, проверьте на официальном сайте, не изменился ли метод установки приложения.

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

В заключение…

Теперь вы знаете как исправить ошибку unable to locate package Ubuntu. Если вы начали пользоваться Linux недавно, все может казаться очень непонятным. По этой причине мы освещаем подобные темы, чтобы вы могли лучше разобраться в том, как работают те или иные аспекты вашей системы.

Надеемся, что это руководство помогло решить проблему с пакетами в Ubuntu. Если у вас есть вопросы или предложения, можно оставить их в комментариях.

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

In the case where tried to install a file:

sudo apt-get install libstdc++.so.6

instead of a package. You get the error message:

E: Unable to locate package libstdc++.so.6
E: Couldn't find any package by regex 'libstdc++.so.6'

because you tried to install a file libstdc++.so.6 that you can’t install, because it is located in a debian package.

You can use apt-file to search for the package that contains that file. To install it, type:

sudo apt-get install apt-file

Then you have to update the index.

sudo apt-file update

After that, you can search for the package which contains the file libstdc++.so.6:

sudo apt-file find libstdc++.so.6

Then you find a lot packages that contains the searched file. For this example I paste only one search result:

libstdc++6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6

Then you can install the needed package libstdc++6:

sudo apt-get install libstdc++6

Туториал для новичков: как избавиться от ошибки «E: Unable to locate package» на Linux Ubuntu.

Команда apt или apt-get — один из способов установки ПО на Ubuntu. В терминале после команды прописывается название программы, которую нужно установить.

sudo apt install package_name

Иногда в процессе установки происходит сбой. Уведомление выглядит следующим образом:

sudo apt-get install package_name
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package package_name

Текст ошибки говорит сам за себя. Система не может найти пакеты, которые вы пытаетесь установить. Почему это происходит?

Устранение ошибки «Unable to locate package» на Ubuntu

Шаг за шагом рассмотрим, что могло пойти не так.

1. Имя пакета

Это нужно проверить в первую очередь. Возможно, в название закралась опечатка. Если нужно установить «vlc», а в команде прописано «vcl», то, вполне естественно, процесс прервётся.

2. Обновление кэша репозитория

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

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

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

Сразу после установки новой системы, её кэш еще пуст. Именно поэтому в таких случаях необходимо прописать команду обновления как для Ubuntu, так и для любого другого дистрибутива на её основе (например, Linux Mint) во время первого запуска.

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

3. Доступен ли пакет для используемой версии Ubuntu

Итак, название написано правильно, кэш обновлён, но ошибка всё равно появляется.

Вероятно, пакет доступен через репозиторий Universe, а ваша система или не поддерживает его, или версия Ubuntu не поддерживается данной программой.

Шаг первый – проверить актуальную версию Ubuntu через терминал.

lsb_release -a

На выходе отображается номер версии и кодовое имя.

abhishek@itsfoss:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Например, версия Ubuntu 18.04 c кодовым именем “bionic”.

Шаг второй – расширенный поиск на сайте пакетов Ubuntu.

На сайте доступна опция поиска по ключевому слову. Вводим название пакета и выставляем кодовое имя дистрибутива. В графе ”секция” нужно выставить значение ”any”. Запускаем поиск.

Так можно узнать, доступен ли пакет для конкретной версии Ubuntu и, если доступен, то к какому репозиторию он относится. Разберём на примере Shutter, программы для создания скриншотов, которую не обновляли в течение последних лет. Для версии Ubuntu18.04 Bionic будут выведены следующие данные.

В этом случае есть точное совпадение с названием пакета. Он доступен для версии Ubuntu 18.04 Bionic и относится к репозиторию Universe.

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

sudo add-apt-repository universe multiverse

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

sudo apt update

Ничего не помогло, что делать?

Если пакет недоступен и на сайте Ubuntu, то нужно искать другой способ установки. Усилиями сторонних разработчиков были созданы персональные архивы пакетов (PPA). Здесь стоит быть осторожными с неофициальными архивами и не добавлять сомнительные версии в систему.

Если этот способ не сработал, можно посетить официальный сайт проекта и уточнить, есть ли альтернативные способы установки их программ. На некоторых ресурсах доступны .DEB или AppImage файлы. Какие-то проекты могли перейти на пакеты Snap.

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

One of the many ways of installing software in Ubuntu is to use the apt-get or the apt command. You open a terminal and use the program name to install it like this:

sudo apt install package_name

Sometimes, you may encounter an error while trying to install application in this manner. The error reads:

sudo apt-get install package_name
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package package_name

The error is self explanatory. Your Linux system cannot find the package that you are trying to install. But why is it so? Why can it not find the package? Let’s see some of the actions you can take to fix this issue.

Let’s see how to troubleshoot this issue one step at a time.

1. Check the package name (no, seriously)

This should be the first thing to check. Did you make a typo in the package name? I mean, if you are trying to install vlc and you typed vcl, it will surely fail.

Typos are one of the reasons behind 'package not found error'

Typos are one of the main reasons behind ‘package not found error’

Typos are common, so make sure you have not made any mistakes in typing the package’s name.

Also, the commands in Linux are case-sensitive. So make sure that you are typing the correct package name. For example, the command name should be vlc, not Vlc or VLC.

Remember that the installable package name could be different than the popular software name. In Ubuntu, Docker package is docker.io because docker was an existing package. With Snap, VS Code package is named code, not vscode.

A practical example is installing zlib package on Ubuntu. The installable package name is zlib1g. And that’s numeric 1, not the letter L in small cases.

2. Update the repository cache

If this is the first time you are using your system after installing, you should run the update command:

sudo apt update

This command won’t update Ubuntu straightaway. I recommend to get through the concept of Ubuntu repositories. Basically, the ‘apt update’ command builds a local cache of available packages.

When you use the install command, apt package manager searches the cache to get the package and version information and then downloads it from its repositories over the network. If the package is not in this cache, your system won’t be able to install it.

When you have a freshly installed Ubuntu system, the cache is empty. This is why you should run the apt update command right after installing Ubuntu or any other distributions based on Ubuntu (like Linux Mint).

Even if it’s not a fresh install, your apt cache might be outdated. It’s always a good idea to update it.

3. Check if the package is available for your Ubuntu version

Alright! You checked the name of the package and it is correct. You run the update command to rebuild the cache and yet you see the «unable to locate package» error.

The package may be really not available. But you are following the instructions mentioned on some website and everyone else seems to be able to install it like that. What could be the issue?

I can see two things here. Either the package is available in the Universe repository and your system hasn’t enabled it or the package is not available on your Ubuntu version altogether. Don’t get confused. I’ll explain it for you.

First step, check the Ubuntu version you are running. Open a terminal and use the following command:

lsb_release -a

You’ll get the Ubuntu version number and the codename in the output. The codename is what is important here:

[email protected]:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Ubuntu Version Check

Ubuntu Version Check

As you can see here, I am using Ubuntu 18.04, whose codename is bionic. You may have something else but you get the gist of what you need to note here.

Once you have the version number and the codename, head over to the Ubuntu packages website:

Scroll down a bit on this page and go to the Search part. You’ll see a keyword field. Enter the package name (which your system cannot find) and then set the correct distribution codename. The section should be ‘any’. When you have set these three details, hit the search button.

Ubuntu Package Search

Ubuntu Package Search

This will show if the package is available for your Ubuntu version and if yes, which repository it belongs to. In my case, I searched for Shutter screenshot tool and this is what it showed me for Ubuntu 18.04 Bionic version:

Package Search Result

Package Search Result

In my case, the package name is an exact match. This means the package shutter is available for Ubuntu 18.04 Bionic but in the ‘Universe repository’. If you are wondering what the heck is Universe repository, please refer to the Ubuntu repository article I had mentioned earlier.

If the intended package is available for your Ubuntu version but in a repository like the universe or multiverse, you should enable these additional repositories:

sudo add-apt-repository universe multiverse

You must also update the cache so that your system is aware of the new packages available through these repositories:

sudo apt update

Now if you try to install the package, things should be fine.

4. Check if you are using an active Ubuntu release

Ubuntu has two major kinds of releases. The regular release is supported for nine months, while the long-term support releases are supported for five years.

In either case, if you are using an Ubuntu release that has reached its end of life, you won’t be able to install any new packages and see this «unable to locate package» error.

How do you know if your Ubuntu version is supported or not? Use this simple command to find it out:

hwe-support-status --verbose

For my supported version, it shows this output:

You are not running a system with a Hardware Enablement Stack. Your system is supported until April 2025.

You may forget about Hardware Enablement Stack for the moment. The important information is whether the system is actively supported. In the above example, my system is supported till April 2025.

Nothing works; what now?

If the Ubuntu Packages website also shows that the package is unavailable for your specific version, you’ll have to find other ways to install the package.

Take Shutter, for example. It’s an excellent screenshot tool for Linux but it hasn’t been updated in years and thus Ubuntu has dropped it from Ubuntu 18.10 and newer versions. How to install it now? Thankfully, some third-party developer created a personal repository (PPA) and you can install it using that. [Please read this detailed guide to understand PPA in Ubuntu.] You can search for packages and their PPA on Ubuntu’s Launchpad website.

Remember that you shouldn’t add random (unofficial) PPAs to your repositories list. I advise sticking with what your distribution provides.

If there are no PPAs, check the project’s official website and see if they provide some alternative ways of installing the application. Some projects provide DEB files or AppImage files. Some projects have switched to Snap packages.

In other words, check the project’s official website and check if they have changed their installation method.

If nothing works, perhaps the project itself is discontinued and if that’s the case, you should look for an alternative application.

In the end…

If you are new to Ubuntu or Linux, things could be overwhelming. This is why I am covering some basic topics like this so that you better understand how things work in your system.

I hope this tutorial helps you handle the package error in Ubuntu. If you have questions or suggestions, please feel free to ask in the comment section.

Donate Itsfoss

Почему взникает ошибка «E: Unable to locate Package»

Среда командной строки Linux имеет множество функций. Одна из ее основных функций – установка и управление пакетами программного обеспечения Linux. Существует несколько подходов к установке пакетов в Ubuntu Linux.

Один из методов – через менеджер пакетов apt, который используется для установки пакета Linux. По различным необъяснимым причинам, при неудачной установке пакета через apt может появиться сообщение об ошибке E: Unable to locate the package.

Использование apt для установки пакета используется синтаксис:

sudo apt install имя_пакета

Рассмотрим использование apt для установки пакета Linux под названием tree.

sudo apt install tree


Как исправить ошибку E Unable to locate Package на Ubuntu

Приведенный выше скрин подтверждает, что установка этого пакета прошла успешно.

sudo apt install tree


Как исправить ошибку E Unable to locate Package на Ubuntu

Скрин подтверждает, что установка этого пакета прошла успешно.

Рассмотрите возможность использования пакетного менеджера apt для установки пакета с именем vcl.

sudo apt install vcl


Как исправить ошибку E Unable to locate Package на Ubuntu

Возможные решения ошибки E: Unable to locate package можно разбить на следующие разделы:

Проверьте имя пакета Ubuntu Linux

Убедитесь, что в названии устанавливаемого пакета нет опечаток. Например, такие пакеты Linux как vlc или tree могут быть ошибочно приняты за vcl или trie при попытке установки пакета.

sudo apt install vcl
sudo apt install trie


Как исправить ошибку E Unable to locate Package на Ubuntu

Также стоит упомянуть, что команды Linux приписываются с учетом регистра. Например, Vim и vim – это совершенно разные пакеты.

sudo apt install Vim
sudo apt install vim


Как исправить ошибку E Unable to locate Package на Ubuntu

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

apt search package_name

Например, мы можем поискать существование пакета типа vlc с помощью следующей команды:

apt search vlc


Как исправить ошибку E Unable to locate Package на Ubuntu

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

apt search notepad


Как исправить ошибку E Unable to locate Package на Ubuntu

В результате вышеприведенного поиска не найден пакет notepad, который мы пытаемся установить.

Имеем не актуальный кэш репозитория

Этот шаг рекомендуется для новых пользователей со свежеустановленным Ubuntu Linux. Однако он применим ко всем пользователям Ubuntu. Этим пользователям необходимо выполнить команды обновления:

sudo apt update && sudo apt upgrade -y


Как исправить ошибку E Unable to locate Package на Ubuntu

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

После обновления кэша репозитория попробуйте повторно установить нужный пакет.

Проверка совместимости пакетов с Ubuntu

Если вы уверены в существовании пакета Linux, но все еще не можете его установить, скорее всего решение это. Первое предположение заключается в том, что пакет Linux доступен в репозитории, но не включенном в вашей версии ОС.

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

Второе предположение заключается в том, что используемая вами версия Ubuntu не имеет пакета. Чтобы решить эту проблему, сначала проверьте используемую версию Ubuntu:

lsb_release -a


Как исправить ошибку E Unable to locate Package на Ubuntu

Обратите внимание на записи Release и/или Codename. В приведенном выше случае это 22.04 и jammy соответственно.

Зайдите на сайт пакетов Ubuntu: https://packages.ubuntu.com/

Перейдите к следующему разделу сайта и заполните соответствующие данные о пакете.


Как исправить ошибку E Unable to locate Package на Ubuntu

Вышеприведенный поиск подтверждает, что пакет vlc доступен в Ubuntu jammy 22.04 в репозитории Universe.


Как исправить ошибку E Unable to locate Package на Ubuntu

Поэтому его можно установить из среды командной строки Linux. Чтобы включить репозиторий universe в системе Ubuntu, выполните:

sudo add-apt-repository universe multiverse

Эта команда добавляет репозитории universe и multiverse в нашу систему.


Как исправить ошибку E Unable to locate Package на Ubuntu

Кэш репозиториев должен знать о новом добавленном репозитории, поэтому выполняем команду:

sudo apt update

Теперь попробуйте установить пакет vlc снова, чтобы исправить ошибку установки.

sudo apt install vlc

Проверьте статус релиза вашей системы Ubuntu

Релизы Ubuntu бывают обычными (9 месяцев поддержки) или LTS (Long Term Support) с периодом в 5 лет. Ошибка Unable to locate package error на Ubuntu иногда возникает, когда система находится в конце срока службы. В этом случае установка новых пакетов становится невозможной.

Чтобы проверить дату окончания срока службы вашей системы Ubuntu, выполните:

hwe-support-status --verbose


Как исправить ошибку E Unable to locate Package на Ubuntu

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

sudo apt autoremove
sudo apt update && sudo apt upgrade -y
sudo apt dist-upgrade

В качестве альтернативы можно использовать следующую последовательность команд:

sudo apt install update-manager-core
sudo do-release-upgrade

После этого вы сможете, установить требуемый пакет.

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


Зарубин Иван


Эксперт по Linux и Windows

Опытный системный администратор с большим стажем работы на крупном российском заводе. Иван является энтузиастом OpenSource и любителем Windows, проявляя высокую компетентность в обоих операционных системах.

Благодаря его технической грамотности и умению решать сложные задачи, Иван стал неотъемлемой частью команды нашего проекта, обеспечивая непрерывную авторскую работу.

Похожие статьи

  1. 20 примеров команды ls в Linux
  2. Как управлять файлами журнала с помощью Logrotate в Linux
  3. Как создать пользователя sudo в Ubuntu
  4. Лучшие эмуляторы терминала для Linux
  5. Используйте sysfs для перезапуска любого PCI-устройства в Linux

Ubuntu comes with lots of different packages that you can install for your benefit, but sometimes you can face an error saying “E: Unable to locate package”. This usually happens when you need to follow the proper format of installing that package, or your Ubuntu distribution needs to include the relevant information needed to install that package.

This article will enlist all the possible methods to fix the error “E: Unable to locate package” Error on Ubuntu. There are 4 common methods that you can perform to resolve these issues, as listed below and will be described in this post.

  • Solution 1:Check the Package Spelling
  • Solution 2: Update and Upgrade All Packages
  • Solution 3: Adding Missing Repositories
  • Solution 4: Verify the Package Using the Office Ubuntu Packages Website
  • Bonus Tip: Follow the Supported Method to Run Commands

So, let’s discuss each of these methods in detail in the section below.

Note: In this guide, all the solutions are tested on the latest LTS release of Ubuntu, that is, Ubuntu 22.04 (codenamed Jammy Jellyfish).

Solution 1: Check the Package Spelling

You should know that Ubuntu is case-sensitive, which means that a command should be written in the same way when it was designed in the first place. For example, if a command is in small letters, then you need to write it in the same way and not in capital letters and avoid misspellings as well. One of the examples is mentioned below where you can face such a problem.

$ sudo apt install package

Whereas “package” is a general word that needs to be replaced with the actual package name that you want to install:

We will be explaining all the solutions in no specific order, so any solution can work for you depending on the reason that causes it.

Solution 2: Update and Upgrade All Packages

The first thing that you should always do in such scenarios is to update and upgrade your system packages. This will ensure that you are running the latest version of all the packages and that everything is up to date:

$ sudo apt update && sudo apt upgrade -y

Now, try to install your desired package, and if still, the problem persists, then you can follow the second method.

Solution 3: Add Missing Repositories

Another cause is that the relevant repositories are not in which the package you want to install is available. Although the latest versions of Ubuntu, such as 22.04 LTS come with pre-installed repositories, it can happen if you use an older version. So, some of the major repositories that you should consider adding to your operating system are:

$ sudo add-apt-repository main
$ sudo add-apt-repository universe
$ sudo add-apt-repository restricted
$ sudo add-apt-repository multiverse 

These are the four main repositories that you should consider for installation and after that trying to install the package again. If the problem still prevails, then you can consider the next method.

Solution 4: Verify the Package Using the Office Ubuntu Packages Website

In this method, you need to visit the official website for Ubuntu packages to find if the required package is available or not:

Now, scroll down and find the “Search Package Directories” option. In the Keyword tab, you need to type the package name you are looking for. After that, you need to select the distribution, which is “jammy” in our case, and hit the search button:

Note: To check which version of Ubuntu you are using, you can execute the below-mentioned command:

As you can see that, I am using Ubuntu 22.04 LTS with the Jammy version in the image below, so you need to look for the relevant package for your Ubuntu.

Bonus Tip: Follow the Supported Method to Run Commands

If you are using the latest version of Ubuntu which is 22.04, then there is also a possibility that you are following the methods that are supported on older versions of Ubuntu. New versions come with many updates, and the older version commands may not be suitable for new releases. Therefore, it is recommended to run the commands of the supported versions.

That’s all from this post!

Conclusion

To resolve the issue “E: Unable to locate package”, we have discussed four different methods, which are “Check the Package Spellings”, “Update and Upgrade All Packages”, “Adding Missing Repositories,” and “Verify the Package using Office Ubuntu Packages Website”. This usually occurs when the command is not written properly, or your Ubuntu system does not have the package. This post has briefly explained all the possible solutions to fix the “E: Unable to locate package” error on Ubuntu.

This post is for all Linux lovers and newbies. If you are getting an «Unable to locate package» error and want to resolve it. You have landed on the right page. When I started my Linux journey many years ago, I also got this error in Ubuntu.

There may be many reasons to encounter this error like the incorrect package name, Absolute path, package not available in repo and more. We will see all the related issues and solutions individually.

I am sure if you will follow this post step by step, You will be able to resolve the following errors. This post specifies Ubuntu but the solutions also apply to other Debian distros —

  • Unable to locate package
  • Unable to locate package ubuntu
  • E unable to locate package Kali Linux
  • Unable to locate package Debian
  • E: unable to locate package update
  • Unable to locate package pip
  • Unable to locate package nodejs
  • Unable to locate package python

All the above-mentioned errors may occur due to different scenarios. I will replicate these errors and then give you a solution for easy understanding.

Below mentioned are the Possible Causes for most of the errors

  • The package name is incorrect or case sensitive problem
  • Providing a file name instead of the package name
  • Not providing a full path to your downloaded .deb package
  • Forgot to update the repository, after a fresh Ubuntu installation
  • The package is not available for your Ubuntu version in the official repository
  • Your Ubuntu or Debian distro reached the end of life
  • The apt command syntax is not correct
  • /etc/apt/sources.list is missing or corrupted

Let’s deep dive and find solution to these possible cause —

Solution 1 — How to Fix «Unable to locate package in Ubuntu» error due to incorrect package name

It may sound silly, but yes, I still do this mistake very frequently. Sometimes I type the wrong package name while installing packages in my Ubuntu system.

I have no doubt about your intelligence, but typing errors may happen with anyone. Also If you are a newbie, keep in mind that Linux is case-sensitive.

These are the very common mistakes that happen during package installation —

  • The package name is not correct or not known
  • Lowercase or upper case issue in the package name
  • Not providing specific or complete package name with version

Let me show you this with an example —

I want to install Java (version 11) in my Ubuntu 20.04 and I am not aware of the package name. If I will assume and try to install it with the name «java», it won’t work.

I am getting «unable to locate package java«. Because it doesn’t exist with this name.

$ sudo apt install java

E-unable-to-locate-package-java

The name of Java package starts with «openjdk» in real.

How to find a package in Ubuntu repository, if exact package name not known

To find out the correct name of your package, you can follow these simple steps. It will make sure, there is no issue related to package name, lower or uppercase and even versions.

Step1.1 — Visit the Ubuntu package archive site and select your Ubuntu distro version

Visit https://packages.ubuntu.com/ and search for your package.

I am using Ubuntu 20.04. I will select focal (20.04LTS) from the list. You need to select your distro. You can check your Ubuntu version to get these details.

manual-package-search-in-ubuntu-repository

Step1.2 — Choose your package category

On this page, You will get a lot of sections like Administration utilities, Database, Development etc. to make your search easy.

Choose your section to deep down one more level. For example, I will select Java from the section —

Choose-your-package-java

Step1.2 — Search for your package from the subsection list

Search for your required package name. For example, I will look out for Java development kit version 11.

So I gave «development kit» in the search box and reached for the package openjdk-11-jdk.

You may need to do some hit-and-trial or manual search to reach your package when you are really clueless about your package name.

select-openjdk-from-repo-subsection

Step1.3 — Install your required package using the apt command

Now I know the correct name and package version i.e. openjdk-11-jdk. I will be able to install it without any issues.

$ sudo apt install openjdk-11-jdk

unable-to-locate-package-java-error-fixed

Solution 2 — Provide an absolute package (.deb) path, for offline package installation

In case your package is not available in the official Ubuntu repository and you have downloaded (.deb) package from the third-party site.

You are getting «unable to locate package» while installing it offline. It means you are not giving an absolute path to your .deb package file.

Let me explain to you with an example —

Google Chrome browser is not part of the Ubuntu official repository. So I downloaded the .deb package of chrome and tried to install it.

Google Chrome «.deb» file exists in my Downloads directory. and if you notice in the image, I am in the same directory. But still, I am getting an «unable to locate package google-chrome-stable_current_amd64.deb» error.

$ sudo apt-get install google-chrome-stable_current_amd64.deb

Unable-to-locate-package-error-due-to-absolute-path

Now I will just provide an absolute path to the .deb package file and it will work like a charm.

$ sudo apt-get install ./google-chrome-stable_current_amd64.deb

Providing-complete-path-fixed-unable-to-locate-package-error

Solution 3 — Update and build local repository cache

You may encounter this scenario if you have installed Ubuntu fresh and trying to update or install packages. Additionally, You are new to the Linux world.

Let me highlight, You must run «apt update» first to build a local cache repository. Otherwise, an empty cache will not return anything.

Actually, the package manager fetches the metadata of available packages over the network. Then it builds a local cache in the system, to provide a fast result to your package query.

The local cache repository may get stale anytime. So please make a thumb rule. Always update the package repository first and then only install the package. It is applicable to all Debian distros.

$ sudo apt update

Then install the required package.

$ sudo apt install "your-package-name"

update-cache-repository-to-fix-unable-to-locate-package-error

Solution 4 — «Unable to locate package» in Ubuntu official repository

There are cases when you try to install the Ubuntu package. It may or may not exist in the repository.

So first, we should search manually and confirm the package availability, then we can go with external or third-party repositories.

How to search packages in the Ubuntu repository using CLI and GUI

There are two ways to verify it —

  1. Find a package in the Ubuntu repository using GUI
  2. To find a package using the apt-cache command in terminal

Step 4.1 — Search for a package in the Ubuntu repository {GUI}

  • Open terminal <Ctrl +Alt + T> in Ubuntu and find out your distro code name using «lsb_release» command.

For example, I am using Ubuntu 20.04, with the code name «Focal«.

dev@ubuntu:~/Desktop$ lsb_release -c
 Codename:    focal

check-codename-ubuntu

  • Visit Ubuntu repository page > Scroll down to the search section
  • Fill «package name» in the keyword and select «Distribution«. In my case, it will be focal.
  • Hit the «Search» button.

For example, I will look for the TeamViewer package. It’s used to connect a system remotely over the Internet or intranet.

search-for-your-package-in-ubuntu-repository

So I was unable to find it in the Ubuntu repository —

download-install-package-third-party-if-not-with-ubuntu-repository

Step 4.2 (Optional) — Search for a package in Ubuntu repository {CLI}

If you don’t to leave your terminal and want to search packages in the Ubuntu repository using CLI. Follow these steps —

Run this command in terminal —

$ sudo apt-cache search "your-package-name"
or
$ sudo apt-cache search . | grep -i "package-name"

For example —

$ sudo apt-cache search teamviewer
or 
$ sudo apt-cache searcch . | grep -i teamviewer

If you are not getting any results from this search query, the package doesn’t exist in the Ubuntu repository. You need to download and install it using a third-party site or repository (PPA).

You can check out this article, to see the different ways to install packages in Ubuntu and TeamViewer installation.

Solution 5 — Your Ubuntu or Debian distro reached the end of life

You can encounter an «unable to locate package error» in case your Ubuntu or Debian distro is legacy or very old.

Ubuntu or any Linux vendor, don’t provide support or the latest package release for end-of-life distros.

For example, Ubuntu 14.04 is already at the end of life and Ubuntu 16.04 will obsolete in April 2021.

Ubuntu end of life release

So you must plan for an upgrade, in case you are still using these old versions and want to avoid package-related issues.

Solution 6 — /etc/apt/sources.list is missing or corrupted

The «sources.list» file contains all your Ubuntu and third-party repository URLs. So whenever you run the apt command to install any package. It checks within this file and gives results.

You may encounter «E: unable to locate package«, if /etc/apt/sources.list file is missing or corrupt.

One of the reasons for corruption is incorrect editing of sources.list file.

I have deleted my sources.list file just to replicate the issue and I started getting the «unable to locate package» error.

For example, if I try to install any package like python, I am getting an error as shown in the output —

dev@ubuntu:~$ sudo apt install python
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package python

and the same for nodejs package installation. So it confirms, that issue is with sources.list file because I am unable to install any package.

dev@ubuntu:~$ sudo apt install nodejs
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package nodejs

unable-to-locate-package-error-due-to-sources-list-file-corrupt

How to Fix /etc/apt/sources.list is missing or corrupted

Follow these easy instructions to rebuild sources.list file again.

Step 6.1 — Delete existing corrupt /etc/apt/sources.list file, if it exists.

If your sources.list file is corrupt, then you need to delete it first. If it’s already missing, then you can skip this step.

$ sudo rm -rf /etc/apt/sources.list

Step 6.2 — Regenerate sources.list file

Run the following command —

$ sudo software-properties-gtk

You will get the Software and Updates window. Select all the checkboxes as shown in the image. Also, select the «main server» in Download from the dropdown.

Regenerate-sources-list-file

Click Close.

You will get a warning to reload or refresh the repository cache. Select <reload> to generate sources.list file and apt-cache. it’s like running the apt-get update command from the terminal.

refresh-apt-cache

It will take a few seconds to refresh the software cache.

Refresh-software-cache-ubuntu

You can later add third-party repository as needed.

Now you can easily install your nodejs or python package. You will not get the «unable to locate package nodejs» error anymore.

unable-to-locate-package-fixed

Video tutorial

Watch this informative video tutorial for 6 solutions on «How to fix the «unable to locate package» error in Ubuntu. This is really helpful if you don’t like reading or have any doubts about the steps.

Frequently Asked Questions

Why am I getting unable to locate package fglrx-updates?

unable to locate fglrx package

If you are searching for fglrx-updates, then you may have Ubuntu 14.04 installed in your system. It’s already obsolete. So I would suggest you upgrade your system to the latest Ubuntu 22.04 system and run the following command to install the fglrx package in your system.

$ sudo apt update

$ sudo apt install fglrx-pxpress

Why am I getting Unable to locate package uboot-tools?

unable to locate uboot tools

If you are trying to install Uboot tools (companion tools for Das U-Boot bootloader) in your Linux and getting the error unable to locate package uboot-tools. You are giving the package name wrong. The correct package is u-boot-tools, Follow these commands to install Uboot tools in your system.

$ sudo apt update

$ sudo apt install u-boot-tools

Unable to locate package Linux-backports-modules-jaunty, Why?

Jaunty Linux is the codename of Ubuntu 9.04, which is an obsolete Ubuntu Linux version. It’s not supported anymore. So I would recommend you upgrade your Linux system if you are still using jaunty in your office or home.

Conclusion

If you are getting this common «unable to locate package» error in Ubuntu or other Distros like Linux Mint. I hope, resolving this error would be a cakewalk for you after reading this post.

If you find any scenario while using Linux, which is not covered in this post. Let me know through your comments. I will try to add that also in this post.

If you find it useful, Please share it with your friends on social media.

Happy learning…

If you’re having trouble locating a package on your Linux system, know it’s a frequently occurring problem for those new to package installations or executions, especially on Debian/Ubuntu-based systems. Nonetheless, there’s no need to be concerned since we’ve got you covered. This article will provide a detailed walkthrough on resolving this problem using the APT package manager. To begin, we’ll review the source lists and the components that make them up. Afterward, we’ll update the APT cache and install the package you want. So, without further ado, let’s tackle this error head-on and fix it.

Steps to fix the “Unable to locate package” error in Linux

Let’s review the steps to fix the error on our Linux systems today. We’ll be working on the error as per the apt package manager.

1. Analyzing Source Lists

Source lists are used to locate archives of the package distribution system in use on the system. This means that when we request a package for installation, the source lists are responsible for locating the same from its archives. Hence it follows the common logic, and they have a direct implication for the error. The man pages describe source lists as such:

The source list /etc/apt/sources.list and the files contained in /etc/apt/sources.list.d/ are designed to support any number of active sources and a variety of source media. The files list one source per line (one-line style) or contain multiline stanzas defining one or more sources per stanza (deb822 style), with the most preferred source listed first (in case a single version is available from more than one source). The information available from the configured sources is acquired by apt-get update (or by an equivalent command from another APT front-end).

Let us assume that we want to install the very popular port scanning tool nmap on a Debian machine, using apt, which yields the following:

$ sudo apt install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package nmap

So apt couldn’t find the nmap package from its archives. We know that apt uses the source lists under /etc/apt/sources.list to locate packages. So open the same with your favorite text editor and with superuser privileges. Here we should find something like this :

# deb http://deb.debian.org/debian bullseye main
# deb-src http://deb.debian.org/debian bullseye main

Ensure you have all the official source repositories of your particular distribution and version. You can get a list of the official mirror’s on the Distro’s site.

2. Explaining Source Lists

Let’s analyze the first line to understand what each component signifies :

# deb http://deb.debian.org/debian bullseye main
  • #: This signifies a comment, i.e., the following line is not to be considered.
  • deb: It signifies that this archive contains pre-compiled binaries in .deb format, while deb-src contains the source code of packages that can be built and modified as desired. [Read on how to easily build packages from the source here]
  • http://deb.debian.org/debian: Next up, we have the repository’s URL from where the package manager downloads the package metadata and other information to learn about what packages are available and where to download them.
  • bullseye: This signifies the code name of our Debian/Ubuntu system and can be obtained with :
$ lsb_release -c
Codename:	bullseye
  • main: The package repository might be divided into many sub-sections:
    • main: It contains officially supported open-source software
    • restricted: It contains officially supported closed-source software
    • universe: It contains open-source software maintained by the community
    • multiverse: It contains unsupported, closed source, and patent-encumbered software

So as we can see, both of our lines are commented out. Hence apt has no source repositories from where it can locate packages from. So, we uncomment both lines so that it looks like this:

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

3. Updating APT Cache

Now that we have updated our source lists to include the desired mirrors, we can update the apt cache with the following:

Subsequently, doing an apt install should fetch us our package :

Note: Sometimes, even including older mirrors or other release repositories in the /etc/apt/sources.list is also advised to fetch unavailable packages, but they often cause conflicts during future upgrades. Hence, in such scenarios, it is advised to install the required packages from .deb files or remove/comment out the lines from /etc/apt/sources.list after installation of the required packages.

Conclusion

In summary, encountering the “Unable to locate package” error is a typical challenge for those new to installing packages on Debian/Ubuntu-based systems. Nevertheless, as demonstrated in this write-up, resolving this issue is a straightforward process. We can locate and install the necessary packages by examining and upgrading the source lists and refreshing the apt cache. Confirming that we have added all the official source repositories of our specific distribution and version is crucial to prevent any conflicts during future upgrades. Adhering to these uncomplicated steps can save considerable time and annoyance and improve our proficiency in package management on our Linux systems.

Besides, we can always build packages from source, install them from pre-compiled binaries, or use other package managers like snap, aptitude, etc.

On a final note, remember that this error is generally related to either missing/incorrect sources in the apt sources list OR you typed the package’s name wrong.

Brief: This article explains the possible causes and fixes to the Ubuntu Linux error “E: Unable to locate package name”

Understanding “E: Unable to locate Package” Error on Ubuntu

The Linux command line environment has many functionalities. One of its primary roles is the installation and management of Linux software packages. There are several approaches to installing packages on Ubuntu Linux.

One of them is via the apt package manager, which is used to install a Linux package and may or may not always yield results. Due to various to-be-explained reasons, package installation failure via apt may yield the error message E: Unable to locate the package.

The usage of apt for package installation is highlighted by the following syntax:

$ sudo apt install package_name 

Consider using apt to install a Linux package called a tree.

$ sudo apt install tree

APT Install Package in Ubuntu

APT Install Package in Ubuntu

The above screen capture confirms that the installation of this package was a success.

Consider the use of an apt package manager to install a package named vcl.

$ sudo apt install vcl

E: Unable to locate package error on Ubuntu

E: Unable to locate package error on Ubuntu

Possible solutions to the error message E: Unable to locate package can be broken down into the following sections:

1. Check the Ubuntu Linux Package Name

Make sure the name of the package to be installed does not have any typo(s) associated with it. For example, a Linux package like vlc or tree might be mistyped as vcl or trie during package installation attempts.

$ sudo apt install vcl
OR
$ sudo apt install trie

Unable to locate package errors

Unable to locate package errors

Also, it is worth mentioning that Linux commands are attributed as case-sensitive. For example, Vim and vim are totally different packages.

$ sudo apt install Vim
$ sudo apt install vim

Install Package with Case-Sensitivity

Install Package with Case-Sensitivity

Check on the case sensitivity of the targeted package name before issuing the apt installation command.

Alternatively, confirm the package name’s existence in the apt database using the following syntax.

$ apt search package_name

For example, we can search for the existence of a package like vlc with the following command:

$ apt search vlc

Search for Package in Ubuntu

Search for Package in Ubuntu

If the package name does not exist in the apt database, we will get an output similar to the following.

$ apt search notepad

Unsuccessful Package Search in Ubuntu

Unsuccessful Package Search in Ubuntu

The output of the above search result does not provide a match for the notepad package we are trying to install.

2. Have an Up-to-Date Ubuntu Repository Cache

This step is recommended for new users with freshly installed Ubuntu Linux. It however applies to all Ubuntu users. These users need to run the update and upgrade commands:

$ sudo apt update && sudo apt upgrade -y

Update Ubuntu Repository Cache

Update Ubuntu Repository Cache

The execution of the above-stated command builds a local cache that accommodates Ubuntu packages (existing and new) viable for installation. Therefore, if the repository cache was out-of-date, new packages and their version information are downloaded by apt and included in the repository cache. In other words, apt installable packages should reside within the repository cache.

After updating the repository cache, try re-installing the targeted package.

3. Check Package Compatibility with Ubuntu

If you are certain of the Linux package’s existence, yet still unable to install it, consider this step. The first assumption here is that the Linux package is accessible in a universe repository not enabled on your Ubuntu system.

A universe repository holds packages not officially supported by the default repository cache. Such packages do not receive security updates and enabling the universe repo grants apt access to these packages.

The second assumption is that the Ubuntu version you are using does not avail of the package. To fix this issue, first, check the Ubuntu version you are using:

$ lsb_release -a 

Check Ubuntu Version

Check Ubuntu Version

Take note of the Release and/or Codename entries. In the above case, it’s 22.04 and jammy respectively.

Visit the Ubuntu packages website: https://packages.ubuntu.com/

Scroll to the following screen section of the website and fill in the appropriate package-related details.

Search Ubuntu Package Directories

Search Ubuntu Package Directories

The above search confirms that the vlc package is available in Ubuntu jammy 22.04 under the Universe repository.

Ubuntu Package Results

Ubuntu Package Results

It can therefore be installed from the Linux command line environment. To enable this universe repository on your Ubuntu system, run:

$ sudo add-apt-repository universe multiverse 

This command adds the universe and multiverse repositories to our Ubuntu system.

Enable Universe Repository in Ubuntu

Enable Universe Repository in Ubuntu

The repository cache needs to be aware of this newly added repository.

$ sudo apt update 

Now try to install the vlc package again to fix the installation error.

$ sudo apt install vlc

4. Check Your Ubuntu System Release Status

Ubuntu releases are either regular (9 months of support) or LTS (Long Term Support) with a span of 5 years. Unable to locate package error on Ubuntu sometimes arises when the system is at its end-of-life. This instance makes it impossible to install new packages.

To check the end-of-life date for your Ubuntu system, run:

$ hwe-support-status --verbose 

Check End of Life Ubuntu

Check End of Life Ubuntu

If the system is at its end of life, you might need to consider upgrading to the latest Ubuntu release via the following command sequence:

$ sudo apt autoremove
$ sudo apt update && sudo apt upgrade -y
$ sudo apt dist-upgrade

Alternatively, you could use the following command sequence:

$ sudo apt install update-manager-core
$ sudo do-release-upgrade 

From here, you should be able to comfortably test the installation of the targeted Ubuntu package.

$ sudo apt install package_name

To avoid compromising your system, always stick to Ubuntu-provided packages and not random Personal Package Archive (PPA). Also, not all packages are available for installation via an apt package manager.

In such cases, visit the packages’ official web pages for their associated installation instructions. With that said, I hope this article guide solves your “unable to locate package” error on Ubuntu.

Понравилась статья? Поделить с друзьями:
  • Unarc dll вернул код ошибки 6 error file read
  • Unarc dll вернул код ошибки 6 cant open file
  • Unarc dll вернул код ошибки 14 при установлении игры
  • Unarc dll вернул код ошибки 14 walking dead
  • Unarc dll вернул код ошибки 14 this is not