From 833f008671b7a528e6eed50e6634f648b55cded2 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sat, 8 Aug 2026 20:52:15 -0400 Subject: [PATCH] Fix dashcam mount-point creation permission error mount_device() used a bare os.makedirs() to create the mount point, but the app runs as an unprivileged user while /mnt is root-owned - surfaced as a real PermissionError during the first actual hardware test. Create the mount point via sudo mkdir -p instead, consistent with the existing sudo mount/umount calls in this module. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/app_dash.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/app_dash.py b/modules/app_dash.py index 3ae3570..f684e8d 100644 --- a/modules/app_dash.py +++ b/modules/app_dash.py @@ -108,8 +108,24 @@ def find_dashcam_partition(): def mount_device(device_path, mount_point=DEFAULT_MOUNT_POINT): - """Mount device_path read-only at mount_point. Returns True on success.""" - os.makedirs(mount_point, exist_ok=True) + """Mount device_path read-only at mount_point. Returns True on success. + + The app runs as an unprivileged user while /mnt is root-owned, so the + mount point directory itself has to be created via sudo too (not just + the mount call) - first real-hardware test surfaced this as a plain + PermissionError from a bare os.makedirs(). + """ + try: + subprocess.run( + ["sudo", "mkdir", "-p", mount_point], + capture_output=True, + text=True, + check=True, + ) + except subprocess.CalledProcessError as e: + print(f"Failed to create mount point {mount_point}: {e.stderr.strip()}") + return False + try: subprocess.run( ["sudo", "mount", "-o", "ro", device_path, mount_point],