Failed to erase disk when loading custom image

Hello everyone,
I’m currently running into an issue when deploying new machines. When they reach the stage of loading the custom image via HTTP requests, I try to release the machines instantly but it set the stage to failed to erase disk right away. I’m not sure MAAS support this or not, this only happen when I tried to release the machines when the custom image is loaded

I cannot find the exception log when MAAS set the state to "failed disk erasing " in the syslog

Screenshot 2025-04-10 at 17.01.47

Thanks in advance for all the help.

Hi there, thanks for your question!

Just to fully understand the situation, I want to ask a few questions about your setup:

  1. Are you using just the “Erase disks before releasing” option, or doing a secure wipe, or quick wipe?
  2. What types of filesystems are attached to the machine when erasing it? (e.g. LVM, RAID, etc.)

Also, when you say

When they reach the stage of loading the custom image via HTTP requests, I try to release the machines instantly but it set the stage to failed to erase disk right away.

What happens when you let the machine fully deploy, and then release it and erase the disks? Does it work then?

I can see how releasing a machine while it’s deploying would lead to an error state, I just want to ascertain whether this could be due to the timing of the release/erasing process or whether it’s specifically caused by using a custom image.

Thanks for your response.

I was using the “Erase disks before releasing” option, and all of our machines are running RAID 1. When the machines are fully deployed, I can release them without any issues.

However, upon checking, I found that whenever I deploy a machine and release it, it fails as soon as it reaches the HTTP request for the custom image. The machine’s state is set to “Failed.”

I also tried aborting and releasing the machine without erasing the disks and MAAS set the state to “Deployment Failed” or “Failed to Release.”

Could it be that our custom image doesn’t meet the requirements or exceptions needed to allow releasing while the machine is still deploying?

How are you building your custom image?

The recommended way to make custom images for use with MAAS is with Packer. Here is the documentation and here are some packer templates for making custom images for MAAS.

Thank you for your response.

All of our images are built using Packer, following the MAAS documentation. After several days of trying to figure out what cause the error, I discovered that even the default image provided by Ubuntu fails during the release or disk erasing stage when deploying the machine.

Hi @huy123

Is there anything interesting under script results?
maas admin node-script-results read {node system_id} type=release

The script that does disk erasing is located here (please note that the link is pointing to the master branch)

Hello @troyanov,

Thank you for your response.

After reviewing the script results, this is the output I got. I didn’t notice any errors or issues.

This is easy to reproduce—just wait for the state to change from “Pending” to “Running”, and then perform an abort, release, or disk erase. This will cause the machine’s state to change to “Error”.

[
    {
        "system_id": "atdagh",
        "started": null,
        "last_ping": null,
        "id": 1246,
        "runtime": "",
        "type_name": "Release",
        "type": 3,
        "ended": null,
        "status_name": "Aborted",
        "status": 5,
        "results": [
            {
                "id": 5782,
                "created": "Mon, 10 Mar 2025 17:28:25 -0000",
                "updated": "Mon, 10 Mar 2025 17:28:25 -0000",
                "name": "wipe-disks",
                "status": 5,
                "status_name": "Aborted",
                "exit_status": null,
                "started": null,
                "ended": null,
                "runtime": "",
                "starttime": "",
                "endtime": "",
                "estimated_runtime": "Unknown",
                "parameters": {
                    "quick_erase": {
                        "type": "boolean",
                        "value": false,
                        "argument_format": "--quick-erase"
                    },
                    "secure_erase": {
                        "type": "boolean",
                        "value": false,
                        "argument_format": "--secure-erase"
                    }
                },
                "script_id": 31,
                "script_revision_id": null,
                "suppressed": false
            }
        ],
        "resource_uri": "/MAAS/api/2.0/nodes/atdagh/results/1246/"
    },
    {
        "system_id": "atdagh",
        "started": null,
        "last_ping": null,
        "id": 2553,
        "runtime": "",
        "type_name": "Release",
        "type": 3,
        "ended": null,
        "status_name": "Aborted",
        "status": 5,
        "results": [
            {
                "id": 10419,
                "created": "Wed, 19 Mar 2025 16:12:10 -0000",
                "updated": "Wed, 19 Mar 2025 16:12:10 -0000",
                "name": "wipe-disks",
                "status": 5,
                "status_name": "Aborted",
                "exit_status": null,
                "started": null,
                "ended": null,
                "runtime": "",
                "starttime": "",
                "endtime": "",
                "estimated_runtime": "Unknown",
                "parameters": {
                    "secure_erase": {
                        "type": "boolean",
                        "value": true,
                        "argument_format": "--secure-erase"
                    }
                },
                "script_id": 31,
                "script_revision_id": null,
                "suppressed": false
            }
        ],
        "resource_uri": "/MAAS/api/2.0/nodes/atdagh/results/2553/"
    },
    {
        "system_id": "atdagh",
        "started": null,
        "last_ping": null,
        "id": 5170,
        "runtime": "",
        "type_name": "Release",
        "type": 3,
        "ended": null,
        "status_name": "Pending",
        "status": 0,
        "results": [
            {
                "id": 13471,
                "created": "Fri, 18 Apr 2025 11:05:17 -0000",
                "updated": "Fri, 18 Apr 2025 11:05:17 -0000",
                "name": "wipe-disks",
                "status": 0,
                "status_name": "Pending",
                "exit_status": null,
                "started": null,
                "ended": null,
                "runtime": "",
                "starttime": "",
                "endtime": "",
                "estimated_runtime": "Unknown",
                "parameters": {
                    "quick_erase": {
                        "type": "boolean",
                        "value": false,
                        "argument_format": "--quick-erase"
                    },
                    "secure_erase": {
                        "type": "boolean",
                        "value": false,
                        "argument_format": "--secure-erase"
                    }
                },
                "script_id": 31,
                "script_revision_id": null,
                "suppressed": false
            }
        ],
        "resource_uri": "/MAAS/api/2.0/nodes/atdagh/results/5170/"
    }
]

Edit: Forgot to mention current MAAS version im using is MAAS 3.5.4 (deb)