7

I have a following minimalistic sources.list file:

root@c:~# cat /etc/apt/sources.list
deb http://ftp.fi.debian.org/debian/ wheezy main
root@c:~# apt-get update
Hit http://ftp.fi.debian.org wheezy Release.gpg
Hit http://ftp.fi.debian.org wheezy Release
Hit http://ftp.fi.debian.org wheezy/main i386 Packages
Hit http://ftp.fi.debian.org wheezy/main Translation-en
Reading package lists... Done
root@c:~# 

Now when I try to install a package, I end up with segmentation fault. For example:

root@c:~# apt-get install tcpdump
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Segmentation fault
root@c:~#

In /var/log/messages there is a following entry logged:

Mar 29 05:46:25 c kernel: [ 4677.384747] apt-get[5607]: segfault at b8647e30 ip b8647e30 sp bfaaa9c8 error 14

The last (sp) number always changes, i.e if I execute apt-get install nmap three times, then following is logged:

Mar 29 05:46:59 c kernel: [ 4711.046400] apt-get[5612]: segfault at b86cbe30 ip b86cbe30 sp bfb36ea8 error 14
Mar 29 05:47:02 c kernel: [ 4714.229648] apt-get[5616]: segfault at b8609e30 ip b8609e30 sp bfcecec8 error 14
Mar 29 05:47:03 c kernel: [ 4715.505656] apt-get[5620]: segfault at b86dae30 ip b86dae30 sp bfb4b588 error 14

I have tried with different repositories and cleaned local repository of retrieved package files. What might cause segment fault when installing a package? Is my apt-get broken?

5
  • This is most likely a hardware issue. What is the output of dpkg -C? Mar 29, 2015 at 4:34
  • @FaheemMitha A hardware issue? Anyway, there is no output for `dpkg -C. Just an exit code 0 so I guess there are no partially installed packages in my system.
    – Martin
    Mar 29, 2015 at 13:19
  • Yes, I can't think of another reason why apt would segfault on you. If you want, you could try reinstalling it. apt-get download apt (check that this is the same as the version you are using - it should be). Then dpkg -i apt...deb. Mar 29, 2015 at 14:30
  • Addendum: I'd start with checking your memory and hard drives. Mar 29, 2015 at 16:49
  • Does the error reproduces with aptitude: aptitude install tcpdump ?
    – user34720
    Mar 30, 2015 at 13:21

5 Answers 5

3

Have you tried using strace to diagnose the problem?

I have a similar problem which seems to be related to the google-earth package -- something in the meta-data for the package causes apt-get (or some component of the apt system) to segfault.

I discovered this by using:

sudo strace -f apt-get update >log.strace-aptget 2>&1

Looking at the log file, I could see that, after reading the file /var/lib/apt/lists/dl.google.com_linux_earth_deb_dists_stable_Release, apt-get did a mremap() which caused a segfault. I commented out the google-earth entry in sources.list (actually, in /etc/apt/sources.list.d/google-earth.list) and now apt-get works fine. (Of course, I now cannot update google-earth, but at least apt-get is working.)

2
  • 1
    Any segfault at the software level is a bug. I hope you reported this as an apt bug. If not, please do so. People normally use the reportbug to do so. Apr 16, 2015 at 15:41
  • This worked perfectly for me. I had to comment out a virtualbox.org entry. Jan 4, 2022 at 2:37
2

Run following commands: I got a fix through it.

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/locksudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/apt.extended_states.0 /var/lib/dpkg/status
sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo rm /var/cache/apt/*.bin
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
sudo apt-get upgrade
1
  • Thank you so much! I do not know why this worked and nothing else did. Apr 23, 2022 at 12:19
1

I have started experiencing the same thing in Precise. To workaround this issue I added a file /etc/apt/apt.conf.d/00bugs which contains one line:

APT::Cache-start 200000000;

The segmentation faults no longer occur. I have opened a bug report for this: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1445436

0

I fixed a problem with my sources.list by resetting it with the following command:

sudo apt-get install --reinstall apt
1
  • and i get segmentation fault exactly at this command
    – holms
    May 22, 2021 at 23:11
0

Obviously there are probably lots of reasons for segfaults. In my case, it was related to a partially installed package. Some commands also gave me E: The package cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00 needs to be reinstalled, but I can't find an archive for it. while other apt commands like apt search ____ exited with a segfault.

The solution in my case was to do sudo dpkg --remove --force-all cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00 and then sudo apt-get update. After that, my apt search _____ command worked fine again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .