apt-get always crash with Segmentation fault (core dumped) if /var/log/apt doesn't exist.

Bug #535509 reported by marcobra (Marco Braida) on 2010-03-10
152
This bug affects 40 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Medium
Unassigned
Lucid
Undecided
Unassigned
Maverick
Medium
Unassigned

Bug Description

TEST CASE:

1. get rid of the log directory
2. $ sudo mv /var/log/apt /var/log/apt.bak

3 try to install/remove a package (I'll use htop here)
$ sudo apt-get install htop
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  strace ltrace
The following NEW packages will be installed:
  htop
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 66.1kB of archives.
After this operation, 217kB of additional disk space will be used.
Get:1 https://ftp-stud.hs-esslingen.de/ubuntu/ lucid/universe htop 0.8.3-1ubuntu1 [66.1kB]
Fetched 66.1kB in 1s (57.1kB/s)
Selecting previously deselected package htop.
(Reading database ... 65298 files and directories currently installed.)
Unpacking htop (from ../htop_0.8.3-1ubuntu1_amd64.deb) ...
Setting up htop (0.8.3-1ubuntu1)

Segmentation fault
4. verify the that it segfaults
5. install apt from lucid-proposed
6. repeat step 3 and verify that the segfault is gone

Binary package hint: apt

Description: Ubuntu lucid (development branch)
Release: 10.04

apt:
  Installed: 0.7.25.3ubuntu1
  Candidate: 0.7.25.3ubuntu1
  Version table:
 *** 0.7.25.3ubuntu1 0
        500 http://archive.ubuntu.com lucid/main Packages
        100 /var/lib/dpkg/status

If you try to run apt and /var/log/apt doesn't exist (because you mounted /var/log as a tmpfs for example) apt will segfault at the end when trying to save the logs.

The fixed package doesn't segfault anymore and tells you "E: Directory '/var/log/apt/' missing" instead.

tags: added: apt apt-get aptitude core crash dump
Matthias G. (matgnt) wrote :

Same problem here. With strace I figured out that it stops while checking the history in /var/log/apt/history.log.
If there is no directory /var/log/apt/ you will get a segmentation fault. Can you please check this?

khanh (ink-bur) wrote :

I get the same problem. I can confirm that after I created /var/log/apt the problem went away.

Matthias G. (matgnt) on 2010-05-26
Changed in apt (Ubuntu):
status: New → Confirmed
Peter Wu (lekensteyn) wrote :

Thanks Matthias G.!
Creating a /var/log/apt directory fixed it for me.
Shouldn't apt create this directory if it doesn't exist?

Matthias G. (matgnt) wrote :

To clear my above post a bit, I'm not sure if it really happens while "checking" the file, it might rather be when apt tries to add the installed packages to the history file.

The package version is: 0.7.25.3ubuntu9

@Lekensteyn
Yes, I think so. Especially in /var/log. At least an error message should be shown, but a segmentation fault is definetly not a good behavior ;)

Matthias G. (matgnt) wrote :

I guess most people will get this error using tmpfs in /etc/fstab because they use a SSD in their system. So a quick fix is to simply add a line for /var/log/apt as well - as proposed in https://help.ubuntu.com/community/EeePC/Using#Reducing%20Drive%20Writes

tmpfs /var/log tmpfs defaults 0 0
tmpfs /var/log/apt tmpfs defaults 0 0

But anyway, the segmentation fault should be fixed.

Philip Muškovac (yofel) on 2010-06-19
summary: - apt-get always crash with Segmentation fault (core dumped)
+ apt-get always crash with Segmentation fault (core dumped) if
+ /var/log/apt doesn't exist.
Matthias G. (matgnt) on 2010-06-21
Changed in apt (Ubuntu):
status: Confirmed → Fix Committed
Ali Utku Selen (auselen) wrote :

see 506342

Philip Muškovac (yofel) on 2010-06-23
Changed in apt (Ubuntu):
importance: Undecided → Medium
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.7.25.3ubuntu10

---------------
apt (0.7.25.3ubuntu10) maverick; urgency=low

  [ Michael Vogt ]
  * debian/apt.conf.ubuntu:
    - no longer install (empty) apt.conf.d/01ubuntu
  * apt-pkg/deb/dpkgpm.cc:
    - make the apt/term.log output unbuffered (thanks to Matt Zimmerman)
    - fix FTBFS (LP: #600155)

  [ Matthias G. ]
  * apt-pkg/deb/dpkgpm.cc:
    - Fix segmentation fault when /var/log/apt ist missing. LP: #535509
 -- Michael Vogt <email address hidden> Thu, 08 Jul 2010 09:37:03 +0200

Changed in apt (Ubuntu):
status: Fix Committed → Fix Released
Christophe Dumez (hydr0g3n) wrote :

This bug has not been fixed in Lucid (probably only in Maverick).

Shouldn't it be fixed in Lucid too?

Michael Vogt (mvo) on 2010-07-15
Changed in apt (Ubuntu Lucid):
status: New → In Progress
Philip Muškovac (yofel) on 2010-07-15
description: updated
description: updated
description: updated
description: updated
Michael Vogt (mvo) on 2010-07-15
description: updated

Accepted apt into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in apt (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Philip Muškovac (yofel) wrote :

After installing apt from lucid-proposed it now prints

E: Directory '/var/log/apt/' missing

instead of crashing.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.7.25.3ubuntu9.1

---------------
apt (0.7.25.3ubuntu9.1) lucid-proposed; urgency=low

  * apt-pkg/deb/dpkgpm.cc:
    - Fix segmentation fault when /var/log/apt ist missing. LP: #535509
 -- Michael Vogt <email address hidden> Thu, 15 Jul 2010 14:35:30 +0200

Changed in apt (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers