FS#27805 - [pacman] seg faults when removing firefox

Attached to Project: Pacman
Opened by John (graysky) - Monday, 02 January 2012, 14:04 GMT
Last edited by Dan McGee (toofishes) - Tuesday, 31 January 2012, 17:08 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 4.0.1
Due in Version 4.0.2
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info: When trying to remove firefox inside a 32-bit chroot, pacman seg faults.

Steps to Reproduce:
1) Install firefox package
2) Remove it via pacman -Rs firefox
This task depends upon

Closed by  Dan McGee (toofishes)
Tuesday, 31 January 2012, 17:08 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#28195 - we found a solution, to be documented soon
Comment by Dan McGee (toofishes) - Monday, 02 January 2012, 18:21 GMT
Any chance of getting a gdb backtrace on this one?
Comment by John (graysky) - Monday, 02 January 2012, 19:22 GMT
Love to... followed the debug wiki page but I can't build the pacman PKG from abs. Fully updated system with [testing] enabled. Log attached.
Comment by Dan McGee (toofishes) - Monday, 02 January 2012, 19:24 GMT
Install asciidoc and you should be good to go.
Comment by John (graysky) - Monday, 02 January 2012, 21:23 GMT
Got it installed ok now... why isn't asciidocs a dep or makedep?
Comment by John (graysky) - Monday, 02 January 2012, 21:29 GMT
Did I do it correctly? https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces

$ cat trace.log
#0 0xf7fbd4e7 in _alpm_pkg_cmp (p1=0x8128aa0, p2=0x0) at package.c:644
#1 0xf7fbe150 in unlink_file (handle=0x8060a38, info=0x8128aa0, fileobj=0x8128f90, skip_remove=0x0, nosave=0)
at remove.c:288
#2 0xf7fbf08f in _alpm_remove_single_package (handle=0x8060a38, oldpkg=0x8128aa0, newpkg=0x0, targ_count=35,
pkg_count=55) at remove.c:434
#3 0xf7fbf33a in _alpm_remove_packages (handle=0x8060a38, run_ldconfig=1) at remove.c:501
#4 0xf7fc475b in alpm_trans_commit (handle=0x8060a38, data=0xffffd74c) at trans.c:167
#5 0x08052051 in pacman_remove (targets=0x8060a28) at remove.c:168
#6 0x080507a9 in main (argc=4, argv=0xffffdb94) at pacman.c:928
Comment by Dan McGee (toofishes) - Tuesday, 03 January 2012, 01:10 GMT
Thanks- `bt full` is also very useful as it gives us more local variable state.

Is this 100% reproducible? If so, can you attach a tar.gz of /var/lib/pacman/local/ to the bug report as it exists right before you perform the removal operation.
Comment by Dan McGee (toofishes) - Tuesday, 03 January 2012, 01:37 GMT
Also, architecture details would be nice, this is looking to be tied somewhat to that.
Comment by John (graysky) - Tuesday, 03 January 2012, 01:52 GMT
Yes, 100 % reproducible. Here is the `bt full` trace and the local db.

Architecture details? It's an i686 chroot running inside an x86_64 machine running the linux-ck kernel package. CPU is an intel x3360 w/ 8 G of RAM.
Comment by Dan McGee (toofishes) - Thursday, 05 January 2012, 21:53 GMT
Why does the attached database include 191 installed packages but your original log output indicates 181? I also get 55 targets to remove rather than the 57 you got when doing `-Rs firefox`. (alsa-lib is missing, not sure what the other difference is.)

This may be important, as neither Allan nor I can reproduce the segfault.
Comment by John (graysky) - Thursday, 05 January 2012, 22:01 GMT
I can only guess because you asked for the db before I did the remove. It seg faults after it removed some packages.
Comment by Dan McGee (toofishes) - Thursday, 05 January 2012, 22:06 GMT
I'm talking very specifically about these lines in your output BEFORE the removal happens:

debug: added 181 packages to package cache for db 'local'
and
Targets (57): alsa-lib-1.0.24.1-1 atk-2.2.0-1 cairo-1.10.2-2 compositeproto-0.4.2-1 damageproto-1.2.1-1

