How to use strace to fix program dependencies on Arch Linux

It's been several months since I last updated my Arch Linux system, and as you may know, one of Arch's main advantages is that it always provides you with the latest programs. There's no punctual release, you just update your system when you want and it retrieves the latest packages.

Since the packages are updated so fast, the dependencies usually aren't perfectly right because they didn't go through a lot of testing. The solution is to keep your system up to date as much as possible. For example, if you try to only update specific packages, one of them will eventually break because some library it depends on isn't up to date, but the person who released the package didn't think about it ahead.

In my case, I just repaired a computer that hasn't been running for several months. I wanted to update some packages such as Firefox, but I didn't have the time to update the whole system at this moment (I usually run the whole system updates during the night). So I updated Firefox, but couldn't launch it:

> firefox
Couldn't load XPCOM.

Usually I try to update the packages that seem related to the error message, ask Google and son on, but here we don't have a lot of information to help us (Google searches showed me irrelevant issues from several years ago.)

Turns out there's a nice simple tracing tool, strace, that can help us find the issue. Simply run strace firefox, and you'll probably see a lot of information about the system calls Firefox issues. I find it difficult to read through so much information in the console (522 lines in my case), so let's redirect it to a file:

> strace firefox 2> log
less log

The last lines show us the exact problem:

open("/lib/libevent-2.0.so.5", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libevent-2.0.so.5", O_RDONLY) = -1 ENOENT (No such file or directory)
munmap(0xb74b1000, 136037)              = 0
munmap(0xb788c000, 14192)               = 0
munmap(0xb63b5000, 14665748)            = 0
munmap(0xb632a000, 569068)              = 0
munmap(0xb7449000, 215860)              = 0
munmap(0xb7423000, 155564)              = 0
munmap(0xb62fc000, 188240)              = 0
munmap(0xb62d8000, 147256)              = 0
munmap(0xb61c6000, 1122040)             = 0
munmap(0xb7874000, 97164)               = 0
munmap(0xb741b000, 29356)               = 0
munmap(0xb6141000, 544680)              = 0
munmap(0xb6113000, 187780)              = 0
munmap(0xb7406000, 82604)               = 0
munmap(0xb60bd000, 351568)              = 0
munmap(0xb71b2000, 1367492)             = 0
munmap(0xb747e000, 208384)              = 0
write(2, "Couldn't load XPCOM.\n", 21Couldn't load XPCOM.
)  = 21
exit_group(1)                           = ?

Presumably, there's a library called “event” that failed to load because it isn't up to date. Is there any update available?

> pacman -Qu | grep event
libevent 1.4.14b-1

Yep. Just update it, and Firefox works again!