We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Command not found (PATH does not contain /usr/sbin)
Getting errors when using LISAv3 to deploy and test CentOS 7_9 on Azure

`[ERROR] lisa.env[generated_0].node[0].cmd[7289] not found command: Command not found: modinfo. Check that modinfo is installed and on $PATH`

`[ERROR] lisa.env[generated_0].node[0].cmd[1038] not found command: Command not found: waagent. Check that waagent is installed and on $PATH`

`[ERROR] lisa.env[generated_0].node[0].cmd[8629] not found command: Command not found: lsmod. Check that lsmod is installed and on $PATH`

SSHing into the node confirms that all three of these commands are present and runnable on the node.

The error about modinfo missing appears to occur before any tests start running. These errors do not occur when deploying and testing Ubuntu 18.04-LTS.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lisa/tools/modinfo.py`
Content:
```
1 # Copyright (c) Microsoft Corporation.
2 # Licensed under the MIT license.
3 
4 import re
5 from typing import Any
6 
7 from lisa.executable import Tool
8 from lisa.util import find_patterns_in_lines
9 
10 
11 class Modinfo(Tool):
12     __version_pattern = re.compile(r"^version:[ \t]*([^ \n]*)")
13 
14     @property
15     def command(self) -> str:
16         return self._command
17 
18     def _check_exists(self) -> bool:
19         return True
20 
21     def _initialize(self, *args: Any, **kwargs: Any) -> None:
22         self._command = "modinfo"
23 
24     def get_info(
25         self,
26         mod_name: str,
27         force_run: bool = False,
28         no_info_log: bool = True,
29         no_error_log: bool = True,
30     ) -> str:
31         result = self.run(
32             mod_name,
33             force_run=force_run,
34             no_info_log=no_info_log,
35             no_error_log=no_error_log,
36         )
37         if result.exit_code != 0:
38             # CentOS may not include the path when started,
39             # specify path and try again.
40             self._command = "/usr/sbin/modinfo"
41             result = self.run(
42                 mod_name,
43                 force_run=force_run,
44                 no_info_log=no_info_log,
45                 no_error_log=no_error_log,
46             )
47         return result.stdout
48 
49     def get_version(
50         self,
51         mod_name: str,
52         force_run: bool = False,
53         no_info_log: bool = True,
54         no_error_log: bool = True,
55     ) -> str:
56         output = self.get_info(
57             mod_name=mod_name,
58             force_run=force_run,
59             no_info_log=no_info_log,
60             no_error_log=no_error_log,
61         )
62         found_version = find_patterns_in_lines(output, [self.__version_pattern])
63         return found_version[0][0] if found_version[0] else ""
64
```

Path: `lisa/tools/lsmod.py`
Content:
```
1 # Copyright (c) Microsoft Corporation.
2 # Licensed under the MIT license.
3 
4 import re
5 from typing import Any
6 
7 from lisa.executable import Tool
8 from lisa.util import LisaException, find_patterns_in_lines
9 
10 
11 class Lsmod(Tool):
12     # The output of lsmod command is in below format -
13     #   Module                  Size  Used by
14     #    fuse                   52176  3
15     #   cryptd                 14125  0
16     #   aes_generic            32970  1 aes_i586
17     __output_pattern = re.compile(
18         r"^(?P<name>[^\s]+)\s+(?P<size>[^\s]+)\s+(?P<usedby>.*)?$", re.MULTILINE
19     )
20 
21     @property
22     def command(self) -> str:
23         return self._command
24 
25     def _check_exists(self) -> bool:
26         return True
27 
28     def _initialize(self, *args: Any, **kwargs: Any) -> None:
29         self._command = "lsmod"
30 
31     def module_exists(
32         self,
33         mod_name: str = "",
34         force_run: bool = False,
35         no_info_log: bool = True,
36         no_error_log: bool = True,
37     ) -> bool:
38         result = self.run(
39             force_run=force_run,
40             no_info_log=no_info_log,
41             no_error_log=no_error_log,
42         )
43         if result.exit_code != 0:
44             raise LisaException(
45                 f"{self._command} command got non-zero exit code: {result.exit_code}"
46             )
47 
48         module_info = find_patterns_in_lines(result.stdout, [self.__output_pattern])
49         if any(mod_name in info for sublist in module_info for info in sublist):
50             return True
51 
52         return False
53
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lisa/tools/lsmod.py b/lisa/tools/lsmod.py
--- a/lisa/tools/lsmod.py
+++ b/lisa/tools/lsmod.py
@@ -36,6 +36,7 @@
         no_error_log: bool = True,
     ) -> bool:
         result = self.run(
+            sudo=True,
             force_run=force_run,
             no_info_log=no_info_log,
             no_error_log=no_error_log,
diff --git a/lisa/tools/modinfo.py b/lisa/tools/modinfo.py
--- a/lisa/tools/modinfo.py
+++ b/lisa/tools/modinfo.py
@@ -30,20 +30,13 @@
     ) -> str:
         result = self.run(
             mod_name,
+            sudo=True,
             force_run=force_run,
             no_info_log=no_info_log,
             no_error_log=no_error_log,
+            expected_exit_code=0,
+            expected_exit_code_failure_message=f"Modinfo failed for module {mod_name}",
         )
