When I try to do anything with apt-get
using a terminal, the apt-get
gets stuck at 0% [Working]
.
13 Answers
I came to this page via a high ranked Google search but these answers didn't help me. Instead I cleared out my local repository of retrieved package files with:
apt-get clean

- 520
You can try to check the cache and to clean the cache directory.
In the order (each step is more deep, so stop as you find a solution):
sudo apt-get clean
(Update) on recent versions it will clear out the local repository of retrieved package files. It will be enough most of the time. It is (was) not so on earlier versions.It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
Look inside
/var/lib/apt/lists/partial/
it should be empty.
If not you can decide to empty itsudo rm /var/lib/apt/lists/partial/*
eventually you may needsudo rm -f /var/lib/apt/lists/partial/*
sudo apt-get check
it updates the package cache and checks for broken dependencies.
Shrink to a normal (not huge) number of repositories the list of
/etc/apt/sources.list
.
If they are too many your system can hang in the attempt to build all the dependencies tree.
You can create a minimal set of repositories from Ubuntu Sources List Generator site and after that you backup the/etc/apt/sources.list
(with e.g.sudo cp -i /etc/apt/sources.list /etc/apt/sources.list.000
) you can paste that instead of your present list.- eventually you can check if you have a source lists file with https rather than http, but
apt-transport-https
is not installed (see the comment). - try again
sudo apt-get update
and if it fails - backup your
/var/lib/apt/lists
directory withsudo cp -r -p -i /var/lib/apt/lists ${HOME}/temp_apt_lists
and aftersudo rm -R /var/lib/apt/lists/*
- run
sudo apt-get update
again
It's possible you need to clean by hand some of the following directories (you can always backup them and only after delete the files inside) :
- /etc/apt/sources.list.d/
File fragments for locations to fetch packages from. Configuration Item: Dir::Etc::SourceParts. - etc/apt/preferences.d/
File fragments for the version preferences. Configuration Item: Dir::Etc::PreferencesParts. - /var/cache/apt/archives/partial/
Storage area for package files in transit. Configuration Item: Dir::Cache::Archives (partial will be implicitly appended) - /var/lib/apt/lists/partial/ Storage area for state information in transit. Configuration Item: Dir::State::Lists (partial will be implicitly appended)
- /var/lib/apt/lists/ Storage area for state information for each package resource specified in sources.list(5) Configuration Item: Dir::State::Lists.
PS> If you have succeed, remember to delete the backup copy that you don't need anymore, but not the sources.list.000
it can always be useful!
You can find additional hints in related answer as this one.
Update
There was an old bug because the package squid-deb-proxy-client does not clean up all its changes, solved so:
Removing the line:
Acquire::http::ProxyAutoDetect "/usr/share/squid-deb-proxy-client/apt-avahi-discover";
from:
/etc/apt/apt.conf.d/30autoproxy
Maybe can be useful this bug thread
More drastic remove the package if it is possible.

- 3,950
-
1Hmm this looks promising, I'll try this tomorrow (Actually its today but there is a period of sleeping between it :b). I'll post results! – Digital Jul 18 '14 at 00:36
-
Have a nice night... and dream about the point number 3 (to substitute the source list/ to shrink number of sources). If the cache is cleaned usually it solves. Check always that is possible to reach your repositories. E.g. paste
http://extras.ubuntu.com/ubuntu
inside the browser... (or better the lines inside your/etc/apt/sources.list
– Hastur Jul 18 '14 at 08:02 -
I tried every step, but those for some reason did not help. I think I'll re-install my ubuntu.
Could someone tell me how can I reinstall ubuntu that has been installed as a secondary OS (With windows)? Do I have to manually delete all Ubuntu's files and then install again, or how?
– Digital Jul 18 '14 at 08:35 -
ADD: Also when I break the "Working" operation using Control-C, this apperars on the terminal: http://pastebin.com/GgJ2R3Ph . Do you find any answers from there? – Digital Jul 18 '14 at 08:44
-
Use a set of repositories similar to this, if you want change the nationality prefix. Try again with
sudo apt-get -f install
, aftersudo apt-get update
. If needed try alsodpkg-reconfigure -a
. Good luck. It seems there is a bug in apt-avahi-discover. I update the answer – Hastur Jul 18 '14 at 09:49 -
I will try the "Updated solution" and Hastur's suggestion later on today. Will post the results. Thanks again ! – Digital Jul 18 '14 at 23:42
-
-
Removing the leftover squid line " /etc/apt/apt.conf.d/30autoproxy" worked on another computer that had been using a squid server that wasn't up any longer. Thanks! – SRDC Jun 17 '17 at 15:15
-
@SRDC You're welcome. It's seems that programs change during the time, but some problems (and their solutions) love to return always... – Hastur Jun 18 '17 at 07:15
-
4I had the problem, that one of the hosts in
sources.list
was usinghttps
rather thanhttp
, butapt-transport-https
was not installed. – cimnine Jun 20 '17 at 13:40 -
this is an extremely well written answer, but it didn't help me. I had to reboot to get apt to start working again. – Drew Jun 10 '18 at 03:42
I also found this happening to me when I switched to some https repos. apt needs apt-transport-https
to be installed in order to work (which understandably can be a problem when you're trying to download some stuff).

- 576
- 1
- 9
- 20
if you changed location, change your download server as well:
sudo software-properties-gtk
click other then select best server:
after that select and delete all other software repositories:
finally:
sudo apt-get update
sudo apt-get upgrade

- 13,462
Installing apt-transport-https helped me on fresh Debian 9.
sudo apt-get install apt-transport-https
Make sure you can ping out of your own network and more importantly to the Ubuntu network i.e.
ping us.archive.ubuntu.com
OR
ping security.ubuntu.com
You should get an output similar to:
PING security.ubuntu.com (91.189.88.161) 56(84) bytes of data.
64 bytes from keeton.canonical.com (91.189.88.161): icmp_seq=1 ttl=52 time=127 ms
64 bytes from keeton.canonical.com (91.189.88.161): icmp_seq=2 ttl=52 time=128 ms
--- security.ubuntu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 127.325/127.952/128.579/0.627 ms

- 976
first try to update it by
aptitude update
and then run apt-get
or should change your mirror to closest to your place, watch this - How can I get apt to use a mirror close to me, or choose a faster mirror?

- 480
- 1
- 4
- 12
-
I did
sudo aptitude update
and now I am once again stuck at0% [Working]
– Digital Jul 16 '14 at 10:44 -
-
1You met with strange issue ...i researched on it ... But no result – Rahul V Sharma Jul 16 '14 at 11:48
This could also be caused by being behind a proxy that blocks access. Sometimes I got a NODATA error... sometimes it just stayed at 0% [Working...]
.

- 522
Check if your network is accessible or not. In my case, I reinstalled my Raspiberry-Pi. I checked the date and time of my RPi, it was not updated. So I changed the date manually,
sudo date -s "2019 Mar 20 02:42"
And reboot. Now my RPi is running well.

- 595
- 5
- 22

- 11
- 1
I have got the same problem, but I solved it like this:
sudo systemctl restart networking
hope this can help.

- 197,895
- 55
- 485
- 740
This problem can also be caused by having a read-only file system.
You can check this using the following command:
mount | grep "on / "
If the output contains ro
as one of the mount flags, your root file system is in read-only mode. You will have to remount your file system read-write before apt-get update
will continue.
Resources on how to remount your file system:

- 101
In debian 9, my apt was stuck at 0%[working] for sometime before it does any task which requires access to internet. After trying many other methods, When i disabled the network manager and started using systemd-networkd instead, this problem was finally solved.

- 1
An answer I did not find on the internet anywhere but actually found it based on a command I executed a couple of hours ago. An example of such a command is
echo "deb http://dl.bintray.com/tproenca/pmsarm7 jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
After which a file is added to /etc/apt/sources.list.d/. In this directory, sources could also be added. In my case it was teamviewer which contained it's own list which had an invalid url. Therefore causing my update to fail. These are the commands that I executed.
Note: teamviewer.list was causing me problems but it can be anything for you inside this directory. Try it out and make back-ups!)
cd /etc/apt/
cp sources.list.d/* sources.list.d.backup/
rm sources.list.d/teamviewer.list
apt-get clean
apt-get check
apt-get update
Hope this saves someone the hours it could have saved me!

- 34,259

- 125
- 1
- 6
aptitude install firefox
– Rahul V Sharma Jul 16 '14 at 09:40ping -c 3 google.com
? – pmichna Jul 16 '14 at 11:25