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],