Lately there seems to be a rash of the APT package management system suddenly dying on Debian / Ubuntu based systems.  Troubleshooting this on a Linux Mint 17 install using MATE, we discovered several possible palliative measures along with a working solution to the problem of apt hitting a segmentation fault and crashing during cache loading.

Symptoms

GUI Apps

  • Synaptic and Software Manager simply don’t start at all, bombing out silently before displaying the UI.
  • Update Manager always displays “Your system is up to date” even after manually refreshing.

CLI Apps

  • apt-get update breaks and reports a segmentation fault:
    ...
    Ign http://archive.ubuntu.com trusty/universe Translation-en_US                
    Fetched 3,438 kB in 27s (125 kB/s)                                             
    Segmentation fault
    E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'
    E: Sub-process returned an error code
  • aptitude will display “Loading Cache” and then bomb out with the unhelpful message “Ouch! Got SIGSEGV, dying..”

Diagnosis

The first thing to check on the troubled system is dmesg and syslog for clues:

$ dmesg | grep apt
Oct  8 10:28:22 etown kernel: [ 4807.432466] aptitude[5868]: 
segfault at 7f13ee640fc4 ip 00007f13f21180d7 sp 00007fff1d7ce6a0 
error 6 in libapt-pkg.so.4.12.0[7f13f2029000+144000]

$syslog | grep apt
Oct  8 11:01:48 etown kernel: [ 6814.538186] apt-show-versio[6794]: 
segfault at 7f56ef3cdfc4 ip 00007f56f04310d7 sp 00007ffd2bb5e060 
error 6 in libapt-pkg.so.4.12.0[7f56f0342000+144000]

So either log can provide us with a clue as to what’s going on – in this case, a segfault originating in the library libapt-pkg.so.4.12.0.

Treatment

While this segmentation fault issue with apt is a known bug, the package maintainer is unwilling/unable to address the problem. 

Fortunately, a work around can be found in the comments courtesy of Ken Sharp (kennybobs).  All one need do (as root) is to edit /etc/apt/apt.conf.d/70debconf and add the following setting to the end of the file: 

APT::Cache-start 200000000;

This will allot enough memory for apt to run without segfault.


Other methods that were tried and failed included

Related Posts
I dislike Ubuntu's built in remote desktop service, and use x11vnc instead. Recently I was having a terrible time recently remotely accessing an Ubuntu+Gnome workstation: when I connect from a ...
READ MORE
Recently we needed to re-purpose an Ubuntu workstation as a server.  Since it was already running some of the services the server was to provide, we didn't want to wipe ...
READ MORE
GNOME has always been my go-to window manager on Linux, usually on Ubuntu.  However, it does have a few annoying quirks and deficiencies.  One of the most aggravating ones is ...
READ MORE
Installing Webalizer and Publishing Analytics to Your Website
For Linux users hosting their own websites using Apache, the log files provide a wealth of analytics information about bandwidth usage, visitor locales, referrers & keywords, etc.  However, they're not ...
READ MORE
While Ubuntu does many things well out of the box, being able to recognize Android devices connected by USB is not one of them.  Instead the devices have to be ...
READ MORE
Getting Shift Key Working With x11vnc and VNC
Linux: Disable GUI on Start Up
Disable Numpad Mouse Keys on Linux+GNOME Permanently
Installing Webalizer and Publishing Analytics to Your Website
Mounting your Android’s SD Card on Ubuntu