What is apt-check and why does it run during boot?

So during one of the sessions at UDS-P, I discovered this cool (and useful) program called bootchart.

After installing it and then running it, I analyzed it and compared it some of the results here. There is a program running during boot called "apt-check," for somewhere in the ballpark of 40 seconds and it's using a lot of CPU. Which makes me ask these 2 questions:

  1. What is apt-check?
  2. Why does it run during boot?

I am running the on a single-core Atom processor (N270), dual-boot machine running Ubuntu 11.10 and Windows XP Home.


Solution 1:

One of the services started at boot time from upstart is mounted-run (as you can see in /etc/init/). The comment at start of the file says:

# mounted-run - Populate and link to /run filesystem
#
# Populates the /run filesystem and adds compatibility links to it

Among other things, it executes:

run-parts --lsbsysinit /etc/update-motd.d

i.e., executes every script in /etc/update-motd.d to update the message that you see when you log-in to a textual console, or through ssh (motd = message of the day). This message also says if there are packages to be upgraded and if a reboot is required.

In this dir you find the script 90-updates-available that in turn calls

/usr/lib/update-notifier/update-motd-updates-available

that, based on a timestamp, calls /usr/lib/update-notifier/apt-check.
This python script update the repositories, so it take some time to execute, but depending on the timestamp of the last update, it is not always executed at boot.