apt update keeps hanging, no way to troubleshoot

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Apt update on Ubuntu 16.04 hangs randomly every view updates.



Nothing I've tried can permanently fix it and I have no way to troubleshoot it.



The only solution I have is to create a shell script to apt clean && apt update. then it works.



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



Things I've done:



Switch to google DNS



Disable NetworkManager managed DNS



sudo sed -i -e 's/^dns=dnsmasq/#dns=dnsmasq/' /etc/NetworkManager/NetworkManager.conf



Add Google DNS to DHCP Client (dhcp will prepend google DNS to /etc/resolv.conf)



echo 'prepend domain-name-servers 8.8.4.4;' | sudo tee -a /etc/dhcp/dhclient.conf



echo 'prepend domain-name-servers 8.8.8.8;' | sudo tee -a /etc/dhcp/dhclient.conf



Restart NetworkManager



systemctl restart NetworkManager.service



edit apt config



Some repos have issues with http/1.1 pipelining.



Try the following:



echo 'Acquire::http::Pipeline-Depth "0";' | sudo tee /etc/apt/apt.conf.d/99pipelining-off




Sometimes its hard to see which repos are failing because of long timeouts



reduce the timeouts with



echo 'Acquire::http::Timeout "5";' | sudo tee /etc/apt/apt.conf.d/99reduce-timeout




Force IP V4 to disable attempting to resolve IP V6



echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4



create script for apt-update



Apt-get update often hangs/fails. the work around for this is to always apt clean before apt update



This command creates a script called apt-update that does just this and should be used instead of apt-get update or apt update



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



enable automatic mirror switching



sudo sed -i -e 's/deb http://il.archive.ubuntu.com/ubuntu//deb mirror://mirrors.ubuntu.com/mirrors.txt/' sources.list



enable partner repo



sudo sed -i.bak "/^# deb .*partner/ s/^# //" /etc/apt/sources.list




I tried editing the clean policy



echo 'DSELECT::Clean "always";' | sudo tee /etc/apt/apt.conf.d/99DselectAlwaysClean



echo 'APT::Get::Clean=always;' | sudo tee /etc/apt/apt.conf.d/99AlwaysClean



I even tried adding Post update and Pre update commands with



echo 'APT::Update::Post-Invoke "/usr/bin/apt apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PostUpdateClean



echo 'APT::Update::Pre-Invoke "/usr/bin/apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PreUpdateClean



these 2 commands are actually problematic because they seem to try to steal lock or something. In the end I deleted them.



How can I permanently resolve this issue without resorting to hacks like a shell script that does apt clean && apt update?



How can I troubleshoot this issue?







share|improve this question






















  • Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
    – bu5hman
    Nov 29 '17 at 13:20














up vote
0
down vote

favorite












Apt update on Ubuntu 16.04 hangs randomly every view updates.



Nothing I've tried can permanently fix it and I have no way to troubleshoot it.



The only solution I have is to create a shell script to apt clean && apt update. then it works.



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



Things I've done:



Switch to google DNS



Disable NetworkManager managed DNS



sudo sed -i -e 's/^dns=dnsmasq/#dns=dnsmasq/' /etc/NetworkManager/NetworkManager.conf



Add Google DNS to DHCP Client (dhcp will prepend google DNS to /etc/resolv.conf)



echo 'prepend domain-name-servers 8.8.4.4;' | sudo tee -a /etc/dhcp/dhclient.conf



echo 'prepend domain-name-servers 8.8.8.8;' | sudo tee -a /etc/dhcp/dhclient.conf



Restart NetworkManager



systemctl restart NetworkManager.service



edit apt config



Some repos have issues with http/1.1 pipelining.



Try the following:



echo 'Acquire::http::Pipeline-Depth "0";' | sudo tee /etc/apt/apt.conf.d/99pipelining-off




Sometimes its hard to see which repos are failing because of long timeouts



reduce the timeouts with



echo 'Acquire::http::Timeout "5";' | sudo tee /etc/apt/apt.conf.d/99reduce-timeout




Force IP V4 to disable attempting to resolve IP V6



echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4



create script for apt-update



Apt-get update often hangs/fails. the work around for this is to always apt clean before apt update



This command creates a script called apt-update that does just this and should be used instead of apt-get update or apt update



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



enable automatic mirror switching



sudo sed -i -e 's/deb http://il.archive.ubuntu.com/ubuntu//deb mirror://mirrors.ubuntu.com/mirrors.txt/' sources.list



enable partner repo



sudo sed -i.bak "/^# deb .*partner/ s/^# //" /etc/apt/sources.list




I tried editing the clean policy



echo 'DSELECT::Clean "always";' | sudo tee /etc/apt/apt.conf.d/99DselectAlwaysClean



echo 'APT::Get::Clean=always;' | sudo tee /etc/apt/apt.conf.d/99AlwaysClean



I even tried adding Post update and Pre update commands with



echo 'APT::Update::Post-Invoke "/usr/bin/apt apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PostUpdateClean



echo 'APT::Update::Pre-Invoke "/usr/bin/apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PreUpdateClean



these 2 commands are actually problematic because they seem to try to steal lock or something. In the end I deleted them.



How can I permanently resolve this issue without resorting to hacks like a shell script that does apt clean && apt update?



How can I troubleshoot this issue?







share|improve this question






















  • Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
    – bu5hman
    Nov 29 '17 at 13:20












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Apt update on Ubuntu 16.04 hangs randomly every view updates.



Nothing I've tried can permanently fix it and I have no way to troubleshoot it.



The only solution I have is to create a shell script to apt clean && apt update. then it works.



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



Things I've done:



Switch to google DNS



Disable NetworkManager managed DNS



sudo sed -i -e 's/^dns=dnsmasq/#dns=dnsmasq/' /etc/NetworkManager/NetworkManager.conf



Add Google DNS to DHCP Client (dhcp will prepend google DNS to /etc/resolv.conf)



echo 'prepend domain-name-servers 8.8.4.4;' | sudo tee -a /etc/dhcp/dhclient.conf



echo 'prepend domain-name-servers 8.8.8.8;' | sudo tee -a /etc/dhcp/dhclient.conf



Restart NetworkManager



systemctl restart NetworkManager.service



edit apt config



Some repos have issues with http/1.1 pipelining.



Try the following:



echo 'Acquire::http::Pipeline-Depth "0";' | sudo tee /etc/apt/apt.conf.d/99pipelining-off




Sometimes its hard to see which repos are failing because of long timeouts



reduce the timeouts with



echo 'Acquire::http::Timeout "5";' | sudo tee /etc/apt/apt.conf.d/99reduce-timeout




Force IP V4 to disable attempting to resolve IP V6



echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4



create script for apt-update



Apt-get update often hangs/fails. the work around for this is to always apt clean before apt update



This command creates a script called apt-update that does just this and should be used instead of apt-get update or apt update



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



enable automatic mirror switching



sudo sed -i -e 's/deb http://il.archive.ubuntu.com/ubuntu//deb mirror://mirrors.ubuntu.com/mirrors.txt/' sources.list



enable partner repo



sudo sed -i.bak "/^# deb .*partner/ s/^# //" /etc/apt/sources.list




I tried editing the clean policy



echo 'DSELECT::Clean "always";' | sudo tee /etc/apt/apt.conf.d/99DselectAlwaysClean



echo 'APT::Get::Clean=always;' | sudo tee /etc/apt/apt.conf.d/99AlwaysClean



I even tried adding Post update and Pre update commands with



echo 'APT::Update::Post-Invoke "/usr/bin/apt apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PostUpdateClean



echo 'APT::Update::Pre-Invoke "/usr/bin/apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PreUpdateClean



these 2 commands are actually problematic because they seem to try to steal lock or something. In the end I deleted them.



How can I permanently resolve this issue without resorting to hacks like a shell script that does apt clean && apt update?



How can I troubleshoot this issue?







share|improve this question














Apt update on Ubuntu 16.04 hangs randomly every view updates.



Nothing I've tried can permanently fix it and I have no way to troubleshoot it.



The only solution I have is to create a shell script to apt clean && apt update. then it works.



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



Things I've done:



Switch to google DNS



Disable NetworkManager managed DNS



sudo sed -i -e 's/^dns=dnsmasq/#dns=dnsmasq/' /etc/NetworkManager/NetworkManager.conf



