Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
titletruenas_installer/install.py
async def format_disk(disk: Disk, set_pmbr: bool, callback: Callable):
    await wipe_disk(disk, callback)

    # Create BIOS boot partition
    await run(["sgdisk", "-a4096", "-n1:0:+1024K", "-t1:EF02", "-A1:set:2", disk.device])

    # Create EFI partition (Even if not used, allows user to switch to UEFI later)
    await run(["sgdisk", "-n2:0:+524288K", "-t2:EF00", disk.device])

    # Create data partition
    await run(["sgdisk", "-n3:0:0", "-t3:BF01", disk.device])

    # Bad hardware is bad, but we've seen a few users
    # state that by the time we run `parted` command
    # down below OR the caller of this function tries
    # to do something with the partition(s), they won't
    # be present. This is almost _exclusively_ related
    # to bad hardware, but we will wait up to 30 seconds
    # for the partitions to show up in sysfs.
    disk_parts = await get_partitions(disk.device, [1, 2, 3], tries=30)
    for partnum, part_device in disk_parts.items():
        if part_device is None:
            raise InstallError(f"Failed to find partition number {partnum} on {disk.name}")

    if set_pmbr:
        await run(["parted", "-s", disk.device, "disk_set", "pmbr_boot", "on"], check=False)

Workaround #1

Just re-try install 2-10 times until it work. Yes. as simple as that.


Workaund #2

So next workaround might be to create a partition in advance from the ShellWorkaund #1

Code Block
# Choose (3) Shell option in menu

# remove partition tables
sgdisk -Z /dev/mmcblk0
# from NVMe also (but it might not be neccessary)
sgdisk -Z /dev/nvme0n1
sgdisk -Z /dev/nvme0n1nvme1n1
sgdisk -Z /dev/nvme2n1
sgdisk -Z /dev/nvme0n1nvme3n1
# create partition table on eMMC as Install script do it
sgdisk -a 4096 -n 1:0:+1024K   -t 1:EF02 -A 1:set:2 /dev/mmcblk0
sgdisk         -n 2:0:+524288K -t 2:EF00            /dev/mmcblk0
sgdisk         -n 3:0:0        -t 3:BF01            /dev/mmcblk0 

# it might be an overkill with partprobes, but anyway
sync;
partporbe
partprobe /dev/mmcblk0
partprobe /dev/nvme0n1
partprobe /dev/nvme1n1
partprobe /dev/nvme2n1
partprobe /dev/nvme3n1

exit # End continue Install.

...

Try using commands like below in the shell

Workaround #2 #3 less chance, but you can play with it too

...