-        if result.exit_code != 0:
-            # CentOS may not include the path when started,
-            # specify path and try again.
-            self._command = "/usr/sbin/modinfo"
-            result = self.run(
-                mod_name,
-                force_run=force_run,
-                no_info_log=no_info_log,
-                no_error_log=no_error_log,
-            )
         return result.stdout
 
     def get_version(

{"golden_diff": "diff --git a/lisa/tools/lsmod.py b/lisa/tools/lsmod.py\n--- a/lisa/tools/lsmod.py\n+++ b/lisa/tools/lsmod.py\n@@ -36,6 +36,7 @@\n         no_error_log: bool = True,\n     ) -> bool:\n         result = self.run(\n+            sudo=True,\n             force_run=force_run,\n             no_info_log=no_info_log,\n             no_error_log=no_error_log,\ndiff --git a/lisa/tools/modinfo.py b/lisa/tools/modinfo.py\n--- a/lisa/tools/modinfo.py\n+++ b/lisa/tools/modinfo.py\n@@ -30,20 +30,13 @@\n     ) -> str:\n         result = self.run(\n             mod_name,\n+            sudo=True,\n             force_run=force_run,\n             no_info_log=no_info_log,\n             no_error_log=no_error_log,\n+            expected_exit_code=0,\n+            expected_exit_code_failure_message=f\"Modinfo failed for module {mod_name}\",\n         )\n-        if result.exit_code != 0:\n-            # CentOS may not include the path when started,\n-            # specify path and try again.\n-            self._command = \"/usr/sbin/modinfo\"\n-            result = self.run(\n-                mod_name,\n-                force_run=force_run,\n-                no_info_log=no_info_log,\n-                no_error_log=no_error_log,\n-            )\n         return result.stdout\n \n     def get_version(\n", "issue": "Command not found (PATH does not contain /usr/sbin)\nGetting errors when using LISAv3 to deploy and test CentOS 7_9 on Azure\r\n\r\n`[ERROR] lisa.env[generated_0].node[0].cmd[7289] not found command: Command not found: modinfo. Check that modinfo is installed and on $PATH`\r\n\r\n`[ERROR] lisa.env[generated_0].node[0].cmd[1038] not found command: Command not found: waagent. Check that waagent is installed and on $PATH`\r\n\r\n`[ERROR] lisa.env[generated_0].node[0].cmd[8629] not found command: Command not found: lsmod. Check that lsmod is installed and on $PATH`\r\n\r\nSSHing into the node confirms that all three of these commands are present and runnable on the node.\r\n\r\nThe error about modinfo missing appears to occur before any tests start running. These errors do not occur when deploying and testing Ubuntu 18.04-LTS.\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n\nimport re\nfrom typing import Any\n\nfrom lisa.executable import Tool\nfrom lisa.util import find_patterns_in_lines\n\n\nclass Modinfo(Tool):\n    __version_pattern = re.compile(r\"^version:[ \\t]*([^ \\n]*)\")\n\n    @property\n    def command(self) -> str:\n        return self._command\n\n    def _check_exists(self) -> bool:\n        return True\n\n    def _initialize(self, *args: Any, **kwargs: Any) -> None:\n        self._command = \"modinfo\"\n\n    def get_info(\n        self,\n        mod_name: str,\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> str:\n        result = self.run(\n            mod_name,\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n        )\n        if result.exit_code != 0:\n            # CentOS may not include the path when started,\n            # specify path and try again.\n            self._command = \"/usr/sbin/modinfo\"\n            result = self.run(\n                mod_name,\n                force_run=force_run,\n                no_info_log=no_info_log,\n                no_error_log=no_error_log,\n            )\n        return result.stdout\n\n    def get_version(\n        self,\n        mod_name: str,\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> str:\n        output = self.get_info(\n            mod_name=mod_name,\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n        )\n        found_version = find_patterns_in_lines(output, [self.__version_pattern])\n        return found_version[0][0] if found_version[0] else \"\"\n", "path": "lisa/tools/modinfo.py"}, {"content": "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n\nimport re\nfrom typing import Any\n\nfrom lisa.executable import Tool\nfrom lisa.util import LisaException, find_patterns_in_lines\n\n\nclass Lsmod(Tool):\n    # The output of lsmod command is in below format -\n    #   Module                  Size  Used by\n    #    fuse                   52176  3\n    #   cryptd                 14125  0\n    #   aes_generic            32970  1 aes_i586\n    __output_pattern = re.compile(\n        r\"^(?P<name>[^\\s]+)\\s+(?P<size>[^\\s]+)\\s+(?P<usedby>.*)?$\", re.MULTILINE\n    )\n\n    @property\n    def command(self) -> str:\n        return self._command\n\n    def _check_exists(self) -> bool:\n        return True\n\n    def _initialize(self, *args: Any, **kwargs: Any) -> None:\n        self._command = \"lsmod\"\n\n    def module_exists(\n        self,\n        mod_name: str = \"\",\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> bool:\n        result = self.run(\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n        )\n        if result.exit_code != 0:\n            raise LisaException(\n                f\"{self._command} command got non-zero exit code: {result.exit_code}\"\n            )\n\n        module_info = find_patterns_in_lines(result.stdout, [self.__output_pattern])\n        if any(mod_name in info for sublist in module_info for info in sublist):\n            return True\n\n        return False\n", "path": "lisa/tools/lsmod.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n\nimport re\nfrom typing import Any\n\nfrom lisa.executable import Tool\nfrom lisa.util import find_patterns_in_lines\n\n\nclass Modinfo(Tool):\n    __version_pattern = re.compile(r\"^version:[ \\t]*([^ \\n]*)\")\n\n    @property\n    def command(self) -> str:\n        return self._command\n\n    def _check_exists(self) -> bool:\n        return True\n\n    def _initialize(self, *args: Any, **kwargs: Any) -> None:\n        self._command = \"modinfo\"\n\n    def get_info(\n        self,\n        mod_name: str,\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> str:\n        result = self.run(\n            mod_name,\n            sudo=True,\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n            expected_exit_code=0,\n            expected_exit_code_failure_message=f\"Modinfo failed for module {mod_name}\",\n        )\n        return result.stdout\n\n    def get_version(\n        self,\n        mod_name: str,\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> str:\n        output = self.get_info(\n            mod_name=mod_name,\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n        )\n        found_version = find_patterns_in_lines(output, [self.__version_pattern])\n        return found_version[0][0] if found_version[0] else \"\"\n", "path": "lisa/tools/modinfo.py"}, {"content": "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n\nimport re\nfrom typing import Any\n\nfrom lisa.executable import Tool\nfrom lisa.util import LisaException, find_patterns_in_lines\n\n\nclass Lsmod(Tool):\n    # The output of lsmod command is in below format -\n    #   Module                  Size  Used by\n    #    fuse                   52176  3\n    #   cryptd                 14125  0\n    #   aes_generic            32970  1 aes_i586\n    __output_pattern = re.compile(\n        r\"^(?P<name>[^\\s]+)\\s+(?P<size>[^\\s]+)\\s+(?P<usedby>.*)?$\", re.MULTILINE\n    )\n\n    @property\n    def command(self) -> str:\n        return self._command\n\n    def _check_exists(self) -> bool:\n        return True\n\n    def _initialize(self, *args: Any, **kwargs: Any) -> None:\n        self._command = \"lsmod\"\n\n    def module_exists(\n        self,\n        mod_name: str = \"\",\n        force_run: bool = False,\n        no_info_log: bool = True,\n        no_error_log: bool = True,\n    ) -> bool:\n        result = self.run(\n            sudo=True,\n            force_run=force_run,\n            no_info_log=no_info_log,\n            no_error_log=no_error_log,\n        )\n        if result.exit_code != 0:\n            raise LisaException(\n                f\"{self._command} command got non-zero exit code: {result.exit_code}\"\n            )\n\n        module_info = find_patterns_in_lines(result.stdout, [self.__output_pattern])\n        if any(mod_name in info for sublist in module_info for info in sublist):\n            return True\n\n        return False\n", "path": "lisa/tools/lsmod.py"}]}