Add Google DNS to DHCP Client (dhcp will prepend google DNS to /etc/resolv.conf)



echo 'prepend domain-name-servers 8.8.4.4;' | sudo tee -a /etc/dhcp/dhclient.conf



echo 'prepend domain-name-servers 8.8.8.8;' | sudo tee -a /etc/dhcp/dhclient.conf



Restart NetworkManager



systemctl restart NetworkManager.service



edit apt config



Some repos have issues with http/1.1 pipelining.



Try the following:



echo 'Acquire::http::Pipeline-Depth "0";' | sudo tee /etc/apt/apt.conf.d/99pipelining-off




Sometimes its hard to see which repos are failing because of long timeouts



reduce the timeouts with



echo 'Acquire::http::Timeout "5";' | sudo tee /etc/apt/apt.conf.d/99reduce-timeout




Force IP V4 to disable attempting to resolve IP V6



echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4



create script for apt-update



Apt-get update often hangs/fails. the work around for this is to always apt clean before apt update



This command creates a script called apt-update that does just this and should be used instead of apt-get update or apt update



echo -e '#!/bin/bashnsudo apt clean && sudo apt update' | sudo tee /usr/bin/apt-update; sudo chmod +x /usr/bin/apt-update



enable automatic mirror switching



sudo sed -i -e 's/deb http://il.archive.ubuntu.com/ubuntu//deb mirror://mirrors.ubuntu.com/mirrors.txt/' sources.list



enable partner repo



sudo sed -i.bak "/^# deb .*partner/ s/^# //" /etc/apt/sources.list




I tried editing the clean policy



echo 'DSELECT::Clean "always";' | sudo tee /etc/apt/apt.conf.d/99DselectAlwaysClean



echo 'APT::Get::Clean=always;' | sudo tee /etc/apt/apt.conf.d/99AlwaysClean



I even tried adding Post update and Pre update commands with



echo 'APT::Update::Post-Invoke "/usr/bin/apt apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PostUpdateClean



echo 'APT::Update::Pre-Invoke "/usr/bin/apt clean ;' | sudo tee /etc/apt/apt.conf.d/99PreUpdateClean



these 2 commands are actually problematic because they seem to try to steal lock or something. In the end I deleted them.



How can I permanently resolve this issue without resorting to hacks like a shell script that does apt clean && apt update?



How can I troubleshoot this issue?









share|improve this question













share|improve this question




share|improve this question








edited Nov 29 '17 at 13:04

























asked Nov 29 '17 at 11:07









yosefrow

1748




1748











  • Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
    – bu5hman
    Nov 29 '17 at 13:20
















  • Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
    – bu5hman
    Nov 29 '17 at 13:20















Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
– bu5hman
Nov 29 '17 at 13:20




Are you sure the hang is unrelated to any external event? Did you check to see if there is a drop off or interruption in the bandwidth/connection and then a failure to reconnect?
– bu5hman
Nov 29 '17 at 13:20










1 Answer
1






active

oldest

votes

















up vote
-2
down vote













Try adding this to your /etc/hosts file:



127.0.1.1 yourhostname


I am also assuming that there are no issues with your /etc/hostname file.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407708%2fapt-update-keeps-hanging-no-way-to-troubleshoot%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    -2
    down vote













    Try adding this to your /etc/hosts file:



    127.0.1.1 yourhostname


    I am also assuming that there are no issues with your /etc/hostname file.






    share|improve this answer
























      up vote
      -2
      down vote













      Try adding this to your /etc/hosts file:



      127.0.1.1 yourhostname


      I am also assuming that there are no issues with your /etc/hostname file.






      share|improve this answer






















        up vote
        -2
        down vote










        up vote
        -2
        down vote









        Try adding this to your /etc/hosts file:



        127.0.1.1 yourhostname


        I am also assuming that there are no issues with your /etc/hostname file.






        share|improve this answer












        Try adding this to your /etc/hosts file:



        127.0.1.1 yourhostname


        I am also assuming that there are no issues with your /etc/hostname file.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '17 at 12:37









        justinnoor.io

        20011




        20011



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407708%2fapt-update-keeps-hanging-no-way-to-troubleshoot%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?