{"id":3049,"date":"2024-03-15T15:35:00","date_gmt":"2024-03-15T10:05:00","guid":{"rendered":"https:\/\/www.veeble.org\/kb\/?p=3049"},"modified":"2025-02-20T11:53:40","modified_gmt":"2025-02-20T06:23:40","slug":"how-to-fix-e-unable-to-locate-package-error-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/how-to-fix-e-unable-to-locate-package-error-on-ubuntu\/","title":{"rendered":"How to Fix \u201cE: Unable to Locate Package\u201d Error on Ubuntu"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-1024x576.jpg\" alt=\"How to Fix \u201cE Unable to Locate Package\u201d Error on Ubuntu\" class=\"wp-image-7348\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-1024x576.jpg 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-300x169.jpg 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-768x432.jpg 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu.jpg 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>When using Ubuntu or any <a href=\"https:\/\/distrowatch.com\/search.php?basedon=Debian\" target=\"_blank\" rel=\"noopener\">Debian-based Linux distribution<\/a>, encountering the &#8220;E: Unable to Locate Package&#8221; error can be frustrating, especially when trying to install software or packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install package_name<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Reading package lists... Done\nBuilding dependency tree      \nReading state information... Done\nE: Unable to locate package package_name\n<\/code><\/pre>\n\n\n\n<p>This error typically occurs when the package you&#8217;re attempting to install cannot be found in the configured repositories.&nbsp;<\/p>\n\n\n<div role=\"navigation\" aria-label=\"Table of Contents\" class=\"simpletoc wp-block-simpletoc-toc\"><h2 style=\"margin: 0;\"><button type=\"button\" aria-expanded=\"false\" aria-controls=\"simpletoc-content-container\" class=\"simpletoc-collapsible\">Table of Contents<span class=\"simpletoc-icon\" aria-hidden=\"true\"><\/span><\/button><\/h2><div id=\"simpletoc-content-container\" class=\"simpletoc-content\"><style>html { scroll-behavior: smooth; }<\/style><ul class=\"simpletoc-list\">\n<li><a href=\"#different-methods-to-fix-e-unable-to-locate-package-error\">Different methods to Fix &#8220;E: Unable to Locate Package&#8221; Error:<\/a>\n\n\n<ul><li>\n<a href=\"#1-update-package-lists\">1. Update Package Lists<\/a>\n\n<\/li>\n<li><a href=\"#2-check-spelling-and-case-sensitivity\">2. Check Spelling and Case Sensitivity<\/a>\n\n<\/li>\n<li><a href=\"#method3\">3. Enable Additional Repositories<\/a>\n\n<\/li>\n<li><a href=\"#4-check-if-the-package-is-available-for-the-ubuntu-version\">4. Check if the package is available for the Ubuntu version<\/a>\n\n<\/li>\n<li><a href=\"#5-clear-the-package-cache\">5. Clear the Package Cache<\/a>\n\n<\/li>\n<li><a href=\"#6-try-a-different-mirror\">6. Try a Different Mirror<\/a>\n\n<\/li>\n<li><a href=\"#7-check-the-activation-of-the-ubuntu-version\">7. Check the activation of the Ubuntu version<\/a>\n\n<\/li>\n<\/ul>\n<li><a href=\"#conclusion\">Conclusion:<\/a>\n<\/li><\/ul><\/div><\/div>\n\n<h2 class=\"wp-block-heading\" id=\"different-methods-to-fix-e-unable-to-locate-package-error\"><strong>Different methods to Fix &#8220;E: Unable to Locate Package&#8221; Error:<\/strong><\/h2>\n\n<h3 class=\"wp-block-heading\" id=\"1-update-package-lists\">1. <strong>Update Package Lists<\/strong> <\/h3>\n\n\n<p>Before attempting to install any package, it&#8217;s essential to update the package lists to ensure you have the latest information about available packages. If the cache does not support the required package, Ubuntu will have difficulty installing both the software and the package. <\/p>\n\n\n\n<p>As a result, we must update the Ubuntu repositories package lists to include new and updated packages and software.<\/p>\n\n\n\n<p> Open the terminal and run the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"2-check-spelling-and-case-sensitivity\">2. <strong>Check Spelling and Case Sensitivity<\/strong><\/h3>\n\n\n<p>Ensure that you have spelled the package name correctly and that the case matches. Package names are case-sensitive, so even a small typo can lead to this error.<\/p>\n\n\n\n<p><strong>For example<\/strong>, If you want to install the package <code><a href=\"https:\/\/packages.debian.org\/sid\/libjpeg-dev\" target=\"_blank\" rel=\"noopener\">libjpeg-dev<\/a><\/code>, which is a development library for JPEG image format support. However, if you mistakenly type <code>LibJpeg-dev<\/code> with a capital &#8220;L&#8221; and incorrect casing, you&#8217;ll encounter the &#8220;E: Unable to Locate Package&#8221; error.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install LibJpeg-dev<\/code><\/pre>\n\n\n\n<p>When you run this command, Ubuntu will not find the package because it&#8217;s case-sensitive and the correct package name is <code>libjpeg-dev<\/code>, not <code>LibJpeg-dev<\/code>.<\/p>\n\n\n\n<p>To fix the error, ensure that you use the correct spelling and casing for the package name:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install libjpeg-dev<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"method3\">3. <strong>Enable Additional Repositories<\/strong><\/h3>\n\n\n<p>To add the main repositories to your Ubuntu system, you can use the <code><a href=\"https:\/\/help.ubuntu.com\/community\/Repositories\/CommandLine\" target=\"_blank\" rel=\"noopener\">add-apt-repository<\/a><\/code> command with the <code>universe<\/code>, <code>multiverse<\/code>, and <code>restricted<\/code> repositories. These repositories contain a vast collection of software packages that are officially supported by Ubuntu.<\/p>\n\n\n\n<p>Older Ubuntu versions do not have the main repositories by default. Fortunately, this problem does not occur in subsequent versions of Ubuntu (such as Ubuntu 20.04 and Ubuntu 22.04), which are distributed with the main repositories.<\/p>\n\n\n\n<p>If you have an an older version of Ubuntu, you can add the main repositories on Ubuntu by using the commands below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add-apt-repository main\nadd-apt-repository universe\nadd-apt-repository restricted\nadd-apt-repository multiverse<\/code><\/pre>\n\n\n\n<p>After running these commands, you should update the package lists using<code><strong> apt update<\/strong><\/code> to ensure that the newly added repositories are recognized by the system. Once the update is complete, you can install packages from these repositories using <code><strong>apt install<\/strong><\/code> as usual.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"4-check-if-the-package-is-available-for-the-ubuntu-version\">4. <strong>Check if the package is available for the Ubuntu version<\/strong><\/h3>\n\n\n<p>Here, if any of the above solutions didn&#8217;t worked, it may be the package you are installing may be not available for your particular <a href=\"https:\/\/releases.ubuntu.com\/\" target=\"_blank\" rel=\"noopener\">Ubuntu version<\/a>.<\/p>\n\n\n\n<p>To find if the package is available for the current Ubuntu version, you should know information about the current Ubuntu version using the command given below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lsb_release -a<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>No LSB modules are available.\nDistributor ID: Ubuntu \nDescription: Ubuntu 22.04.1 \nLTS Release: 22.04 \nCodename: jammy<\/code><\/pre>\n\n\n\n<p>Here you can see the version of Ubuntu you are currently using.<\/p>\n\n\n\n<p>Now you can check your package is available for your Ubuntu version by visting <a href=\"https:\/\/packages.ubuntu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ubuntu Packages<\/a>.<\/p>\n\n\n\n<p>Using the output, you can understand whether the package you are trying to install in the current ubuntu version is available or not.  If the particular repository is available, check the name of the repository which it belongs to. <\/p>\n\n\n\n<p>If this package is available in any of the repository given in <a href=\"#method3\">method 3<\/a> and it is unavailable in your ubuntu system, this also shows the error &#8220;E: Unable to Locate Package&#8221;. <\/p>\n\n\n\n<p>To resolve this, as in <a href=\"#method3\">method 3<\/a>, you have to add that particular repository to your Ubuntu.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"5-clear-the-package-cache\">5. <strong>Clear the Package Cache<\/strong><\/h3>\n\n\n<p>Sometimes, the package cache might be corrupted, leading to this error. To resolve this, clear the package cache by running <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt clean<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"6-try-a-different-mirror\">6. <strong>Try a Different Mirror<\/strong><\/h3>\n\n\n<p>In the context of software repositories, a mirror refers to a copy of a repository that is hosted on a different server than the original repository. Mirrors are used to distribute the load of downloading packages and updates across multiple servers, improving download speeds and reducing the load on individual servers.<\/p>\n\n\n\n<p>These mirrors are identical all throughout. In other words, they all host the same exact information. Software downloaded from an Ubuntu server in the United States produces same effects as software downloaded from Japan.<\/p>\n\n\n\n<p>You can change the mirror used by Ubuntu to download packages by editing the <code>\/etc\/apt\/sources.list<\/code> file. <\/p>\n\n\n\n<p><strong>Follow these steps to try a different mirror:<\/strong><\/p>\n\n\n\n<p>1. Open a terminal on your Ubuntu system.<\/p>\n\n\n\n<p>2. Edit the sources.list file using a text editor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/apt\/sources.list<\/code><\/pre>\n\n\n\n<p>Inside the text editor, you&#8217;ll see lines that begin with <code>deb<\/code>. These lines specify the repositories (mirrors) from which Ubuntu downloads packages. Each line typically starts with <code><strong>deb<\/strong><\/code>, followed by the mirror URL.<\/p>\n\n\n\n<p>3. Locate the line that starts with your current mirror URL. It usually looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>deb http:\/\/archive.ubuntu.com\/ubuntu\/ focal main restricted<\/code><\/pre>\n\n\n\n<p>4. Replace the current mirror URL with the URL of a different mirror. You can find a list of Ubuntu mirrors on the&nbsp;<a href=\"https:\/\/launchpad.net\/ubuntu\/+archivemirrors\" target=\"_blank\" rel=\"noreferrer noopener\">official archive mirrors website<\/a>. For example, you might replace <code><strong>http:\/\/archive.ubuntu.com\/ubuntu\/<\/strong><\/code> with <strong><code>http:\/\/mirror.example.com\/ubuntu\/<\/code>.<\/strong><\/p>\n\n\n\n<p>5. After saving the changes, update the package lists to fetch packages from the new mirror:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>You can now try installing or updating packages to see if the new mirror is being used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install &lt;package-name&gt;<\/code><\/pre>\n\n\n\n<p>By following these steps, you can try a different mirror in Ubuntu.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"7-check-the-activation-of-the-ubuntu-version\">7. <strong>Check the activation of the Ubuntu version<\/strong><\/h3>\n\n\n<p>If your <a href=\"https:\/\/releases.ubuntu.com\/\" target=\"_blank\" rel=\"noopener\">Ubuntu version<\/a> is no longer supported or has expired, installing new packages will result in the error &#8220;E: Unable to Locate Package&#8221;.<br>To determine the status of the Ubuntu version and to know whether it is supported  or not.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hwe-support-status --verbose<\/code><\/pre>\n\n\n\n<p>Output:-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>You are not running a system with a Hardware Enablement Stack. Your system is supported until April 2025.<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion:<\/h2>\n\n\n<p>By following these steps, you should be able to troubleshoot and resolve the &#8220;E: Unable to Locate Package&#8221; error on Ubuntu effectively.<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-8e67f634 wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\">Experience the Power of Veeble VPS Hosting<\/h3><p class=\"uagb-cta__desc\">Experience the power of Veeble VPS hosting. Our plans are affordable, reliable, and packed with features that will help you take your business to the next level.<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/vps-hosting\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">Explore VPS Plans<svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M504.3 273.6l-112.1 104c-6.992 6.484-17.18 8.218-25.94 4.406c-8.758-3.812-14.42-12.45-14.42-21.1L351.9 288H32C14.33 288 .0002 273.7 .0002 255.1S14.33 224 32 224h319.9l0-72c0-9.547 5.66-18.19 14.42-22c8.754-3.809 18.95-2.075 25.94 4.41l112.1 104C514.6 247.9 514.6 264.1 504.3 273.6z\"><\/path><\/svg><\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>When using Ubuntu or any Debian-based Linux distribution, encountering the &#8220;E: Unable to Locate Package&#8221; error can be frustrating, especially when trying to install [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":7348,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3049","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu.jpg",1366,768,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-768x432.jpg",768,432,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu.jpg",1366,768,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/03\/How-to-Fix-E-Unable-to-Locate-Package-Error-on-Ubuntu.jpg",1366,768,false]},"uagb_author_info":{"display_name":"Nayana Nair","author_link":"https:\/\/www.veeble.com\/kb\/author\/nayana\/"},"uagb_comment_info":0,"uagb_excerpt":"When using Ubuntu or any Debian-based Linux distribution, encountering the &#8220;E: Unable to Locate Package&#8221; error can be frustrating, especially when trying to install [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=3049"}],"version-history":[{"count":12,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3049\/revisions"}],"predecessor-version":[{"id":7350,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3049\/revisions\/7350"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/7348"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=3049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=3049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=3049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}