Get Virtualizor

Failed to clear the new image’s first sector

This guide is intended to help temporarily fixing the VPS creation issue.

If you are getting an error during VPS creation for qemu-img convert command : 

error while converting raw: Failed to clear the new image's first sector: Invalid argument

- Then first verify if you are using AlmaLinux 9.x and your qemu-img package version is higher than 9.1.0 on that server.
It can be checked using : yum list installed |grep qemu-*

- If its higher then check if the disk's sector size on the server is 4k.
You can check it using fdisk or gdisk command.

If that is the case then it would require downgrading the qemu package on that server.
There is an upstream bug which is not fixed in AlmaLinux qemu-img package.

Note
This would require stopping the VPSes as a precaution.
However during testing it did not require to stop them.

You can add the vault repo to use an older version of qemu package from it.
Create the file /etc/yum.repos.d/appstream-vault.repo and add the following contents :

[appstream-vault]

name=AlmaLinux Vault 9.7 - AppStream

baseurl=https://vault.almalinux.org/9.7/AppStream/x86_64/os/

enabled=1

gpgcheck=1

countme=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9

metadata_expire=86400

enabled_metadata=1

After saving the file, run the following command to downgrade the package :

yum --disablerepo="*" --enablerepo="appstream-vault" downgrade qemu-kvm

Once its successfully downgraded, you can start back the VPSes and new VPS creation should work fine.

Note
Once they release a new version in their repo then you can update the qemu-kvm package from appstream repo.
You will require to disable or remove vault repo to avoid any issue in future.
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list