Curtin hooks error when deploying RHEL8 image

I’m trying to deploy a RHEL8 custom image with MAAS 3.3.4. The image was built with Packer, (we use our own Packer templates and not the packer-maas repository).

You can see below the error message at the end of the installation output:

finish: cmd-install/stage-extract/builtin/cmd-extract: SUCCESS: acquiring and extracting image from http://172.16.37.254:5248/images/rhel/amd64/generic/rhel8-2.0-rc1-tgz/uploaded/root-tgz
Applying write_files from config.
finish: cmd-install/stage-extract/builtin/cmd-extract: SUCCESS: curtin command extract
start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
Running curtin builtin curthooks
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
  File "/curtin/curtin/commands/main.py", line 202, in main
    ret = args.func(args)
  File "/curtin/curtin/commands/curthooks.py", line 1886, in curthooks
    builtin_curthooks(cfg, target, state)
  File "/curtin/curtin/commands/curthooks.py", line 1681, in builtin_curthooks
    distro_info = distro.get_distroinfo(target=target)
  File "/curtin/curtin/distro.py", line 119, in get_distroinfo
    variant_name = variant_os_release['ID']
KeyError: 'ID'
'ID'
curtin: Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'curthooks']
Exit code: 3
Reason: -
Stdout: start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
        Running curtin builtin curthooks
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
        Traceback (most recent call last):
          File "/curtin/curtin/commands/main.py", line 202, in main
            ret = args.func(args)
          File "/curtin/curtin/commands/curthooks.py", line 1886, in curthooks
            builtin_curthooks(cfg, target, state)
          File "/curtin/curtin/commands/curthooks.py", line 1681, in builtin_curthooks
            distro_info = distro.get_distroinfo(target=target)
          File "/curtin/curtin/distro.py", line 119, in get_distroinfo
            variant_name = variant_os_release['ID']
        KeyError: 'ID'
        'ID'
        
Stderr: ''

I have used the following command to import the image as written in the docs:

maas admin boot-resources create name='rhel/rhel8-v1.0' title='RHEL 8 v1.0' architecture='amd64/generic' filetype='tgz' content@=packer-rhel8-v1.0.tgz

Do I need to install curtin hooks in the image? The script fuse-tar-root in the packer-maas repo seems to do that but I don’t know where it gets the curtin hooks.

Could the fact that my image has a LVM custom partitioning be a cause for this problem?

Hi @tandrez!

From what I see in the curtin source code, it tries to extract RHEL release information from etc/redhat-release file, so your assumption about custom partitioning might be correct.

Could you please check whether the issue occurs with the official packer template? Thanks!

Thanks for your reply @igor-brovtsin. I haven’t tried yet with the official packer template but I’m nearly sure that it will work.

I have multiple questions that I didn’t manage to find the answers in the official docs:

  • What does the parameter base_image when importing an image? When do we need to specify it? What are the possible values?
  • Regarding the image name, what is the difference between name=rhel/8-custom and name=custom/rhel8 for example? When to use the one or the other?
  • What is the difference between importing filetype='tgz' and filetype='ddgz'? When to use the one or the other?

I wonder if it is even possible to deploy an image with a custom partitioning with MAAS. How should the storage layout be managed: Do I need to build an image with a single root filesystem and create a custom storage layout with MAAS?

To the original poster @tandrez:

  • The curtin hook errors seem to indicate an issue with the image lacking proper RHEL identification in /etc/redhat-release. Try building the image using the official MAAS Packer templates as a baseline to include proper curtin hooks.
  • For your questions:
    • The base_image parameter specifies the parent image to derive from when importing custom images. This is only needed when importing an image derived from an existing MAAS image.
    • The name parameter controls the path location to store the image file. name=rhel/8-custom would place it under rhel/ while name=custom/rhel8 would place it under custom/.
    • filetype=tgz is a gzipped tar archive while ddgz is a gzipped disk image. Use tgz for filesystem archives and ddgz for full disk images.
    • Custom partitioning is possible but complex - easiest to start with a single root FS image and customize storage with MAAS.

To @igor-brovtsin:

  • Good point about /etc/redhat-release likely causing the issue here. Testing with the Packer template would help validate.
  • Could also be worth checking if any curtin pre-install hooks are needed to properly identify this RHEL release.

Thanks for the answers @billwear.

I have modified my Packer template to use only one root FS and was able to deploy it with the default LVM storage layout configured by MAAS. I guess that now, I need to find out how to use the custom storage layout.

I’ve been looking for a solution for custom storage(ubuntu2204) for a few days but I haven’t made any progress yet.

@elperro, I’m assuming you’re referring to this post?

@tandrez, if you have any trouble making sense of it, let me know. I write the doc, so if it’s not well-explained, that’s something we should work on together.