can't write to /sys/class/net/eth0/mtu -- how modify MTU to 9000 ?

I tried this as ifup eth0 failed to set the mtu to 9000…

**antares:/sys/class/net/eth0/device #** echo 9000 > /sys/class/net/eth0/mtu 
-bash: echo: write error: Invalid argument

I checked the rights and I got 644…

It does not say “Access denied”, it says “Invalid argument”. What makes you think your card supports this MTU in the first place?

Besides, what’s wrong with “ip link set dev eth0 mtu 9000”? It is never a good idea to mess with sysfs directly.

“mtu greater than device maximum”

I checked the rights because “joe” prevent me to write the datas once file edited
It worked ok in 15.1 and I just reinstalled a fresh 15.4 after hard disk failure.

My interpretation is that 9000 is not an allowed value in that kernel parameter.

Remind that it is not a normal file that you try to write into, but a field in the kernel. It does not seem illogical to me that the kernel protects itself against storing invalid values in it’s data structures.

When you search in the internet for e.g.:

echo error invalid argument

all (most all) pages mention use of echo to set values in /sys. Thus my assumption that it is not a “normal” error from echo, but that it comes from this special usage.

I would suggest you try with a value that you know is accepted, like the present value of 1500. It will of course not change much, but it will show you if it also gives the error or not.

And when 9000 is not valid at all, it also explains why trying to set it with ifup fails.


**antares:/ #** ip -d link list

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 minmtu 0 maxmtu 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535  
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 
    link/ether 00:24:8c:51:b5:8a brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 6122 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 64000 gso_max_segs 64 parentb
us pci parentdev 0000:02:00.0  
    altname enp2s0 
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 
    link/ether 00:40:f4:d0:9b:f3 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 7146 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 32000 gso_max_segs 24 parentb
us pci parentdev 0000:03:06.0  
    altname enp3s6


It’s a shame I have not screenshotted the answer when I was under 15.1.
Here I have a maximum… 6122 bytes that is not enough but better than 1500 here in my local network.