I see 191/55 respectively.
Comment by John (graysky) - Friday, 06 January 2012, 00:09 GMT
@toofishes - I don't know what to say. I tarred-up the db and then did the debugging as requested. Glad to do anything else to help sort this out.
Comment by Dan McGee (toofishes) - Friday, 06 January 2012, 00:42 GMT
What do you want me to say here? I'm missing something...

If you run this again now,
1) what is the output? (e.g. 181 or 191 packages in local DB, or just attach the --debug log again)
2) is it still broken?
Comment by John (graysky) - Friday, 06 January 2012, 20:18 GMT
OK... three attachements:

complete_log.log -- everything I typed in the shell
local_db.tar.xz -- the db before I removed firefox
trace-try2.log -- the trace.log

As well, here is a rough log of what I did omitting the details contained in the logs. Plz let me know if I can provide anything else to help and thanks for your time!

$ pacman -Qq | wc -l
191

# tar Jcf local_db.tar.xz /var/lib/pacman/local/
(attached to report)

# gdb pacman
(gdb) run --debug -Rs firefox
...
...
(gdb) set logging file trace-try2.log
(gdb) set logging on
Copying output to trace-try2.log.
(gdb) bt full
...
(gdb) set logging off
Done logging to trace-try2.log.
(gdb) quit

# pacman -Qq | wc -l
157
Comment by Dan McGee (toofishes) - Saturday, 07 January 2012, 02:56 GMT
Darn, this one is really stumping me. I cannot reproduce it at all.

What happens when you do 'pacman -Rdd libxrender renderproto', does that segfault?

We may unfortunately need a copy of your whole chroot (or somehow get access to it) to solve this, given our normal troubleshooting methods are not working.
Comment by John (graysky) - Saturday, 07 January 2012, 13:31 GMT
@toofishes - no segfault there AND if I go on to remove firefox, no segfault! If however I repeat the original 'pacman -Rs firefox' command, I get the same segfault.

I also attached the daemon script I call to start my chroot (/etc/rc.d/arch32). Is there anything in there that can potentially explain this?
I am glad to compress the entire chroot for you guys.

Comment by John (graysky) - Saturday, 07 January 2012, 15:53 GMT
I went ahead and tarred-up the chroot for you (only 126 MB). I encrypted the tar.xz with your key, Dan. I'm no security expert by any means so there could be some personal stuff in the archive. I trust you though :) Please keep the contents of the file to yourself and to the other devs.

http://repo-ck.com/junk/graysky_arch32_chroot-20120107.tar.xz.gpg
Comment by Dan McGee (toofishes) - Saturday, 07 January 2012, 15:55 GMT
Awesome, thank you. I'll encrypt it for Allan if necessary but shouldn't need to give it to anyone else. Thank you!
Comment by Dan McGee (toofishes) - Saturday, 07 January 2012, 17:01 GMT
I cannot get this to break. :(

I took your chroot, installed it to the same place, modified your script (only slightly, e.g., don't mount /media stuff), and then did `sudo linux32 chroot /opt/arch32`. Once there, I reinstalled the two missing packages with `pacman -S --asdeps libxrender renderproto`, and then did the -Rs command. No luck breaking things, as the removal proceeded all the way through.
Comment by John (graysky) - Saturday, 07 January 2012, 18:50 GMT
Man, wtf? Does this mean something is up with my hardware? I did the same thing you did (even modded the script not to mount /media/data):

$ sudo linux32 chroot /opt/arch32 /bin/bash

[root@simplicity /]# pacman -Rs firefox
checking dependencies...

Targets (55): atk-2.2.0-1 cairo-1.10.2-2 compositeproto-0.4.2-1 damageproto-1.2.1-1 dbus-glib-0.98-1
desktop-file-utils-0.19-1 fixesproto-5.0-1 gdk-pixbuf2-2.24.1-1 gnutls-3.0.10-1
gtk-update-icon-cache-2.24.8-2 gtk2-2.24.8-2 hicolor-icon-theme-0.12-1 hunspell-1.3.2-1
inputproto-2.0.2-1 keyutils-1.5.5-1 krb5-1.9.2-2 libcups-1.5.0-1 libdatrie-0.2.5-1
libevent-2.0.16-1 libice-1.0.7-1 libjpeg-turbo-1.1.1-4 libnotify-0.7.4-1 libpng-1.4.8-1
libsm-1.2.0-1 libtasn1-2.9-1 libthai-0.1.16-1 libtiff-3.9.5-1 libvpx-0.9.7.p1-1
libxcomposite-0.4.3-1 libxcursor-1.1.12-1 libxdamage-1.1.3-1 libxext-1.3.0-1 libxfixes-5.0-1
libxft-2.2.0-1 libxi-1.4.5-1 libxinerama-1.1.1-1 libxrandr-1.3.2-2 libxrender-0.9.6-1
libxt-1.1.1-1 mime-types-8-1 mozilla-common-1.4-3 nettle-2.4-1 nspr-4.8.9-2 nss-3.13.1-2
p11-kit-0.9-1 pango-1.29.4-1 pixman-0.24.0-1 randrproto-1.3.2-1 renderproto-0.11.1-1
shared-mime-info-0.91-1 startup-notification-0.12-2 xcb-util-0.3.8-1 xextproto-7.2.0-1
xineramaproto-1.2.1-1 firefox-9.0.1-1

Total Removed Size: 118.82 MiB

Do you want to remove these packages? [Y/n]
( 1/55) removing firefox [#####################################] 100%
( 2/55) removing startup-notification [#####################################] 100%
( 3/55) removing xcb-util [#####################################] 100%
( 4/55) removing nss [#####################################] 100%
( 5/55) removing nspr [#####################################] 100%
( 6/55) removing mozilla-common [#####################################] 100%
( 7/55) removing mime-types [#####################################] 100%
( 8/55) removing libxt [#####################################] 100%
( 9/55) removing libsm [#####################################] 100%
(10/55) removing libice [#####################################] 100%
(11/55) removing libvpx [#####################################] 100%
(12/55) removing libnotify [#####################################] 100%
(13/55) removing libevent [#####################################] 100%
(14/55) removing hunspell [#####################################] 100%
(15/55) removing hicolor-icon-theme [#####################################] 100%
(16/55) removing gtk2 [#####################################] 100%
(17/55) removing shared-mime-info [#####################################] 100%
(18/55) removing pango [#####################################] 100%
(19/55) removing libxft [#####################################] 100%
(20/55) removing libthai [#####################################] 100%
(21/55) removing libdatrie [#####################################] 100%
(22/55) removing cairo [#####################################] 100%
(23/55) removing pixman [#####################################] 100%
(24/55) removing libxrandr [#####################################] 100%
(25/55) removing randrproto [#####################################] 100%
(26/55) removing libxinerama [#####################################] 100%
(27/55) removing xineramaproto [#####################################] 100%
(28/55) removing libxi [#####################################] 100%
(29/55) removing libxext [#####################################] 100%
(30/55) removing inputproto [#####################################] 100%
(31/55) removing libxdamage [#####################################] 100%
(32/55) removing damageproto [#####################################] 100%
(33/55) removing libxcursor [#####################################] 100%
(34/55) removing libxrender [#####################################] 100%
(35/55) removing renderproto [-------------------------------------] 0%
error: segmentation fault
Please submit a full bug report with --debug if appropriate.

I will copy the chroot archive to my laptop and try it as you have. Give me a few hours.
Comment by John (graysky) - Saturday, 07 January 2012, 19:07 GMT
Wow. Seems to be a problem specific to my workstation, but wft?

[facade@workstation]$ scp graysky_arch32_chroot-20120107.tar facade@larch:/tmp
[facade@workstation]$ ssh laptop

[root@laptop]# cd /tmp && tar xf graysky_arch32_chroot-20120107.tar
[root@laptop]# linux32 chroot /tmp/opt/arch32 /bin/bash

[root@laptop-chroot]# pacman -Rs firefox
checking dependencies...

Targets (55): atk-2.2.0-1 cairo-1.10.2-2 compositeproto-0.4.2-1 damageproto-1.2.1-1 dbus-glib-0.98-1
desktop-file-utils-0.19-1 fixesproto-5.0-1 gdk-pixbuf2-2.24.1-1 gnutls-3.0.10-1
gtk-update-icon-cache-2.24.8-2 gtk2-2.24.8-2 hicolor-icon-theme-0.12-1 hunspell-1.3.2-1
inputproto-2.0.2-1 keyutils-1.5.5-1 krb5-1.9.2-2 libcups-1.5.0-1 libdatrie-0.2.5-1
libevent-2.0.16-1 libice-1.0.7-1 libjpeg-turbo-1.1.1-4 libnotify-0.7.4-1 libpng-1.4.8-1
libsm-1.2.0-1 libtasn1-2.9-1 libthai-0.1.16-1 libtiff-3.9.5-1 libvpx-0.9.7.p1-1
libxcomposite-0.4.3-1 libxcursor-1.1.12-1 libxdamage-1.1.3-1 libxext-1.3.0-1 libxfixes-5.0-1
libxft-2.2.0-1 libxi-1.4.5-1 libxinerama-1.1.1-1 libxrandr-1.3.2-2 libxrender-0.9.6-1
libxt-1.1.1-1 mime-types-8-1 mozilla-common-1.4-3 nettle-2.4-1 nspr-4.8.9-2 nss-3.13.1-2
p11-kit-0.9-1 pango-1.29.4-1 pixman-0.24.0-1 randrproto-1.3.2-1 renderproto-0.11.1-1
shared-mime-info-0.91-1 startup-notification-0.12-2 xcb-util-0.3.8-1 xextproto-7.2.0-1
xineramaproto-1.2.1-1 firefox-9.0.1-1

Total Removed Size: 118.82 MiB

Do you want to remove these packages? [Y/n]
( 1/55) removing firefox [#####################################] 100%
( 2/55) removing startup-notification [#####################################] 100%
( 3/55) removing xcb-util [#####################################] 100%
( 4/55) removing nss [#####################################] 100%
( 5/55) removing nspr [#####################################] 100%
( 6/55) removing mozilla-common [#####################################] 100%
( 7/55) removing mime-types [#####################################] 100%
( 8/55) removing libxt [#####################################] 100%
( 9/55) removing libsm [#####################################] 100%
(10/55) removing libice [#####################################] 100%
(11/55) removing libvpx [#####################################] 100%
(12/55) removing libnotify [#####################################] 100%
(13/55) removing libevent [#####################################] 100%
(14/55) removing hunspell [#####################################] 100%
(15/55) removing hicolor-icon-theme [#####################################] 100%
(16/55) removing gtk2 [#####################################] 100%
(17/55) removing shared-mime-info [#####################################] 100%
(18/55) removing pango [#####################################] 100%
(19/55) removing libxft [#####################################] 100%
(20/55) removing libthai [#####################################] 100%
(21/55) removing libdatrie [#####################################] 100%
(22/55) removing cairo [#####################################] 100%
(23/55) removing pixman [#####################################] 100%
(24/55) removing libxrandr [#####################################] 100%
(25/55) removing randrproto [#####################################] 100%
(26/55) removing libxinerama [#####################################] 100%
(27/55) removing xineramaproto [#####################################] 100%
(28/55) removing libxi [#####################################] 100%
(29/55) removing libxext [#####################################] 100%
(30/55) removing inputproto [#####################################] 100%
(31/55) removing libxdamage [#####################################] 100%
(32/55) removing damageproto [#####################################] 100%
(33/55) removing libxcursor [#####################################] 100%
(34/55) removing libxrender [#####################################] 100%
(35/55) removing renderproto [#####################################] 100%
(36/55) removing libxcomposite [#####################################] 100%
(37/55) removing libxfixes [#####################################] 100%
(38/55) removing compositeproto [#####################################] 100%
(39/55) removing fixesproto [#####################################] 100%
(40/55) removing xextproto [#####################################] 100%
(41/55) removing libcups [#####################################] 100%
(42/55) removing krb5 [#####################################] 100%
(43/55) removing keyutils [#####################################] 100%
(44/55) removing gnutls [#####################################] 100%
(45/55) removing p11-kit [#####################################] 100%
(46/55) removing nettle [#####################################] 100%
(47/55) removing libtasn1 [#####################################] 100%
(48/55) removing gtk-update-icon-cache [#####################################] 100%
(49/55) removing gdk-pixbuf2 [#####################################] 100%
(50/55) removing libpng [#####################################] 100%
(51/55) removing libtiff [#####################################] 100%
(52/55) removing libjpeg-turbo [#####################################] 100%
(53/55) removing atk [#####################################] 100%
(54/55) removing desktop-file-utils [#####################################] 100%
(55/55) removing dbus-glib [#####################################] 100%

Loading...