re: search

re: search — Simon Heimlicher's Homepage

In math we trust — everybody else, bring data.

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) 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);

As of OS X 10.7.1, the only way to guarantee that this error message does not reach your kernel log is to disable the network statistics feature with the sysctl interface to the kernel.

Note

The following modification of the kernel configuration may have unexpected side effects.

Note: the following kernel configuration change is guaranteed to keep the error message out of the log but does not have any other positive effects at all, while it may have negative side effects.

**Proceed at your own risk.

To turn the feature off until the next time you restart your machine, issue the following command in the terminal:

1
sudo sysctl -w net.statistics=0

If you observe any negative consequences, you can always undo this change by issuing

1
sudo sysctl -w net.statistics=1

or simply by rebooting your machine.

If you would like to make this setting permanent, create a file /etc/sysctl.conf and add the following line: net.statistics=0 This can be accomplished with this command:

1
sudo /bin/sh -c "echo 'net.statistics=0' > /etc/sysctl.conf"

To undo this permanent modification, remove the file:

1
sudo rm /etc/sysctl.conf