How can I pause/resume an apt-get update process in a terminal?
My Internet gets paused sometimes because of change in the 3g signal strength and I've to restart the whole apt-get update process again! Each update consumes 13-15 mb and every mb costs here!! Can I do something to pause the update so that I can resume it after I connect my Internet again! p.s - I know that I can resume downloads of apps/upgrade
Looking at the recommendations for using Ctrl+C, I think it'd be better to try Ctrl+Z to suspend the process in the background when/if the network drops. You might be able to use fg
to resume once your connectivity returns. (I don't know how robust apt-get is in this scenario, though.)
Another possibility would be using axel
and the apt-fast
script. It is advertised as speeding up downloads by doing parallel downloads, but it also seems to be good about keeping track of what's already been downloaded, presumably because it has to track the file pieces as it downloads in parallel chunks.
Here's the original thread from Ubuntuforum.
First pause that job. to pause a job :
Ctrl + z
for restarting the job again when you get the network signals :
for running it in foreground, use
fg %1
for running it in background, use
bg %1
You can stop the downloading of packages or updating of the system, by pressing "Ctrl+C" and stopping the program. This will stop the program completely. The next time you try the same command, apt-get will resume downloading from the point where it stopped last time
As my aptitude
told me after unexpected reboot, use:
sudo dpkg --configure -a
And as man dpkg
explains:
If -a or --pending is given instead of package, all unpacked but unconfigured packages are configured.
Installing/Updating is an atomic operation. Either it completes, or it doesn't. If the update breaks/stops then it rollbacks to the last point before update began. Because the headers (files that contain data of packages, and where to fetch them from) The packages however, begin downloading from the point that your connection broke off. Just a word of advice, dont interrupt an install, chances are that it will make the system unusable.