Page MenuHomeVyOS Platform

"set interface ethernet" fails on Hyper-V
Closed, ResolvedPublicBUG

Description

I tried to install VyOS using vyos-1.3-rolling-202004030632-amd64.iso on Hyper-V Virtual Machine but I got an error when I entered the following commands.

vyos@vyos$ configure
vyos@vyos# set interfaces ethernet eth0 address dhcp
vyos@vyos# commit

Error:

[ interfaces ethernet eth0 ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 449, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 375, in apply
    e.set_sg(eth['offload_sg'])
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/ethernet.py", line 230, in set_sg
    return self.set_interface('sg', state)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 157, in set_interface
    return self._set_command(self.config, name, value)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 85, in _set_command
    return self._command_set[name].get('format', lambda _: _)(self._cmd(cmd))
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 54, in _cmd
    raise OSError(code, f'{command}\nreturned: {decoded}')
PermissionError: [Errno 1] /sbin/ethtool -K eth0 sg off
returned: Cannot change scatter-gather
Could not change any device features

[[interfaces ethernet eth0]] failed
Commit failed

Pull request:
https://github.com/vyos/vyos-1x/pull/295

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.3-rolling-202004030632
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Currently none of the offloading (gro, gso, sg, tso, ufo) settings are checked either at src/conf_mode/interfaces-ethernet.py verify() or in the module python/vyos/ifconfig/ethernet.py. Setting one of these when the driver doesn't support it will result in an unhandled exception. This may not be so disastrous when setting the options in config mode, as the commit will fail due to the exception, but will have more disastrous results when a config which has these options set is loaded into a system with NICs that don't support it - this will cause boot time commit to fail. As per T2158 and PR#272 none of these calls should result in an exception, but rather just print a warning and continue.

Example on r8169:

root@rt-home:~# ethtool -K eth4 gro on
root@rt-home:~# ethtool -K eth4 gso on
Could not change any device features
root@rt-home:~# echo $?
1
root@rt-home:~# ethtool -K eth4 sg on
Actual changes:
scatter-gather: on
	tx-scatter-gather: on
generic-segmentation-offload: on
root@rt-home:~# ethtool -K eth4 tso on
Could not change any device features
root@rt-home:~# echo $?
1
root@rt-home:~# ethtool -K eth4 ufo on
Cannot change udp-fragmentation-offload
Could not change any device features
root@rt-home:~# echo $?
1

The traceback that's printed when setting an unsupported option (the option must first be off, if it's already set via ethtool it won't error the 2nd time, even if it errored the 1st time)

vyos@rt-home# set interfaces ethernet eth4 offload-options generic-segmentation on
[edit]
vyos@rt-home# commit
[ interfaces ethernet eth4 ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 449, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 372, in apply
    e.set_gso(eth['offload_gso'])
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/ethernet.py", line 221, in set_gso
    return self.set_interface('gso', state)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 147, in set_interface
    return self._set_command(self.config, name, value)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 75, in _set_command
    return self._command_set[name].get('format', lambda _: _)(self._cmd(cmd))
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 44, in _cmd
    raise OSError(code, f'{command}\nreturned: {decoded}')
PermissionError: [Errno 1] /sbin/ethtool -K eth4 gso on
returned: Could not change any device features

[[interfaces ethernet eth4]] failed
Commit failed
[edit]

All code should be checked for any possible unhandled exceptions and fixed. We can't have a new person opening a new bug for each separate config option.
Additionally I'd completely remove the driver checking and skipping code, as curating a list of drivers that support or don't support individual options is impossible. All settings need to be checked via ethtool, exceptions caught, and the user notified that the setting is not supported.

@jjakob thank you for the detail. I will work on it.

Is this normal?

vyos@rt-home# set interfaces ethernet eth4 vif 20
[edit]
vyos@rt-home# commit
[ interfaces ethernet eth4 ]
DEBUG/ifconfig cmd '/sbin/ethtool -K eth4 gro off'
DEBUG/ifconfig cmd '/sbin/ethtool -K eth4 gso off'
DEBUG/ifconfig cmd '/sbin/ethtool -K eth4 sg off'
DEBUG/ifconfig cmd '/sbin/ethtool -K eth4 tso off'
DEBUG/ifconfig cmd '/sbin/ethtool -K eth4 ufo off'
DEBUG/ifconfig returned:
Cannot change udp-fragmentation-offload

[edit]

I guess it's just informational because there are no errors.

Yes, it is as you have as file in /tmp/vyos.interface.debug' which turns on this debugging :-)

It let you know ufo could not be changed, but your interface will work :-)

@suuei Can you try the lateset Rolling release?

erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:46 AM
erkin removed a subscriber: Active contributors.