-   Linux - General (
-   -   KDE slow: takes 20 seconds to launch programs (

KWTm 03-06-2005 12:01 AM

"strace" shows KDE programs seeking library files in wrong places, delaying startup
To follow up with my previous query, I browsed through some of the archives at I'd have to say that the geek factor there is higher than here, and newbies might find it a bit daunting. Anyway, from there I learned about the "strace" command.

I had said that I tried running commands like "kwrite" from the command line, but it shows no error message or output, so I don't know why it's taking so long to start up. This time I tried running the command

strace kwrite
This tracked the communication between the "kwrite" program (or whatever program you specify) and the Linux kernel. I was able to see that kwrite was looking for all sorts of files in the wrong places, and then finally hitting the right places after a while. For example:

open("/usr/lib/qt3/lib/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/X11R6/lib/tls/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/X11R6/lib/", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/", O_RDONLY) = 3

Here we see that it's looking for the file "" under the directory "/usr/lib/qt3/lib/", but it's not there (the Linux kernel says to kwrite: "-1 ENOENT"); then it tries again at "/usr/X11R6/lib/tls/" but again it's not there. It fails again once before getting it on the fourth try.

This is just one example, and it looks for other files, most of which contain the string ".so.", which tells me it's a library file ("so" = "shared object").

So, somehow the KDE programs don't know where their own library is located and have to search. There must be some config setting for me to tell them. Barring that, I might just have to put in symbolic links to the places where the programs expect to find the libraries (by using the command "ln -s /path/to/real/library/ /path/to/where/the/KDE/program/is/looking/") but these are in all sorts of different places, and I'd rather have a clean solution than have to do a hack job on all these libraries.

Anyway, I thought I'd share what I'd learned so far. Main lesson: when things are frustratingly slow, at least "strace <slow-as-molasses-command>" might tell you how a program might be banging its head against the wall.

Second lesson: this is the second time I've found that, when a computer gradually gets slower and slower (over a few months, on the same installation), it's because of stepwise but unnoticed changes in the config. So, no, it's not because of files gradually filling up disk space or something.

To reply to KimVette's post, I do keep services to a minimum, although that minimum does include "sshd" and CUPS, which may be more than what a desktop uses. No BIND, no Apache, no dhcpd, no MySQL. (Hmmm, I am running SWAT ...) But you're right, I should go analyze what exactly the computer is doing ... "strace" is a start.

By the way, I am sheepishly admitting that I actually asked a very similar question a few months back, and completely forgot about it. (I think I was too frustrated with my computer to surf the web and check for answers.) Readers can get some insight there, too; the thread is at:

All times are GMT -5. The time now is 04:15 PM.