[Solved][Arch Linux] Partition /dev/vda keeps being busy issue

I’m trying to create an Arch Linux Box that automatically runs archinstall,
through running an archinstall script on packer.

It would be like a docker app, but I want it to be 100% safe,
so if the wrong device is chosen by accident,
only the VM is destroyed.

This is the main error:

    scarf-installer.qemu.archlinux: Could not execute partprobe: SysCallError("['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\r\\n'")

archinstall script error

scarf-installer.qemu.archlinux: >>>> setup.sh: - Begin Arch Installer -
==> scarf-installer.qemu.archlinux: Traceback (most recent call last):
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/filesystem.py", line 175, in partprobe
==> scarf-installer.qemu.archlinux:     SysCommand(f'partprobe {self.blockdevice.device}')
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/general.py", line 459, in __init__
==> scarf-installer.qemu.archlinux:     self.create_session()
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/general.py", line 510, in create_session
==> scarf-installer.qemu.archlinux:     with SysCommandWorker(
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/general.py", line 284, in __exit__
==> scarf-installer.qemu.archlinux:     raise SysCallError(f"{self.cmd} exited with abnormal exit code [{self.exit_code}]: {self._trace_log[-500:]}", self.exit_code, worker=self)
==> scarf-installer.qemu.archlinux: archinstall.lib.exceptions.SysCallError: ['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\r\n'
==> scarf-installer.qemu.archlinux:
==> scarf-installer.qemu.archlinux: During handling of the above exception, another exception occurred:
==> scarf-installer.qemu.archlinux:
==> scarf-installer.qemu.archlinux: Traceback (most recent call last):
==> scarf-installer.qemu.archlinux:   File "/usr/bin/archinstall", line 8, in <module>
==> scarf-installer.qemu.archlinux:     sys.exit(run_as_a_module())
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/__init__.py", line 312, in run_as_a_module
==> scarf-installer.qemu.archlinux:     script.execute()
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/profiles.py", line 195, in execute
==> scarf-installer.qemu.archlinux:     self.spec.loader.exec_module(sys.modules[self.namespace])
==> scarf-installer.qemu.archlinux:   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
==> scarf-installer.qemu.archlinux:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
==> scarf-installer.qemu.archlinux:   File "/tmp/files/packer-archlinux.py", line 182, in <module>
==> scarf-installer.qemu.archlinux:     unattended_installer()
==> scarf-installer.qemu.archlinux:   File "/tmp/files/packer-archlinux.py", line 178, in unattended_installer
==> scarf-installer.qemu.archlinux:     format_disks(block_devices, disk_layouts)
==> scarf-installer.qemu.archlinux:   File "/tmp/files/packer-archlinux.py", line 51, in format_disks
==> scarf-installer.qemu.archlinux:     with archinstall.Filesystem(block_devices[disk], mode) as fs:
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/filesystem.py", line 46, in __exit__
==> scarf-installer.qemu.archlinux:     raise args[1]
==> scarf-installer.qemu.archlinux:   File "/tmp/files/packer-archlinux.py", line 53, in format_disks
==> scarf-installer.qemu.archlinux:     fs.load_layout(disk_layouts[disk])
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/filesystem.py", line 75, in load_layout
==> scarf-installer.qemu.archlinux:     if not self.parted_mklabel(self.blockdevice.device, "gpt"):
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/filesystem.py", line 297, in parted_mklabel
==> scarf-installer.qemu.archlinux:     self.partprobe()
==> scarf-installer.qemu.archlinux:   File "/usr/lib/python3.10/site-packages/archinstall/lib/disk/filesystem.py", line 178, in partprobe
==> scarf-installer.qemu.archlinux:     raise DiskError(f"Could not run partprobe on {self.blockdevice.device}: {error!r}")
==> scarf-installer.qemu.archlinux: archinstall.lib.exceptions.DiskError: Could not run partprobe on /dev/vda: SysCallError("['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\r\\n'")
scarf-installer.qemu.archlinux: >>>> setup.sh: - End Arch Installer -

/var/log/archinstall/install.log

    scarf-installer.qemu.archlinux: Loading /tmp/files/user_credentials.json:
    scarf-installer.qemu.archlinux: Loading /tmp/files/user_configuration.json:
    scarf-installer.qemu.archlinux: Loading /tmp/files/user_disk_layout.json:
    scarf-installer.qemu.archlinux: Could not get block device information using blkid() using command blkid -p -o export /dev/sr0
    scarf-installer.qemu.archlinux: Could not get free space on /dev/sr0: ['/usr/bin/parted', '-s', '--machine', '/dev/sr0', 'print', 'free'] exited with abnormal exit code [1]: b'Error: Error opening /dev/sr0: No medium found\r\n'
    scarf-installer.qemu.archlinux: Could not get block device information using blkid() using command blkid -p -o export /dev/fd0
    scarf-installer.qemu.archlinux: Could not get free space on /dev/fd0: ['/usr/bin/parted', '-s', '--machine', '/dev/fd0', 'print', 'free'] exited with abnormal exit code [1]: b'Error: Error opening /dev/fd0: No such device or address\r\n'
    scarf-installer.qemu.archlinux: Unreliable results might be given for /dev/vda1 due to partprobe error: ['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\r\n'
    scarf-installer.qemu.archlinux: Unreliable results might be given for /dev/vda2 due to partprobe error: ['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\r\n'
    scarf-installer.qemu.archlinux: Creating a new partition label on /dev/vda
    scarf-installer.qemu.archlinux: Could not execute partprobe: SysCallError("['/usr/bin/partprobe', '/dev/vda'] exited with abnormal exit code [1]: b'Error: Partition(s) 1 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\r\\n'")

Relevant files:

https://raw.githubusercontent.com/safenetwork-community/scarf-install/main/sci-base/scarf-installer.pkr-hcl
https://github.com/safenetwork-community/scarf-install/blob/main/sci-base/scripts/setup.sh
https://raw.githubusercontent.com/safenetwork-community/scarf-install/main/sci-base/srv/cfg-liveVM.sh

Culprit found.

scarf-installer.pkr-hcl

source "qemu" "archlinux" {
...
image_disk = true
...
}

I don’t know why this causes the iso to be busy, but it does.