Troubleshooting sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory
net.ipv4.tcp_tw_recycle = 0
in /etc/sysctl.conf
caused error: sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directoryWhat is net.ipv4.tcp_tw_recycle
Per Linux kernel document networking/ip-sysctl.txt:
tcp_tw_recycle - BOOLEAN
Enable fast recycling TIME-WAIT sockets. Default value is 0. It should not be changed without advice/request of technical experts.
This documentation is not clear what is mechanism and what is the side effect.
Symptom - sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory
When I try to put following line into /etc/sysctl.conf
:
net.ipv4.tcp_tw_recycle = 0
Then use sysctl -p
to reload it, I got following error:
$ sudo sysctl -p
sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory
Analysis
The net.ipv4.tcp_tw_recycle
has been removed from Linux 4.12
on 2017.
Check kernel version:
$ uname -a
Linux pi3 4.19.97-v7+ #1294 SMP
My kernel version is 4.19
which is newer than 4.12
,
net.ipv4.tcp_tw_recycle
is not available anymore.
This error can be safely ignored.
Should not set this option anymore.
Reason to remove
Per kernel git commit history, tcp_tw_recycle
is not functional and cause problem.
The tcp_tw_recycle was already broken for connections behind NAT, since the per-destination timestamp is not monotonically increasing for multiple machines behind a single destination address.
After the randomization of TCP timestamp offsets in commit 8a5bd45f6616 (tcp: randomize tcp timestamp offsets for each connection), the tcp_tw_recycle is broken for all types of connections for the same reason: the timestamps received from a single machine is not monotonically increasing, anymore.
Remove tcp_tw_recycle, since it is not functional. Also, remove the PAWSPassive SNMP counter since it is only used for tcp_tw_recycle, and simplify tcp_v4_route_req and tcp_v6_route_req since the strict argument is only set when tcp_tw_recycle is enabled.
Suggestion
Consider to use tcp_tw_reuse
by set to 1
to improve network server performance:
net.ipv4.tcp_tw_reuse = 1
tcp_tw_reuse - BOOLEAN
Allow to reuse TIME-WAIT sockets for new connections when it is safe from protocol viewpoint. Default value is 0. It should not be changed without advice/request of technical experts.
Reference
- Linux kernel commit: tcp: remove tcp_tw_recycle
- Linux kernel Documentation/networking/ip-sysctl.txt
- Coping with the TCP TIME-WAIT state on busy Linux servers
Feedback
Was this page helpful?
Glad to hear it!
Sorry to hear that.