Skip to content

Commit

Permalink
Add udev_sync() (#2669)
Browse files Browse the repository at this point in the history
  • Loading branch information
codefiles authored Sep 6, 2024
1 parent 7c08822 commit 6a2a204
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion archinstall/lib/disk/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def devices(self) -> List[BDevice]:
def load_devices(self) -> None:
block_devices = {}

SysCommand('udevadm settle')
self.udev_sync()
all_lsblk_info = get_all_lsblk_info()
devices = getAllDevices()

Expand Down Expand Up @@ -784,6 +784,13 @@ def wipe_dev(self, block_device: BDevice) -> None:

self._wipe(block_device.device_info.path)

@staticmethod
def udev_sync() -> None:
try:
SysCommand('udevadm settle')
except SysCallError as err:
debug(f'Failed to synchronize with udev: {err}')


device_handler = DeviceHandler()

Expand Down
3 changes: 1 addition & 2 deletions archinstall/lib/disk/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from ..luks import Luks2
from ..menu import Menu
from ..output import debug, info
from ..general import SysCommand

if TYPE_CHECKING:
_: Any
Expand Down Expand Up @@ -114,7 +113,7 @@ def _format_partitions(
device_handler.format(part_mod.safe_fs_type, part_mod.safe_dev_path)

# synchronize with udev before using lsblk
SysCommand('udevadm settle')
device_handler.udev_sync()

lsblk_info = device_handler.fetch_part_info(part_mod.safe_dev_path)

Expand Down

0 comments on commit 6a2a204

Please sign in to comment.