On Solaris, when I type the command

lsof -l

I encountered this error:

lsof: can't read namelist from /dev/ksyms

Anyone knows what this error means and how I can get open the list of open FD's using lsof in Solaris?


From the lsof FAQ:

17.12.7 Why does lsof on my Solaris 7, 8 or 9 system say, "can't read namelist from /dev/ksyms?"

You're probably trying to use an lsof executable built for an earlier Solaris release on a 64 bit Solaris 7, 8 or 9 kernel. The output from lsof -v will tell you the build environment of your lsof executable. You should also have gotten a warning message that lsof is compiled for a different Solaris version than the one under which it is running -- something like this:

  lsof: WARNING: compiled for Solaris release X; this is Y

You need to build lsof on the system where you want to use it. For 64 bit Solaris 7, 8 and 9 you need a compiler that can generate 64 bit Solaris executables -- e.g., the Sun Workshop 5 C compiler or later, or a recent gcc version like 3.2.

| improve this answer | |
  • Thanks for answering Gilles, unfortunately i cannot change anything in this environment as its owned by an organisation. So it seems that I can only use a combination of /proc/*/fd and some other unix command. – dimas Mar 1 '13 at 0:06

The closest equivalent using Solaris standard commands would be

pfiles /proc/*
| improve this answer | |
  • hi jlliagre thanks for answering. I found out that for Solaris 5 i need to use /usr/bin/pfiles /proc/PID/fd to get some info. However there is a warning stating that pfiles stop processes when its inspecting them until they can generate a report. So i just have to be extra careful with this. – dimas Mar 1 '13 at 1:27
  • 1
    There is no Solaris 5, I guess you mean Solaris 10 (SunOS 5.10). Unless you have critical real-time processes running or processes with an extremely large number of open files, suspending processes to inspect their open files should have no significant impact. Actually, processes are interrupted all the times by the kernel anyway. Should you really want not to stop running processes, there is a more complex solution based on "mdb -k" here mail.opensolaris.org/pipermail/dtrace-discuss/2008-December/… – jlliagre Mar 1 '13 at 2:15
  • My mistake its SunOS 5.10 . Thanks for the information though coz I was really afraid it would have significant impact if I keep on running this command. – dimas Mar 1 '13 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.