Need Help With Deployable images for MaaS - Several Packer and Raid Problems

Hello MaaS’ists,

I need help in generating images from packer. and in deployment.

First I am having error in generating images for rhel and centos stream.
AlmaLinux and Rocky Linux image has been generated but deploying them with a raid commissioned machine is giving me problems.

I am less experienced in kickstart file and I am getting error after deploying image.

this is the current raid I am using

#!/bin/bash
# --- Start MAAS 1.0 script metadata ---
# name: 43-alma-raid-grub-setup
# title: Configure RAID and Install GRUB Bootloader for AlmaLinux
# description: Configures disk layout with RAID and installs GRUB on EFI partition
# script_type: commissioning
# timeout: 60
# --- End MAAS 1.0 script metadata ---

# Function to clean up on exit
cleanup() {
    umount /mnt/sys 2>/dev/null
    umount /mnt/proc 2>/dev/null
    umount /mnt/dev 2>/dev/null
    umount /mnt/boot/efi 2>/dev/null
    umount /mnt 2>/dev/null
}
trap cleanup EXIT

# Write the storage configuration to MAAS
cat > "$MAAS_STORAGE_CONFIG_FILE" <<EOL
{
    "layout": {
        "sda": {
            "type": "disk",
            "ptable": "gpt",
            "partitions": [
                {
                    "name": "sda1",
                    "bootable": true,
                    "fs": "fat32",
                    "size": "1G"
                },
                {
                    "name": "sda2",
                    "size": "490G"
                }
            ]
        },
        "sdb": {
            "type": "disk",
            "ptable": "gpt",
            "partitions": [
                {
                    "name": "sdb1",
                    "fs": "fat32",
                    "size": "1G"
                },
                {
                    "name": "sdb2",
                    "size": "490G"
                }
            ]
        },
        "md0": {
            "type": "raid",
            "level": 1,
            "members": [
                "sda2",
                "sdb2"
            ],
            "fs": "ext4"
        }
    },
    "mounts": {
        "/mnt": {
            "device": "md0"
        },
        "/boot/efi": {
            "device": "sda1"
        },
        "/": {
            "device": "md0"
        }
    }
}
EOL

# Create directories for bind mounts
mkdir -p /mnt/dev /mnt/proc /mnt/sys

# Bind mount necessary filesystems
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

# Chroot into the installed system to install GRUB
chroot /mnt /bin/bash <<'EOF'
# Install GRUB for UEFI systems
if ! grub2-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub; then
    echo "GRUB installation failed."
    exit 1
fi

# Generate the GRUB configuration file
if ! grub2-mkconfig -o /boot/grub2/grub.cfg; then
    echo "Failed to generate GRUB configuration."
    exit 1
fi
EOF

# Cleanup
cleanup

echo "RAID configuration and GRUB installation completed successfully."

  1. I am having problem compiling image from packer for centos and centos stream.
  2. This partition table works with ubuntu but I am getting hard time deploying RHEL based OS. cannot find bootable media after deployment on reboot. though I can see in the logs the deployment shows successful and Installation complete - Node disabled netboot message.

I am getting error when system boots after deployment and the OS can’t find any bootable partition or media and in MaaS I can see the raid configured correctly. I figure grub was not written properly to the partition.

Any Ideas what am I doing wrong?

#!/bin/bash
# --- Start MAAS 1.0 script metadata ---
# name: 43-ubuntu-raid-test
# title: Configure TCS node storage layout for AlmaLinux
# description: Configure the disk layout for the OS
# script_type: commissioning
# timeout: 10
# --- End MAAS 1.0 script metadata ---

cat > "$MAAS_STORAGE_CONFIG_FILE" <<EOL
{
    "layout": {
        "sda": {
            "type": "disk",
            "ptable": "gpt",
            "partitions": [
                {
                    "name": "sda1",
                    "bootable": true,
                    "fs": "fat32",
                    "size": "1G"
                },
                {
                    "name": "sda2",
                    "size": "490G"
                }
            ]
        },
        "sdb": {
            "type": "disk",
            "ptable": "gpt",
            "partitions": [
                {
                    "name": "sdb1",
                    "fs": "fat32",
                    "size": "1G"
                },
                {
                    "name": "sdb2",
                    "size": "490G"
                }
            ]
        },
        "md0": {
            "type": "raid",
            "level": 1,
            "members": [
                "sda2",
                "sdb2"
            ],
            "fs": "xfs"
        }
    },
    "mounts": {
        "/mnt": {
            "device": "md0"
        },
        "/boot/efi": {
            "device": "sda1"
        },
        "/": {
            "device": "md0"
        }
    }
}
EOL

Custom Storage with Raid Configuration for ubuntu

I haven’t configured a RAID device with MAAS, but at first glance it looks like you’re not using a partition in your mounts, but the raid device itself.