Error deploying RHEL 8 image built using packer from MAAS 3.2 snap install

I am trying to deploy a RHEL8 instance on a new Dell PowerEdge R6515, and it seems to be working until after the disks are set up and curtin attempts to chroot to the new environment to install packages.

It throws the following messages:
```
Finalizing /tmp/tmpxcp08afk/target
finish: cmd-install/stage-hook/builtin/cmd-hook: SUCCESS: curtin command hook
start: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: curtin command in-target
Running command [‘mount’, ‘–bind’, ‘/dev’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/proc’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/run’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/sys’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/sys/firmware/efi/efivars’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘unshare’, ‘–help’] with allowed return codes [0] (capture=True)
Running command [‘unshare’, ‘–fork’, ‘–pid’, ‘–’, ‘chroot’, ‘/tmp/tmpxcp08afk/target’, ‘bash’, ‘-c’, ‘dpkg-query -s cloud-init || (echo “cloud-init not detected, MAAS will not be able to configure this machine properly” && exit 1)’] with allowed return codes [0] (capture=False)
bash: dpkg-query: command not found
cloud-init not detected, MAAS will not be able to configure this machine properly
Running command [‘udevadm’, ‘settle’] with allowed return codes [0] (capture=False)
TIMED subp([‘udevadm’, ‘settle’]): 0.005
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: FAIL: curtin command in-target
curtin: Installation failed with exception: Unexpected error while running command.
Command: [‘curtin’, ‘in-target’, ‘–’, ‘bash’, ‘-c’, ‘dpkg-query -s cloud-init || (echo “cloud-init not detected, MAAS will not be able to configure this machine properly” && exit 1)’]
Exit code: 1
Reason: -
Stdout: start: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: curtin command in-target
Running command [‘mount’, ‘–bind’, ‘/dev’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/proc’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/run’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/sys’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–bind’, ‘/sys/firmware/efi/efivars’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘unshare’, ‘–help’] with allowed return codes [0] (capture=True)
Running command [‘unshare’, ‘–fork’, ‘–pid’, ‘–’, ‘chroot’, ‘/tmp/tmpxcp08afk/target’, ‘bash’, ‘-c’, ‘dpkg-query -s cloud-init || (echo “cloud-init not detected, MAAS will not be able to configure this machine properly” && exit 1)’] with allowed return codes [0] (capture=False)
bash: dpkg-query: command not found
cloud-init not detected, MAAS will not be able to configure this machine properly
Running command [‘udevadm’, ‘settle’] with allowed return codes [0] (capture=False)
TIMED subp([‘udevadm’, ‘settle’]): 0.005
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/sys/firmware/efi/efivars’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/sys’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/run’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/proc’] with allowed return codes [0] (capture=False)
Running command [‘mount’, ‘–make-private’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
Running command [‘umount’, ‘/tmp/tmpxcp08afk/target/dev’] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: FAIL: curtin command in-target

Stderr: ''
```

I verified that cloud-init is included in the rhel8.ks file in the packer image.

Any direction on how to get past this would be greatly appreciated.

Thanks

~~ Charles

After digging in a bit more, I tried to install rhel8 on a second host. This one had a slightly different experience, in that I was able to see on the console that it couldn’t boot to the image it was trying to boot into, probably because MAAS was pointing the boot process to the wrong location.

Thoughts?

Anyway - here is the console screen-shot, and the tail of the logs:

Finalizing /tmp/tmpplouiu3_/target
finish: cmd-install/stage-hook/builtin/cmd-hook: SUCCESS: curtin command hook
start: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: curtin command in-target
Running command ['mount', '--bind', '/dev', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/proc', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/run', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
Running command ['unshare', '--help'] with allowed return codes [0] (capture=True)
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpplouiu3_/target', 'bash', '-c', 'dpkg-query -s cloud-init || (echo "cloud-init not detected, MAAS will not be able to configure this machine properly" && exit 1)'] with allowed return codes [0] (capture=False)
bash: dpkg-query: command not found
cloud-init not detected, MAAS will not be able to configure this machine properly
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.009
Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: FAIL: curtin command in-target
curtin: Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'in-target', '--', 'bash', '-c', 'dpkg-query -s cloud-init || (echo "cloud-init not detected, MAAS will not be able to configure this machine properly" && exit 1)']
Exit code: 1
Reason: -
Stdout: start: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: curtin command in-target
        Running command ['mount', '--bind', '/dev', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/proc', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/run', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['unshare', '--help'] with allowed return codes [0] (capture=True)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpplouiu3_/target', 'bash', '-c', 'dpkg-query -s cloud-init || (echo "cloud-init not detected, MAAS will not be able to configure this machine properly" && exit 1)'] with allowed return codes [0] (capture=False)
        bash: dpkg-query: command not found
        cloud-init not detected, MAAS will not be able to configure this machine properly
        Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
        TIMED subp(['udevadm', 'settle']): 0.009
        Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmpplouiu3_/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmpplouiu3_/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmpplouiu3_/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmpplouiu3_/target/dev'] with allowed return codes [0] (capture=False)
        finish: cmd-install/stage-late/98-validate-custom-image-has-cloud-init/cmd-in-target: FAIL: curtin command in-target

Thanks in advance

~~ Charles