22

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

7
  • so, why exactly do you want to pause? is it solely so that you can clear out the package files that get downloaded for the installation? If so, just use the clean command that I outlined AFTER you've run the installation of software, it'll clear up the space taken by the downloaded package installers.
    – Thomas Ward
    Apr 16, 2011 at 5:48
  • @EvilPhoenix No.Its not for that.The point is if the connection breaks in the last step of my update, I lose 14 mb, because I've to run it again! and my internet connection is data based..so I cant afford to lose data unnecessarily!
    – avi
    Apr 16, 2011 at 11:21
  • @amith to mark a response as an answer, click the tick mark next to @jgbelacqua 's answer. Apr 16, 2011 at 11:39
  • @Kaustubh but his correct answer is not an actual answer!Its a comment on another answer!!
    – avi
    Apr 16, 2011 at 11:52
  • how is it that each update take 13-15mb? Are you running the pre-release? A new update should only take a few 100 kBs.
    – user1974
    Apr 16, 2011 at 21:13

6 Answers 6

28

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.

4
  • can axel/apt-fast keep track of apt-get update also? can it pause?
    – avi
    Apr 16, 2011 at 11:23
  • @amith -- As far as axel/apt-fast pausing, there is an allowance for pausing, but I don't know if the mechanism is exactly what you need.
    – belacqua
    Apr 16, 2011 at 21:20
  • who did the down-vote? I voted u up!
    – avi
    Apr 17, 2011 at 1:58
  • Ctrl+Z and fg worked just fine for me while installing a huge amount of packages.
    – Lucas
    Jun 5, 2020 at 11:14
6

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 
1
  • At least in bash, you don't need to specify the %1 for fg or bg, at least if it was just suspended.
    – Xen2050
    Dec 15, 2014 at 7:43
5

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

4
  • @Amith It will resume the packages but not the update!update starts all over again!
    – avi
    Apr 16, 2011 at 3:45
  • 1
    It'd be better to try Ctrl-Z to suspend the process in the background if the network drops -- you might be able to use fg to resume once your connectivity returns. Don't know how robust apt-get is in this scenario, though.
    – belacqua
    Apr 16, 2011 at 5:53
  • 1
    @jgbelacqua hey!! this works..how do i mark this as the answer??
    – avi
    Apr 16, 2011 at 11:25
  • @amithv -- I've added the comment into the top of my original answer, since it seems to work. I'm very pleased that it helps.
    – belacqua
    Apr 16, 2011 at 19:57
4

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.

2

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.

0
-1

I dont like terminal. Neither know whether it is possible using terminal or not. But there is a bad way of doing what you have asked. For this you need "Synaptic Package Manager". If you don’t have this then first install it. Now if you have it then, open it; Click on "Mark All Upgrades". This will bring up all the upgradable (updatable) packages. Now start downloading packages until your connection is lost. If the connection is lost, Synaptic will complain about it and stop upgrading. No worries, close synaptic package manager. (Do not open Software centre or use apt-get through command line until up-gradation is finished.)

Now after reconnecting, start synaptic again. And again click on "Mark all Upgrades" and start updating. This time you will see, only those packages which were failed to download, are getting downloaded and others are skipped.

This is not a good solution, but it works. If synaptic or software center complain about some kind of "Lock" then go to /var/cache/apt/archives and delete the "lock" file and you will be good to go :)

1
  • One more thing. Do not keep updates pending for days. As Canonical produces newer updates, so your already downloaded files will become obsolete. Feb 15, 2013 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .