{"id":5566,"date":"2024-10-14T01:21:45","date_gmt":"2024-10-13T19:51:45","guid":{"rendered":"https:\/\/www.veeble.org\/kb\/?p=5566"},"modified":"2025-03-17T10:41:27","modified_gmt":"2025-03-17T05:11:27","slug":"fix-the-failed-to-fetch-error-in-ubuntu-apt-package-manager","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/fix-the-failed-to-fetch-error-in-ubuntu-apt-package-manager\/","title":{"rendered":"Fix the &#8216;Failed to Fetch&#8217; Error in Ubuntu APT Package Manager"},"content":{"rendered":"\n<p>Ever tried upgrading your system or installing some new <a href=\"https:\/\/www.javatpoint.com\/ubuntu-packages\" target=\"_blank\" rel=\"noopener\">package<\/a> in Ubuntu, but it just keeps popping up with this annoying error?<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/10\/Failed-to-Fetch-Error.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"181\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/10\/Failed-to-Fetch-Error.jpg\" alt=\"Failed to Fetch Error in Ubuntu\" class=\"wp-image-5567\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Failed-to-Fetch-Error.jpg 932w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Failed-to-Fetch-Error-300x58.jpg 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Failed-to-Fetch-Error-768x149.jpg 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/a><\/figure>\n\n\n\n<p>You&#8217;re not alone! This &#8220;Failed to Fetch&#8221; error happens to many Ubuntu users. But don\u2019t worry, in this guide, we\u2019ll break down what causes this error and how you can easily fix it.<\/p>\n\n\n\n<pre class=\"wp-block-verse\"><strong>Do you know the causes of this error: \"Failed to Fetch\"?<\/strong><br>It generally happens while APT, the package manager, can't pull packages from the repositories. Some of the possible reasons are here:<br>1. Outdated or Incorrect Repositories<br>2. Network Issues<br>3. Repository Server is Down<br>4. Proxy\/DNS Settings<br>5. Firewall Blocking<\/pre>\n\n\n\n<p>Now that you know what could be causing the issue, let\u2019s dive into how to fix it. <strong>\ud83d\ude03<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"check-your-internet-connection\">Check Your Internet Connection<\/h3>\n\n\n<p>Run a simple command to check your Internet connection. i.e;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ping google.com<\/code><\/pre>\n\n\n\n<p>This would output the response if everything is okay with your network, like below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1405\" height=\"199\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase.png\" alt=\"check internet connection of your device with ping command firstly if you're having issues with the error: failed to fetch in Ubuntu\" class=\"wp-image-5571\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase.png 1405w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase-300x42.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase-1024x145.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Ping-Results-for-Falied-to-Fetch-Error-KnowledgeBase-768x109.png 768w\" sizes=\"auto, (max-width: 1405px) 100vw, 1405px\" \/><\/a><\/figure>\n\n\n\n<p>Otherwise, you fix up the network and move on.<\/p>\n\n\n\n<p><\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"update-your-repository-list\">Update Your Repository List<\/h3>\n\n\n<p>Run the below command to clean cache and update the list of available packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt clean -y\nsudo apt update -y<\/code><\/pre>\n\n\n\n<p>Sometimes, the repositories just need to be refreshed. The above command will refresh it!<\/p>\n\n\n\n<p>If you are still facing issues like before for updating too. Relax and try updating the correct repositories in your Ubuntu sources.list file. To do it, refer to the blog: <a href=\"https:\/\/www.veeble.org\/kb\/sources-list-file-urls-ubuntu\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.veeble.org\/kb\/sources-list-file-urls-ubuntu\/<\/a><\/p>\n\n\n\n<p>Go to the next step if the issue is not solved by now. \ud83e\udd7a<\/p>\n\n\n\n<p><\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"fix-dns-issues\">Fix DNS Issues<\/h3>\n\n\n<p>Try changing your DNS to a public DNS server like Google\u2019s. To do it, just open the \/etc\/resolv.conf file in a text editor and then update Google nameservers in it, and save it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/resolv.conf<\/code><\/pre>\n\n\n\n<p>Google nameservers were 8.8.8.8 and 8.8.4.4. Just update them as you can see from the below screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/06\/nameserver.gif\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"296\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/06\/nameserver.gif\" alt=\"Update Google nameserver in \/etc\/resolv.conf file to resolve the &quot;Failed to fetch&quot; error\" class=\"wp-image-3723\"\/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Now, update again with the command: <code>apt update<\/code> -y<br>This should solve the issue if DNS was the problem.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">If you\u2019re behind a proxy (e.g., in a corporate environment), the proxy could be causing the issue. If the proxy is not configured properly, it can block access to repositories. Set the correct proxy settings by editing your environment variables in <strong>~\/.bashrc<\/strong><br>Refer: <a href=\"https:\/\/askubuntu.com\/questions\/175172\/how-do-i-configure-proxies-without-gui\" target=\"_blank\" rel=\"noopener\">Ubuntu Forums<\/a><\/pre>\n\n\n\n<p>If none of the above solutions work, try rebooting the system and also check the firewall for any blocks to the configured repository servers.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-uagb-separator uagb-block-14daec70\"><div class=\"wp-block-uagb-separator__inner\" style=\"--my-background-image:\"><\/div><\/div>\n\n\n\n<p>The &#8216;Failed to Fetch&#8217; error in Ubuntu can seem like a huge headache, but most of the time, it\u2019s a simple fix. If you found this guide helpful, share it with others! And happy package managing!<\/p>\n\n\n\n<div style=\"height:45px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-31682ffe wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\">Reliable cPanel Hosting<\/h3><p class=\"uagb-cta__desc\">Secure, dependable, and easy-to-use cPanel hosting. Perfect for your website.<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/cpanel-hosting\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">Choose Your Plan<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>Are you facing the error: &#8220;Failed to Fetch&#8221; in Ubuntu package installation or updating. Check out this blog to easily fix it!<\/p>\n","protected":false},"author":7,"featured_media":8124,"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-5566","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\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager.jpg",1366,768,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager-768x432.jpg",768,432,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager.jpg",1366,768,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/10\/Fix-the-Failed-to-Fetch-Error-in-Ubuntu-APT-Package-Manager.jpg",1366,768,false]},"uagb_author_info":{"display_name":"Adrian Antony","author_link":"https:\/\/www.veeble.com\/kb\/author\/adrian\/"},"uagb_comment_info":0,"uagb_excerpt":"Are you facing the error: \"Failed to Fetch\" in Ubuntu package installation or updating. Check out this blog to easily fix it!","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/5566","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\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=5566"}],"version-history":[{"count":11,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/5566\/revisions"}],"predecessor-version":[{"id":7401,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/5566\/revisions\/7401"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/8124"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=5566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=5566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=5566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}