apt update keeps hanging, no way to troubleshoot
Clash 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?
ubuntu apt
add a comment |Â
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?
ubuntu apt
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
add a comment |Â
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?
ubuntu apt
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?
ubuntu apt
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
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered Nov 29 '17 at 12:37
justinnoor.io
20011
20011
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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