linux - Prevent apt-check from eating all my memory

23
2014-04
  • Yoga

    On Ubuntu 12.04 LTS, with server of 512MB RAM, the apt-check is using up to 250 memory and cause my system to un-usable every night, e.g.

    ps ax | grep apt
    14895 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14896 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14899 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14902 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14906 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14912 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14913 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14914 ?        DN     0:01 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14915 ?        DN     0:01 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14916 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14917 ?        DN     0:01 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    14920 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    15299 ?        DN     0:01 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    15302 ?        DN     0:02 /usr/bin/python /usr/lib/update-notifier/apt-check --human-readable
    16368 pts/0    D+     0:00 grep apt
    

    What the heck this script is running multiple time and eating my system resource? There is a bug here [1] which is confirmed but without any resolution. I am a little surprised that this bug is critical and exists in the LTS, sigh...

    Anyway, Not sure when the ubuntu team is able to fix, Any idea how to do it by us?

    [1] https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/746508

  • Answers
  • John Siu

    Disable update-notifier

    If you want to disable update-notifier, you can follow instruction in this link.

    Modified Quote from link

    1. Method 1 - Disable for one user

      Create a local(user) copy of update-notifier.desktop

      mkdir -p ~/.config/autostart
      cp /etc/xdg/autostart/update-notifier.desktop ~/.config/autostart/
      vim ~/.config/autostart/update-notifier.desktop
      

      Find this line in the local file

      X-GNOME-Autostart-Delay=60
      

      Replace with:

      X-GNOME-Autostart-enabled=false
      

      Now log out and in again, or kill the running update-notifier:

      killall update-notifier
      
    2. Method 2 - Disable for all users

      Do the same as method 1, but instead of modifying a local/user copy, modify /etc/xdg/autostart/update-notifier.desktop

    Manually Check for update

    After disabling update-notifier, use Update Manager(GUI), or following command line to check for package update

    sudo apt-get update
    sudo apt-get dist-upgrade
    

    The first line download the latest package list from repository. The second line will show all installed packages with update available.

  • Tonin

    If you're running a server install of Ubuntu with a very limited RAM configuration, I'd suggest you disable completely the automatic actions from update-notifier. You could even remove this package.

    However you might still want some automatic updates to run to ensure your system gets the security fixes. One very lightweight and handy tool to do that on a server is cron-apt, it can notify you of updates through email.

    Here are some instructions to install and configure it to your needs. This article on Debian Administration is also worth reading.

  • Andrea de Palo

    On my Debian machines I prefer to install unattended-upgrades and anacron, then add the following lines to /etc/apt/apt.conf

    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Unattended-Upgrade "1";
    

    This will run an "apt-get update", "apt-get upgrade" every day, in a fully automated way (and without any major overhead)


  • Related Question

    Ubuntu apt-get install (--download-only) executed from another machine on behalf of mine
  • Maroloccio

    I have a server on a network segment with no direct or indirect access to the Internet. I want to perform an:

    apt-get install <package_name>
    

    Is there a way to somehow delegate the process of downloading the required files to another machine by exporting the server configuration so as to satisfy all dependencies while running:

    apt-get install --download-only <package_name>
    

    Can, in effect, apt-get install read a configuration from an exported archive rather than from the local package database?

    Can the list of packages to be downloaded be retrieved, along with an installation script to perform the installation, instead of the actual packages? (a further level of indirection which would help me schedule this with wget at appropriate times...)


  • Related Answers
  • pjz

    If there's a candidate machine, you might try apt-proxy, or the aforementioned apt-offline.

  • Seasoned Advice (cooking)

    Apt on CD is one option, though this is really for creating a repository from packages in use on another machine which isn't quite what you were wanting. Apt Offline is another option which can be used to update your packages offline, and finally you can come up with your own solution involving the --print-uris option of apt-get and wget.