apt-get and apt-cache Segmentation fault (core dumped)

Bug #113424 reported by Ray Ward
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Binary package hint: apt

After an upgrade to Ubuntu 7.04.
I started synaptic and my system froze. Rebooted and tried again same thing. Third time I had a terminal open and was able to observe lots of apt-cache running then dyeing. Well lets try it the old fashioned way apt-get update that's when I got the segmentation error.

Revision history for this message
Ray Ward (ray-ward4) wrote :

Copy of the crash dump file.

Revision history for this message
Ray Ward (ray-ward4) wrote :

How I fixed this.
http://www.linuxforums.org/forum/debian-linux-help/51937-aptitude-problem-problem-mergelist.html
Do the following.
sudo rm /var/lib/apt/lists/* -vf
Back it up first of course.
This may not be necessary but you must understand these are the steps I took.
Next do sudo apt-get update
This updates the list folder.
If you get the following error E: Dynamic MMap ran out of room

Its time to edit the config file for apt. Ubuntu users can find this in the following location.
/etc/apt/apt.conf.d/70debconf
Add the following line.
APT::Cache-Limit "118388608";

Big number.
It started off without the first two digits but I kept getting the same error this fixed it. No more core dumps.
Fire up synaptic. Bang what now?
apt-get -f install synaptic
Response in English your libraries are out of date and your nuts are in a vice try running apt-get -f install on it's own.
This did however work.
apt-get -f install synaptic
Response well it worked. Synaptic now works without error.
You should do an apt-get autoclean as theres a lot of stuff that needs to be cleared out.
Warning always take care when removing files on a live system. This machine has bucket loads of space so reinstalling and moving data to a fresh install does not bother me.

Revision history for this message
C de-Avillez (hggdh2) wrote :

I cannot find a reference to the default size of the cache. Will look at the source.

Revision history for this message
C de-Avillez (hggdh2) wrote :

I cannot find a reference to the default size of the cache. Will look at the source. Also, I am not sure this is a bug by itself, since (I am *guessing*) tyhis will only happen if one has lots of distributions in the apt source list.

No matter what, perhaps a bit more of docs? keeping unconfirmed.

Changed in apt:
importance: Undecided → Medium
Revision history for this message
Ray Ward (ray-ward4) wrote :

Depends on how you look at it. Here is a plausible account of what might have happened .
Apt-get update starts to update then runs out of Cache-Limit space which corrupts some files in the lists folder.
Next time you run apt-get it goes bang with a core dump error.
Clearing out the lists folder stops apt going bang but revels the Cache-Limit problem.
It's a bit of a chicken and egg problem.
I have to say since I made the above changes I have not had a problem.
Nice to know you have take an interest.
Regards
Ray

Revision history for this message
Ray Ward (ray-ward4) wrote :

PS I confirm there were a lot of items in the sources list but trimming the list did not resolve the problem.
removing the contents of /var/lib/apt/lists/ changed the problem and revealed the Cache-Limit error which was handled correctly.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Sorry for the delay, got entangled on some other issues.

What I found is that Cache-Limit gets defaulted to either 16M (in apt-pkg/pkgcachegen.cc, at function pkgMakeStatusCache, or to 12M (same source, function pkgMakeOnlyStatusCache.

So... I think you are correct. I have not stopped to find how much memory gets used by the MMAPped list, but it stands to reason that as the number of lists increase, we will probably get larger MMAP usage.

Nevertheless, I would expect that doubling the default should be sufficient for most. In your case (and I did the same when I found this bug) you are between 8 and 10 times larger -- we really should not need that much.

Revision history for this message
Ray Ward (ray-ward4) wrote :

Well done. As you say It doubling probably is sufficient I just did it that way because it required no thought (lazy). Well I can confirm it's still working without any problems.

Revision history for this message
Ray Ward (ray-ward4) wrote :

I just changed the Cache-Limit to 16777216 which is exactly double 8388608 the original value I grabbed from Linux forums. Apt and synaptic worked fine. There is one problem with all this as more and more shiny things appear in the lists its gona come back.

Revision history for this message
Ray Ward (ray-ward4) wrote :

Whoops Spoke too soon.
E: Dynamic MMap ran out of room
E: Read error - read (14 Bad address)
E: The package lists or status file could not be parsed or opened.
E: _cache->open() failed, please report.
Here we go again.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Ray, 16,777,216 is the default size -- the Linux forums where you got this value may be referencing an older version of apt or, perhaps, the upstream one. At least for Gutsy, this is the default (actually, it is set as 16*1024*1024, which is just a different way).

RIght now I am running apt with complete gutsy-only (i.e., no additional repositories), and the default is enough.

Can you please try it with 32M -- 33,554,432? This should be way more than needed.

I hope :-)

Also -- it may be that the lists got corrupted again, so you might need to rebuild them from scratch.

Revision history for this message
Ray Ward (ray-ward4) wrote :

I did clean out the lists folder straight after the whoops and rebuilt with another lazy value which does now work it just happens to be 2 meg smaller than the one you suggested but i'll up the value anyway since theres no harm in more space.
Im using the Mircrosoft stuff at the monent so Ill pop a note in later.

Many Thanks.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Marking as duplicate of bug 24626.

Changed in apt:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.