Unable to save configuration, set eth0 interface

vyos@144458bf8eaa# commit
[ interfaces ethernet eth0 ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report time:      2023-02-15 12:09:05
Image version:    VyOS 1.4-rolling-202302140528
Release train:    current

Built by:         root@7da07c5629df
Built on:         Tue 14 Feb 2023 05:28 UTC
Build UUID:       07ea3d5d-e24d-4c44-88e8-393be72f8c3c
Build commit ID:  82f35fd4744004

Architecture:     x86_64
Boot via:         installed image
System type:      VMware guest

Hardware vendor:  VMware, Inc.
Hardware model:   VMware Virtual Platform
Hardware S/N:     VMware-56 4d 71 15 32 e5 94 8a-dc 5c 08 3b 83 4a f5 f2
Hardware UUID:    15714D56-E532-8A94-DC5C-083B834AF5F2

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 218, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 82, in verify
    verify_mtu(ethernet)
  File "/usr/lib/python3/dist-packages/vyos/configverify.py", line 39, in verify_mtu
    min_mtu = tmp.get_min_mtu()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 406, in get_min_mtu
    return int(self.get_interface('min_mtu'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'



[[interfaces ethernet eth0]] failed

config.boot

interfaces {
  ethernet eth0 {
    address 10.8.8.210/24
    ipv6 {
      address {
        no-default-link-local
      }
    }
    mtu 1500
  }
}
protocols {
  static {
    route 0.0.0.0/0 {
      next-hop 10.8.8.1 {
      }
    }
  }
}
nat {
  source {
    rule 100 {
      outbound-interface eth0
      translation {
        address masquerade
      }
    }
  }
}
system {
  config-management {
    commit-revisions 100
  }
  conntrack {
    modules {
      ftp
      h323
      nfs
      pptp
      sip
      sqlnet
      tftp
    }
  }
  console {
    device ttyS0 {
      speed 115200
    }
  }
  host-name vyos
  login {
    user vyos {
      authentication {
        encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/
        plaintext-password ""
      }
    }
  }
  name-server 127.0.0.1
  syslog {
    global {
      facility all {
        level info
      }
      facility protocols {
        level debug
      }
    }
  }
}
// vyos-config-version: "bgp@2:broadcast-relay@1:cluster@1:config-management@1:conntrack@3:conntrack-sync@2:dhcp-relay@2:dhcp-server@6:dhcpv6-server@1:dns-forwarding@3:firewall@7:flow-accounting@1:https@3:interfaces@26:ipoe-server@1:ipsec@9:isis@1:l2tp@4:lldp@1:mdns@1:monitoring@1:nat@5:nat66@1:ntp@1:openconnect@2:ospf@1:policy@3:pppoe-server@5:pptp@2:qos@1:quagga@10:rpki@1:salt@1:snmp@2:ssh@2:sstp@4:system@25:vrf@3:vrrp@3:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2"

Could you share NIC info?

show interfaces ethernet eth0 physical
sudo ip -d link show dev eth0

And this info:

sudo python3

from vyos.ifconfig import Interface

Interface('eth0').get_min_mtu()
Interface('eth0').get_mtu()
Interface('eth0').get_max_mtu()
quit()

yes,

show interfaces ethernet eth0 physical
sudo ip -d link show dev eth0

vyos@vyos# show interfaces ethernet eth0 physical

  Configuration path: interfaces ethernet eth0 [physical] is not valid
  Show failed

[edit]
vyos@vyos# sudo ip -d link show dev eth0
34: eth0@if35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default 
    link/ether 02:42:0a:08:08:8a brd ff:ff:ff:ff:ff:ff link-netnsid 0 promiscuity 0 
    veth addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
[edit]

sudo python3
from vyos.ifconfig import Interface
image

Why did you do it in configuration mode?
As it expects op-mode.

And check all Python commands that I requested in previous message :wink:

Sorry, I executed these commands in the wrong place.

vyos@vyos:~$ show interfaces ethernet eth0 physical
Cannot get wake-on-lan settings: Operation not permitted
Settings for eth0:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 10000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        MDI-X: Unknown
        Link detected: yes
Cannot get device ring settings: Operation not supported
Ring parameters for eth0:
driver: veth
version: 1.0
firmware-version: 
expansion-rom-version: 
bus-info: 
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
vyos@vyos:~$ sudo ip -d link show dev eth0
34: eth0@if35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default 
    link/ether 02:42:0a:08:08:8a brd ff:ff:ff:ff:ff:ff link-netnsid 0 promiscuity 0 
    veth addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
vyos@vyos:~$ sudo python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from vyos.ifconfig import Interface
>>> Interface('eth0').get_min_mtu()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 406, in get_min_mtu
    return int(self.get_interface('min_mtu'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
>>> Interface('eth0').get_mtu()
1500
>>> Interface('eth0').get_max_mtu()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 417, in get_max_mtu
    return int(self.get_interface('max_mtu'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
>>> quit()


Is it expected driver and it is configured on hypervisor?

Yes, it is correct,
Because I use docker to run vyos.

I created a bug report task T5011

Thanks

Looking forward to your repair

@gameboy-aa Could you check these changes?
sudo nano -c +28 /usr/lib/python3/dist-packages/vyos/configverify.py
Delete function verrify_mtu
And add a new

def verify_mtu(config):
    """
    Common helper function used by interface implementations to perform
    recurring validation if the specified MTU can be used by the underlaying
    hardware.
    """
    from vyos.ifconfig import Interface
    if 'mtu' in config:
        mtu = int(config['mtu'])

        tmp = Interface(config['ifname'])
        # Not all interfaces support min/max MTU
        # https://vyos.dev/T5011
        try:
            min_mtu = tmp.get_min_mtu()
            max_mtu = tmp.get_max_mtu()
        except: # Fallback to defaults
            min_mtu = 68
            max_mtu = 65536

        if mtu < min_mtu:
            raise ConfigError(f'Interface MTU too low, ' \
                              f'minimum supported MTU is {min_mtu}!')
        if mtu > max_mtu:
            raise ConfigError(f'Interface MTU too high, ' \
                              f'maximum supported MTU is {max_mtu}!')

“Ctrl-x” to exit and “Y” to save file
After this restart vyos-configd sudo systemctl restart vyos-configd

Facts have proved that this modification is useful.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.