Repository: archlinux/archinstall

Issue:
another crash (Failed to read disk "/dev/nvme0n1p3" with lsblk)
I tried to install Arch after installing Debian (which has a little different disk layout (/dev/nvme0n1p{1,2,3})) and this happened on the first run of archinstall. After I ran it the second time it worked successfully

```
Hardware model detected: HP HP Pavilion Plus Laptop 14-ey0xxx; UEFI mode: True
Processor model detected: AMD Ryzen 7 7840H w/ Radeon(TM) 780M Graphics
Memory statistics: 30580056 available out of 32153452 total installed
Could not detect virtual system: ['/usr/bin/systemd-detect-virt'] exited with abnormal exit code [1]: none

System is not running in a VM: ['/usr/bin/systemd-detect-virt'] exited with abnormal exit code [1]: none

Virtualization detected: None; is VM: False
Graphics devices detected: dict_keys(['Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev c7)'])
Disk states before installing: [
    {
        "children": [],
        "fsavail": 0,
        "fsroots": [
            "."
        ],
        "fstype": "squashfs",
        "fsuse_percentage": "100%",
        "fsver": "4.0",
        "log_sec": 512,
        "mountpoint": "/run/archiso/airootfs",
        "mountpoints": [
            "/run/archiso/airootfs"
        ],
        "name": "loop0",
        "partn": null,
        "parttype": null,
        "partuuid": null,
        "path": "/dev/loop0",
        "pkname": null,
        "pttype": null,
        "ptuuid": null,
        "rota": false,
        "size": "788 MiB",
        "tran": null,
        "type": "loop",
        "uuid": null
    },
    {
        "children": [
            {
                "children": [],
                "fsavail": null,
                "fsroots": [],
                "fstype": "iso9660",
                "fsuse_percentage": null,
                "fsver": "Joliet Extension",
                "log_sec": 512,
                "mountpoint": null,
                "mountpoints": [],
                "name": "sda1",
                "partn": 1,
                "parttype": "0x0",
                "partuuid": "8da10534-01",
                "path": "/dev/sda1",
                "pkname": "sda",
                "pttype": "dos",
                "ptuuid": "8da10534",
                "rota": true,
                "size": "933 MiB",
                "tran": null,
                "type": "part",
                "uuid": "2024-05-01-17-04-31-00"
            },
            {
                "children": [],
                "fsavail": null,
                "fsroots": [],
                "fstype": "vfat",
                "fsuse_percentage": null,
                "fsver": "FAT16",
                "log_sec": 512,
                "mountpoint": null,
                "mountpoints": [],
                "name": "sda2",
                "partn": 2,
                "parttype": "0xef",
                "partuuid": "8da10534-02",
                "path": "/dev/sda2",
                "pkname": "sda",
                "pttype": "dos",
                "ptuuid": "8da10534",
                "rota": true,
                "size": "144 MiB",
                "tran": null,
                "type": "part",
                "uuid": "6665-2677"
            }
        ],
        "fsavail": null,
        "fsroots": [],
        "fstype": "iso9660",
        "fsuse_percentage": null,
        "fsver": "Joliet Extension",
        "log_sec": 512,
        "mountpoint": null,
        "mountpoints": [],
        "name": "sda",
        "partn": null,
        "parttype": null,
        "partuuid": null,
        "path": "/dev/sda",
        "pkname": null,
        "pttype": "dos",
        "ptuuid": "8da10534",
        "rota": true,
        "size": "29510 MiB",
        "tran": "usb",
        "type": "disk",
        "uuid": "2024-05-01-17-04-31-00"
    },
    {
        "children": [
            {
                "children": [],
                "fsavail": null,
                "fsroots": [],
                "fstype": "vfat",
                "fsuse_percentage": null,
                "fsver": "FAT32",
                "log_sec": 512,
                "mountpoint": null,
                "mountpoints": [],
                "name": "nvme0n1p1",
                "partn": 1,
                "parttype": "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
                "partuuid": "5369f15b-f11c-4c2b-bbbf-0ebeda9b3a9c",
                "path": "/dev/nvme0n1p1",
                "pkname": "nvme0n1",
                "pttype": "gpt",
                "ptuuid": "8fa8d23d-55f4-43ab-9fe1-bad5430e1c3d",
                "rota": false,
                "size": "512 MiB",
                "tran": "nvme",
                "type": "part",
                "uuid": "0D52-AC35"
            },
            {
                "children": [],
                "fsavail": null,
                "fsroots": [],
                "fstype": "ext2",
                "fsuse_percentage": null,
                "fsver": "1.0",
                "log_sec": 512,
                "mountpoint": null,
                "mountpoints": [],
                "name": "nvme0n1p2",
                "partn": 2,
                "parttype": "0fc63daf-8483-4772-8e79-3d69d8477de4",
                "partuuid": "42a272d5-3e0b-47f8-869c-885c119df274",
                "path": "/dev/nvme0n1p2",
                "pkname": "nvme0n1",
                "pttype": "gpt",
                "ptuuid": "8fa8d23d-55f4-43ab-9fe1-bad5430e1c3d",
                "rota": false,
                "size": "488 MiB",
                "tran": "nvme",
                "type": "part",
                "uuid": "255851d9-2bd7-4e48-8927-e10b7b52012a"
            },
            {
                "children": [],
                "fsavail": null,
                "fsroots": [],
                "fstype": "crypto_LUKS",
                "fsuse_percentage": null,
                "fsver": "2",
                "log_sec": 512,
                "mountpoint": null,
                "mountpoints": [],
                "name": "nvme0n1p3",
                "partn": 3,
                "parttype": "0fc63daf-8483-4772-8e79-3d69d8477de4",
                "partuuid": "9b009386-0c7c-463f-83ea-1f916358fb1f",
                "path": "/dev/nvme0n1p3",
                "pkname": "nvme0n1",
                "pttype": "gpt",
                "ptuuid": "8fa8d23d-55f4-43ab-9fe1-bad5430e1c3d",
                "rota": false,
                "size": "1906728 MiB",
                "tran": "nvme",
                "type": "part",
                "uuid": "81d35a5b-23ea-464b-bc43-fb9567c93bf0"
            }
        ],
        "fsavail": null,
        "fsroots": [],
        "fstype": null,
        "fsuse_percentage": null,
        "fsver": null,
        "log_sec": 512,
        "mountpoint": null,
        "mountpoints": [],
        "name": "nvme0n1",
        "partn": null,
        "parttype": null,
        "partuuid": null,
        "path": "/dev/nvme0n1",
        "pkname": null,
        "pttype": "gpt",
        "ptuuid": "8fa8d23d-55f4-43ab-9fe1-bad5430e1c3d",
        "rota": false,
        "size": "1907729 MiB",
        "tran": "nvme",
        "type": "disk",
        "uuid": null
    }
]
Checking version...
Failed determine pacman version: ['/usr/bin/pacman', '-Qu', 'archinstall'] exited with abnormal exit code [1]: [?25l[?25h
Password strength: strong
Password strength: weak
Password strength: strong
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/__init__.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/custom.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktop.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/minimal.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/server.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/tailored.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/xorg.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/applications/__init__.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/applications/pipewire.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/__init__.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/awesome.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/bspwm.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/budgie.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/cinnamon.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/cutefish.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/deepin.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/enlightenment.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/gnome.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/hyprland.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/i3.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/kde.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/lxqt.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/mate.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/qtile.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/sway.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/desktops/xfce4.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/__init__.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/cockpit.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/docker.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/httpd.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/lighttpd.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/mariadb.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/nginx.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/postgresql.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/sshd.py
Importing profile: /usr/lib/python3.12/site-packages/archinstall/default_profiles/servers/tomcat.py
 -- Chosen configuration --
{
    "__separator__": null,
    "additional-repositories": [],
    "advanced": true,
    "archinstall-language": "English",
    "audio_config": {
        "audio": "pipewire"
    },
    "bootloader": "Systemd-boot",
    "config_version": "2.8.0",
    "debug": false,
    "disk_config": {
        "config_type": "default_layout",
        "device_modifications": [
            {
                "device": "/dev/nvme0n1",
                "partitions": [
                    {
                        "btrfs": [],
                        "dev_path": null,
                        "flags": [
                            "Boot",
                            "ESP"
                        ],
                        "fs_type": "fat32",
                        "mount_options": [],
                        "mountpoint": "/boot",
                        "obj_id": "8ffbbe40-8681-4613-8463-d39ab3218a58",
                        "size": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "GiB",
                            "value": 1
                        },
                        "start": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "MiB",
                            "value": 1
                        },
                        "status": "create",
                        "type": "primary"
                    },
                    {
                        "btrfs": [],
                        "dev_path": null,
                        "flags": [],
                        "fs_type": "ext4",
                        "mount_options": [],
                        "mountpoint": "/",
                        "obj_id": "009497b0-d70b-488f-a9d6-7bc9a42f41b1",
                        "size": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "B",
                            "value": 1999323095040
                        },
                        "start": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "B",
                            "value": 1074790400
                        },
                        "status": "create",
                        "type": "primary"
                    }
                ],
                "wipe": true
            }
        ]
    },
    "disk_encryption": {
        "encryption_type": "luks",
        "partitions": [
            "009497b0-d70b-488f-a9d6-7bc9a42f41b1"
        ]
    },
    "hostname": "unix",
    "kernels": [
        "linux"
    ],
    "locale_config": {
        "kb_layout": "ruwin_cplk-UTF-8",
        "sys_enc": "UTF-8",
        "sys_lang": "en_US"
    },
    "mirror_config": null,
    "network_config": {
        "type": "iso"
    },
    "no_pkg_lookups": false,
    "ntp": true,
    "offline": false,
    "packages": [],
    "parallel downloads": 15,
    "profile_config": {
        "gfx_driver": null,
        "greeter": null,
        "profile": {
            "custom_settings": {},
            "details": [],
            "main": "Minimal"
        }
    },
    "save_config": null,
    "script": "guided",
    "silent": false,
    "skip_ntp": false,
    "skip_version_check": false,
    "swap": false,
    "timezone": "America/New_York",
    "uki": true,
    "version": "2.8.0"
}
Unmounting all existing partitions: /dev/nvme0n1
Unmounting: /dev/nvme0n1p1
Unmounting: /dev/nvme0n1p2
Unmounting: /dev/nvme0n1p3
Wiping partitions and metadata: /dev/nvme0n1
Creating partitions: /dev/nvme0n1
	Type: primary
	Filesystem: fat32
	Geometry: 2048 start sector, 2097152 length
	Type: primary
	Filesystem: ext4
	Geometry: 2099200 start sector, 3904927920 length
Unmounting all existing partitions: /dev/nvme0n1
Unmounting: /dev/nvme0n1p1
Unmounting: /dev/nvme0n1p2
Unmounting: /dev/nvme0n1p3
Error calling lsblk: lsblk: /dev/nvme0n1p3: not a block device
{
   "blockdevices": [

   ]
}

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_model.py", line 1113, in _fetch_lsblk_info
    result = SysCommand(cmd).decode()
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/archinstall/lib/general.py", line 365, in __init__
    self.create_session()
  File "/usr/lib/python3.12/site-packages/archinstall/lib/general.py", line 414, in create_session
    with SysCommandWorker(
  File "/usr/lib/python3.12/site-packages/archinstall/lib/general.py", line 197, in __exit__
    raise SysCallError(
archinstall.lib.exceptions.SysCallError: ['/usr/bin/lsblk', '--json', '--bytes', '--output', '+name,path,pkname,size,log-sec,pttype,ptuuid,rota,tran,partn,partuuid,parttype,uuid,fstype,fsver,fsavail,fsuse%,type,mountpoint,mountpoints,fsroots', '/dev/nvme0n1p3'] exited with abnormal exit code [32]: lsblk: /dev/nvme0n1p3: not a block device
{
   "blockdevices": [

   ]
}


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 332, in run_as_a_module
    main()
  File "/usr/lib/python3.12/site-packages/archinstall/__init__.py", line 327, in main
    importlib.import_module(mod_name)
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/archinstall/scripts/guided.py", line 245, in <module>
    fs_handler.perform_filesystem_operations()
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/filesystem.py", line 55, in perform_filesystem_operations
    device_handler.format(mod, enc_conf=self._enc_config)
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_handler.py", line 304, in format
    self._umount_all_existing(device_mod.device_path)
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_handler.py", line 481, in _umount_all_existing
    Luks2(partition.path).lock()
  File "/usr/lib/python3.12/site-packages/archinstall/lib/luks.py", line 161, in lock
    disk.device_handler.umount(self.luks_dev_path)
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_handler.py", line 564, in umount
    lsblk_info = get_lsblk_info(mountpoint)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_model.py", line 1136, in get_lsblk_info
    if infos := _fetch_lsblk_info(dev_path):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/archinstall/lib/disk/device_model.py", line 1121, in _fetch_lsblk_info
    raise DiskError(f'Failed to read disk "{dev_path}" with lsblk')
archinstall.lib.exceptions.DiskError: Failed to read disk "/dev/nvme0n1p3" with lsblk

Archinstall experienced the above error. If you think this is a bug, please report it to
https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".

Hint: To extract the log from a live ISO 
curl -F'file=@/var/log/archinstall/install.log' https://0x0.st


```


Discussion:
The exact same thing happened to me. Attaching the log file: [here](https://0x0.st/XKij.log)
As the OP stated, when re-running the script it works.

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
@@ -645,9 +645,6 @@ def partition(
 			if partition_table.MBR and len(modification.partitions) > 3:
 				raise DiskError('Too many partitions on disk, MBR disks can only have 3 primary partitions')
 
-		# make sure all devices are unmounted
-		self.umount_all_existing(modification.device_path)
-
 		# WARNING: the entire device will be wiped and all data lost
 		if modification.wipe:
 			self.wipe_dev(modification.device)
diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py
--- a/archinstall/lib/disk/filesystem.py
+++ b/archinstall/lib/disk/filesystem.py
@@ -58,6 +58,10 @@ def perform_filesystem_operations(self, show_countdown: bool = True):
 		if SysInfo.has_uefi() is False:
 			partition_table = PartitionTable.MBR
 
+		# make sure all devices are unmounted
+		for mod in device_mods:
+			device_handler.umount_all_existing(mod.device_path)
+
 		for mod in device_mods:
 			device_handler.partition(mod, partition_table=partition_table)
 
@@ -97,9 +101,6 @@ def _format_partitions(
 
 		self._validate_partitions(create_or_modify_parts)
 
-		# make sure all devices are unmounted
-		device_handler.umount_all_existing(device_path)
-
 		for part_mod in create_or_modify_parts:
 			# partition will be encrypted
 			if self._enc_config is not None and part_mod in self._enc_config.partitions:
@@ -312,9 +313,6 @@ def _encrypt_partitions(
 
 			self._validate_partitions(filtered_part)
 
-			# make sure all devices are unmounted
-			device_handler.umount_all_existing(mod.device_path)
-
 			enc_mods = {}
 
 			for part_mod in filtered_part:


Test patch: