Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networking/info_device(number)_(interface) can't find ethtool in /sbin/ethtool on Desktop #508

Closed
djacobs98 opened this issue May 29, 2023 · 3 comments · Fixed by #630
Closed
Assignees
Labels
bug Something isn't working

Comments

@djacobs98
Copy link

Bug Description

Checkbox22 snap latest/stable version 2.6

The test: network/info_device(number)_(interface) attempts to get some information about a given network interface (e.g. enp1s0) using ethtool which is provided by Checkbox in /snap/checkbox22/current/sbin/ethtool

On Desktop this test fails because it claims "ethtool is not installed."
On Server this test passes but it says "ethtool returned an error."

This test uses the script: https://github.com/canonical/checkbox/blob/main/providers/base/bin/network_device_info.py

This script calls /sbin/ethtool with the interface to be probed.

This occurs in this block of code:

53        try:
54            output = check_output(cmd, stderr=STDOUT, universal_newlines=True)
55        except CalledProcessError:
56            return "ethtool returned error"
57        except FileNotFoundError:
58            return "ethtool not installed"
59        if not output:
60            return "ethtool returned no output" ```

When checkbox calls this script, the FileNotFoundError exception is caught which results in this output in the submission file:

Category: NETWORK
Interface: enp1s0
Product: Ethernet Controller I225-LM (Ethernet Network Adapter I225-T1)
Vendor: Intel Corporation
Driver: igc
Driver Version: 
Path: /devices/pci0000:00/0000:00:1c.0/0000:01:00.0
Id: [8086:15f2]
Subsystem Id: [8086:0001]
Mac: 40:a6:b7:6a:19:6b
Carrier Status: Connected
Ipv4: 10.102.88.104
Ipv6: fe80::2c00:ed07:e484:9779/64
Speed: 1000
Supported Modes: ethtool not installed
Advertised Modes: ethtool not installed
Partner Modes: ethtool not installed

But when I manually call this inside a checkbox shell, it works:
u@u:~$ checkbox-iiotg-classic.shell 
checkbox-iiotg-classic runtime shell, type 'exit' to quit the session
u@u:~$ sudo ethtool enp1s0
Settings for enp1s0:
	Supported ports: [  ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	                        2500baseT/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	                        2500baseT/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: internal
	MDI-X: off (auto)
	Supports Wake-on: pumbg
	Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
	Link detected: yes

### To Reproduce

checkbox-iiotg-class.test-runner
choose Desktop Manual
choose non-device specific networking test

Tests should pass.
Tests fail with "ethtool not installed."

### Environment

22.04 Jammy IOTG Desktop with IOTG RT-GA kernel
checkbox22 v2.6
checkbox-iiotg-classic 0.1dev-jammy  (latest/edge)


### Relevant log output

```shell
I/O log:
Category: NETWORK
Interface: enp1s0
Product: Ethernet Controller I225-LM (Ethernet Network Adapter I225-T1)
Vendor: Intel Corporation
Driver: igc
Driver Version: 
Path: /devices/pci0000:00/0000:00:1c.0/0000:01:00.0
Id: [8086:15f2]
Subsystem Id: [8086:0001]
Mac: 40:a6:b7:6a:19:6b
Carrier Status: Connected
Ipv4: 10.102.88.104
Ipv6: fe80::2c00:ed07:e484:9779/64
Speed: 1000
Supported Modes: ethtool not installed
Advertised Modes: ethtool not installed
Partner Modes: ethtool not installed

Additional context

No response

@djacobs98 djacobs98 added the bug Something isn't working label May 29, 2023
@pieqq
Copy link
Collaborator

pieqq commented Jun 9, 2023

@bladernr it seems the problems boils down to how ethtool is called:

https://github.com/canonical/checkbox/blob/main/providers/base/bin/network_device_info.py#L42

Do you know why the script calls /sbin/ethtool specifically, instead of just calling ethtool and relying on the system's $PATH to find where it is located?

@bladernr
Copy link
Collaborator

@pieqq In the words of the great Shaggy... it wasn't me.

Git Blame says it's @rodwsmith who added that. I am going to wager a guess that /sbin/ is where apt is/was installing ethtool. Perhaps that package was later modified?

Or are you doing something different when installing it? Or is the packaging just wonky and can install the tool in multiple places?

Anyway, it would make sense to me to use $PATH instead... or better, some form of pythonic which ethtool as a check that the binary even exists and then use the output of that to call it later on when needed.

@rodwsmith
Copy link
Collaborator

I don't know anything about this. I don't recall writing the code in question, but it's not exactly so unique or exciting that I'd expect to remember it. If specifying /sbin is causing problems, then I'd recommend just removing it; I don't remember any particular reason I did it that way, if in fact it was me who wrote it.

pieqq added a commit that referenced this issue Jul 21, 2023
In recent versions of Ubuntu, ethtool is installed in /usr/sbin/ethtool.
Trying to call /sbin/ethtool causes our job
networking/info_device(number)_(interface) to fail loading additional
information.

Calling ethtool directly to let the system handle the tool location.

Fix #508
pieqq added a commit that referenced this issue Jul 21, 2023
Trying to call /sbin/ethtool causes our job
networking/info_device(number)_(interface) to fail loading additional
information when Checkbox is installed as a snap, because in this case
the location of ethtool is /snap/checkbox22/current/sbin/ethtool

Calling ethtool directly to let the system handle the tool location.

Fix #508
Hook25 pushed a commit that referenced this issue Jul 31, 2023
Trying to call /sbin/ethtool causes our job
networking/info_device(number)_(interface) to fail loading additional
information when Checkbox is installed as a snap, because in this case
the location of ethtool is /snap/checkbox22/current/sbin/ethtool

Calling ethtool directly to let the system handle the tool location.

Fix #508
diohe0311 pushed a commit that referenced this issue Jul 31, 2023
Trying to call /sbin/ethtool causes our job
networking/info_device(number)_(interface) to fail loading additional
information when Checkbox is installed as a snap, because in this case
the location of ethtool is /snap/checkbox22/current/sbin/ethtool

Calling ethtool directly to let the system handle the tool location.

Fix #508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants