Repository: archlinux/archinstall

Issue:
loop device fetching results in permission error 
@codefiles When archinstall was previously run in non root mode it would be gracefully handled with an error. loop devices are non eagerly loaded on startup, however, pyparted seems to require root for that 

```
  File "/home/dan/Git/archinstall/archinstall/__init__.py", line 8, in <module>
    from .lib import disk
  File "/home/dan/Git/archinstall/archinstall/lib/disk/__init__.py", line 1, in <module>
    from .device_handler import device_handler, disk_layouts
  File "/home/dan/Git/archinstall/archinstall/lib/disk/device_handler.py", line 644, in <module>
    device_handler = DeviceHandler()
                     ^^^^^^^^^^^^^^^
  File "/home/dan/Git/archinstall/archinstall/lib/disk/device_handler.py", line 39, in __init__
    self.load_devices()
  File "/home/dan/Git/archinstall/archinstall/lib/disk/device_handler.py", line 56, in load_devices
    loop_device = getDevice(ld_info.split(':', maxsplit=1)[0])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/parted/decorators.py", line 42, in new
    ret = fn(*args, **kwds)
          ^^^^^^^^^^^^^^^^^
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/parted/__init__.py", line 483, in getDevice
    return Device(path=path)
           ^^^^^^^^^^^^^^^^^
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/parted/decorators.py", line 42, in new
    ret = fn(*args, **kwds)
          ^^^^^^^^^^^^^^^^^
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/parted/device.py", line 59, in __init__
    self.__device = _ped.device_get(path)
                    ^^^^^^^^^^^^^^^^^^^^^
_ped.IOException: Error opening /dev/loop0: Permission denied
```


Discussion:
Good catch! I thought about putting the `getDevice()` call in a try block. You even suggested using a try block but I thought you might have meant for just the `SysCommand()` call. Before submitting, I checked the pyparted examples in the pyparted example directory and every one of them uses `getDevice()` without a try block so I thought it would be fine. Then again the examples do not expect a loop device. I would have never thought to test with archinstall run as non root. What lead you to trying that and what is the use of archinstall in non root?
Are you going to submit a fix?
Yeah let me raise something

Resolving patch:
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -49,12 +49,11 @@ def load_devices(self):
 
 		try:
 			loop_devices = SysCommand(['losetup', '-a'])
-		except SysCallError as err:
-			debug(f'Failed to get loop devices: {err}')
-		else:
 			for ld_info in str(loop_devices).splitlines():
 				loop_device = getDevice(ld_info.split(':', maxsplit=1)[0])
 				devices.append(loop_device)
+		except Exception as err:
+			debug(f'Failed to get loop devices: {err}')
 
 		for device in devices:
 			if get_lsblk_info(device.path).type == 'rom':


Test patch: