From 137b0e1b2578aa28de0344b6681302e5ef0b21cb Mon Sep 17 00:00:00 2001 From: Zhongning Li <60045212+tomli380576@users.noreply.github.com> Date: Sat, 15 Aug 2026 12:43:49 +0800 Subject: [PATCH 1/3] fix: abs path --- snap/hooks/install | 4 ++-- snap/local/scripts/run_sos.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snap/hooks/install b/snap/hooks/install index 7c565a2..6210efc 100644 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -20,6 +20,6 @@ cp /var/lib/snapd/hostfs/etc/os-release $SNAP_COMMON/etc/os-release # see snap/local/scripts/run_sos.sh for why this uses 'nsenter -t 1 -m' -if ! nsenter -t 1 -m -- snap list sosreport >/dev/null 2>&1; then - nsenter -t 1 -m -- snap install --classic sosreport || true +if ! nsenter -t 1 -m -- /usr/bin/snap list sosreport >/dev/null 2>&1; then + nsenter -t 1 -m -- /usr/bin/snap install --classic sosreport || true fi diff --git a/snap/local/scripts/run_sos.sh b/snap/local/scripts/run_sos.sh index d6d1432..63f82a4 100755 --- a/snap/local/scripts/run_sos.sh +++ b/snap/local/scripts/run_sos.sh @@ -40,9 +40,9 @@ if ! nsenter -t 1 -m -- which apt 2>&1 > /dev/null; then exit 1 fi -if ! nsenter -t 1 -m -- snap list sosreport >/dev/null 2>&1; then +if ! nsenter -t 1 -m -- /usr/bin/snap list sosreport >/dev/null 2>&1; then echo "sosreport snap not found on host, installing it now..." >&2 - nsenter -t 1 -m -- snap install --classic sosreport + nsenter -t 1 -m -- /usr/bin/snap install --classic sosreport fi exec nsenter -t 1 -m -- /snap/bin/sosreport.sos "$@" From 36b049052788b7d5a09f57ab5cc4df82587cd791 Mon Sep 17 00:00:00 2001 From: Zhongning Li <60045212+tomli380576@users.noreply.github.com> Date: Sat, 15 Aug 2026 12:46:19 +0800 Subject: [PATCH 2/3] fix: use the constant --- src/bugit_v2/dut_utils/log_collectors.py | 29 +++++++----------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/bugit_v2/dut_utils/log_collectors.py b/src/bugit_v2/dut_utils/log_collectors.py index 7534273..4d7b573 100644 --- a/src/bugit_v2/dut_utils/log_collectors.py +++ b/src/bugit_v2/dut_utils/log_collectors.py @@ -18,7 +18,11 @@ from bugit_v2.models.bug_report import BugReport, LogName from bugit_v2.utils import host_is_ubuntu_core, is_snap from bugit_v2.utils.async_subprocess import asp_check_call, asp_check_output -from bugit_v2.utils.constants import HOST_FS, MAX_JOB_OUTPUT_LEN +from bugit_v2.utils.constants import ( + HOST_FS, + MAX_JOB_OUTPUT_LEN, + NSENTER_PREFIX, +) logger = logging.getLogger(__name__) @@ -83,13 +87,7 @@ async def nvidia_bug_report( ) -> str: return await asp_check_output( [ - "sudo", - "--non-interactive", - "nsenter", - "--target", - "1", - "--mount", - "--", + *NSENTER_PREFIX, "nvidia-bug-report.sh", "--extra-system-data", "--output-file", @@ -260,12 +258,7 @@ async def oem_getlogs( pass await asp_check_output( [ - "sudo", - "--non-interactive", - "nsenter", - "--target", - "1", - "--mount", + *(NSENTER_PREFIX[:-1]), # remove the '--' first # must switch cwd after entering namespace f"--wdns={target_dir.absolute()}", "--", @@ -285,13 +278,7 @@ async def sosreport( assert target_dir.exists(), f"Target directory {target_dir} does not exist" await asp_check_call( [ - "sudo", - "--non-interactive", - "nsenter", - "--target", - "1", - "--mount", - "--", + *NSENTER_PREFIX, "env", "HWLOC_COMPONENTS=-gl", "/snap/bin/sosreport.sos", From 1b8041bff4d4e23c878935dd67d3b8f59cdedb1a Mon Sep 17 00:00:00 2001 From: Zhongning Li <60045212+tomli380576@users.noreply.github.com> Date: Sat, 15 Aug 2026 12:54:21 +0800 Subject: [PATCH 3/3] fix: remove hostfs --- src/bugit_v2/dut_utils/info_getters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bugit_v2/dut_utils/info_getters.py b/src/bugit_v2/dut_utils/info_getters.py index 26621c4..b7dba04 100644 --- a/src/bugit_v2/dut_utils/info_getters.py +++ b/src/bugit_v2/dut_utils/info_getters.py @@ -12,8 +12,8 @@ from collections import Counter from bugit_v2.checkbox_utils.checkbox_exec import get_checkbox_info -from bugit_v2.utils import is_snap from bugit_v2.utils.async_subprocess import asp_check_output, asp_run +from bugit_v2.utils.constants import NSENTER_PREFIX async def get_thinkpad_ec_version(timeout: int | None = 30) -> str | None: @@ -165,8 +165,8 @@ async def ec(): try: nvidia_log = await asp_run( [ - ("/var/lib/snapd/hostfs/usr/bin/" if is_snap() else "") - + "nvidia-smi", + *NSENTER_PREFIX, + "nvidia-smi", "-q", ], timeout=command_timeout,