Simon Heimlicher

Simon Heimlicher's Homepage

OS X Lion "Nstat_lookup_entry Failed: 2" Diagnosis

The error message kernel: nstat_lookup_entry failed: 2 crops up with varying frequency in the kernel log (/var/log/kernel.log) in OS X 10.7–10.7.2 and has lead to a lot of speculation as to its root cause.

Here are some facts on the situation: The message is generated by a kernel component that has only been added in OS X 10.7 Lion, which can be seen in the source code (for OS X 10.7.1).

The error message is generated at line 1554:

1
printf("nstat_lookup_entry failed: %d\n", result);

For OS X 10.7.0–10.7.2, the only way to guarantee that this error message does not reach your kernel log would be to disable the network statistics feature with the sysctl interface to the kernel.

Note

This page previously offered a way to turn off the network statistics feature permanently. However, since 10.7.3 and later versions of OS X do not suffer from this cosmetic issue anymore, it is highly recommended to undo that modification.

First check whether you have that feature turned off by running

1
sudo cat /etc/syscl.conf

If there is only the line

net.statistics=0

simply remove the file /etc/sysctl.conf, by running the following command

1
sudo rm /etc/sysctl.conf

Otherwise, edit the file and remove that line.

Comments