`curtin` command fails due to grub-efi-amd64 pkg conflicts

Hi,

I have searched the forum for similar issues but no luck.
The most similar one is Custom image deployment fails - ‘curtin’ curtin command install.
I used packer to generate a custom image with Ubuntu 22.04 base in hope of deploying to a machine on my MaaS server (ver 3.3.4-13189-g.f88272d1e).

However, while deploying, ‘curtin’ always fails at this:

The following packages have unmet dependencies:
         grub-efi-amd64 : Conflicts: grub-pc but 2.04-1ubuntu26.17 is to be installed
         grub-pc : Conflicts: grub-efi-amd64
                   Conflicts: grub-efi-amd64:i386
        E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

The full error dump from install.log:

Stdout: start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
        Running curtin builtin curthooks
        Configuring target system for distro: ubuntu osfamily: debian
        start: cmd-install/stage-curthooks/builtin/cmd-curthooks/writing-apt-config: configuring apt configuring apt
        Transferred {'grub2': 'grub2   grub2/update_nvram  boolean false', 'maas': 'cloud-init   cloud-init/datasources  multiselect MAAS\ncloud-init   cloud-init/maas-metadata-url  string http://10.10.10.1:5248/MAAS/metadata/\ncloud-init   cloud-init/maas-metadata-credentials  string oauth_consumer_key=XALeX8BtwPktmLrpnP&oauth_token_key=Egg3JxZX3sQNeQNaZ2&oauth_token_secret=KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\ncloud-init   cloud-init/local-cloud-config  string manage_etc_hosts: true\\nmanual_cache_clean: true\\nreporting:\\n  maas:\\n    consumer_key: XALeX8BtwPktmLrpnP\\n    endpoint: http://10.10.10.1:5248/MAAS/metadata/status/4cayde\\n    token_key: Egg3JxZX3sQNeQNaZ2\\n    token_secret: KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\\n    type: webhook\\n\n'} into new format: {'preserve_sources_list': False, 'proxy': 'http://10.10.10.1:8000/', 'sources_list': 'deb http://archive.ubuntu.com/ubuntu $RELEASE main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-updates main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-updates main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-security main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-security main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-backports main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-backports main universe multiverse restricted\n', 'debconf_selections': {'grub2': 'grub2   grub2/update_nvram  boolean false', 'maas': 'cloud-init   cloud-init/datasources  multiselect MAAS\ncloud-init   cloud-init/maas-metadata-url  string http://10.10.10.1:5248/MAAS/metadata/\ncloud-init   cloud-init/maas-metadata-credentials  string oauth_consumer_key=XALeX8BtwPktmLrpnP&oauth_token_key=Egg3JxZX3sQNeQNaZ2&oauth_token_secret=KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\ncloud-init   cloud-init/local-cloud-config  string manage_etc_hosts: true\\nmanual_cache_clean: true\\nreporting:\\n  maas:\\n    consumer_key: XALeX8BtwPktmLrpnP\\n    endpoint: http://10.10.10.1:5248/MAAS/metadata/status/4cayde\\n    token_key: Egg3JxZX3sQNeQNaZ2\\n    token_secret: KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\\n    type: webhook\\n\n'}}
        curthooks handling apt to target /tmp/tmppcbx5_mt/target with config {'preserve_sources_list': False, 'proxy': 'http://10.10.10.1:8000/', 'sources_list': 'deb http://archive.ubuntu.com/ubuntu $RELEASE main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-updates main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-updates main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-security main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-security main universe multiverse restricted\ndeb http://archive.ubuntu.com/ubuntu $RELEASE-backports main universe multiverse restricted\n# deb-src http://archive.ubuntu.com/ubuntu $RELEASE-backports main universe multiverse restricted\n', 'debconf_selections': {'grub2': 'grub2   grub2/update_nvram  boolean false', 'maas': 'cloud-init   cloud-init/datasources  multiselect MAAS\ncloud-init   cloud-init/maas-metadata-url  string http://10.10.10.1:5248/MAAS/metadata/\ncloud-init   cloud-init/maas-metadata-credentials  string oauth_consumer_key=XALeX8BtwPktmLrpnP&oauth_token_key=Egg3JxZX3sQNeQNaZ2&oauth_token_secret=KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\ncloud-init   cloud-init/local-cloud-config  string manage_etc_hosts: true\\nmanual_cache_clean: true\\nreporting:\\n  maas:\\n    consumer_key: XALeX8BtwPktmLrpnP\\n    endpoint: http://10.10.10.1:5248/MAAS/metadata/status/4cayde\\n    token_key: Egg3JxZX3sQNeQNaZ2\\n    token_secret: KacXYDxc7sWvmSK7ADcewcCvLaBx8ds2\\n    type: webhook\\n\n'}}
        Running command ['unshare', '--help'] with allowed return codes [0] (capture=True)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'lsb_release', '--all'] with allowed return codes [0] (capture=True)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg', '--print-architecture'] with allowed return codes [0] (capture=True)
        got primary mirror: None
        got security mirror: None
        Apt Mirror info: {'PRIMARY': 'http://archive.ubuntu.com/ubuntu/', 'SECURITY': 'http://security.ubuntu.com/ubuntu/', 'MIRROR': 'http://archive.ubuntu.com/ubuntu/'}
        Applying debconf selections
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'debconf-set-selections'] with allowed return codes [0] (capture=True)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg-query', '--list'] with allowed return codes [0] (capture=True)
        unconfiguring cloud-init
        cleaning cloud-init config from: ['/tmp/tmppcbx5_mt/target/etc/cloud/cloud.cfg.d/90_dpkg.cfg']
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg-reconfigure', '--frontend=noninteractive', 'cloud-init'] with allowed return codes [0] (capture=True)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg-query', '--show', '--showformat', '${Version}', 'cloud-init'] with allowed return codes [0] (capture=True)
        Set preserve_sources_list to True in /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg with: {'apt': {'preserve_sources_list': True}}
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg', '--print-architecture'] with allowed return codes [0] (capture=True)
        write apt proxy info to /tmp/tmppcbx5_mt/target/etc/apt/apt.conf.d/90curtin-aptproxy
        Running command ['mount', '--bind', '/dev', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/proc', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/run', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys/firmware/efi/efivars', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Diverting original update-initramfs in target.
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg-divert', '--add', '--rename', '--divert', '/usr/sbin/update-initramfs.curtin-disabled', '/usr/sbin/update-initramfs'] with allowed return codes [0] (capture=False)
        Adding 'local diversion of /usr/sbin/update-initramfs to /usr/sbin/update-initramfs.curtin-disabled'
        Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
        TIMED subp(['udevadm', 'settle']): 0.040
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/writing-apt-config: SUCCESS: configuring apt configuring apt
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'lsb_release', '--all'] with allowed return codes [0] (capture=True)
        start: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: installing missing packages
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'dpkg-query', '--list'] with allowed return codes [0] (capture=True)
        Curtin config dependencies requires additional packages: ['e2fsprogs']
        Running command ['dpkg', '--print-architecture'] with allowed return codes [0] (capture=True)
        Running command ['apt-cache', 'pkgnames'] with allowed return codes [0] (capture=True)
        Running command ['apt-cache', 'pkgnames'] with allowed return codes [0] (capture=True)
        Skipping install of {'grub-efi-amd64', 'grub-efi-amd64-signed', 'bridge-utils', 'ifenslave', 'vlan', 'shim-signed', 'efibootmgr'}.  Not needed on netplan system.
        start: cmd-install/stage-curthooks/builtin/cmd-curthooks: Installing packages on target system: ['efibootmgr', 'grub-efi-amd64', 'grub-efi-amd64-signed', 'shim-signed']
        Running command ['mount', '--bind', '/dev', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/proc', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/run', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys/firmware/efi/efivars', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'apt-get', '--quiet', '--option=Acquire::Languages=none', '--option=Dir::Etc::sourcelist=/tmp/tmphzqw5oyu/sources.list', '--option=Dir::Etc::sourceparts=/tmp/tmphzqw5oyu/sources.list.d', 'update'] with allowed return codes [0] (capture=False)
        Running in chroot, ignoring request: start
        Get:1 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.26/deb  InRelease [1189 B]
        Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
        Get:3 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.26/deb  Packages [14.7 kB]
        Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
        Get:5 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
        Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
        Get:7 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
        Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]
        Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
        Get:10 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages [4642 kB]
        Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8628 kB]
        Get:12 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
        Get:13 http://archive.ubuntu.com/ubuntu focal/multiverse i386 Packages [74.7 kB]
        Get:14 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
        Get:15 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
        Get:16 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [22.0 kB]
        Get:17 http://archive.ubuntu.com/ubuntu focal/restricted i386 Packages [8112 B]
        Get:18 http://archive.ubuntu.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
        Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2888 kB]
        Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [893 kB]
        Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [17.1 kB]
        Get:22 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [750 kB]
        Get:23 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1123 kB]
        Get:24 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [25.6 kB]
        Get:25 http://archive.ubuntu.com/ubuntu focal-updates/multiverse i386 Packages [8436 B]
        Get:26 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [25.8 kB]
        Get:27 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [620 B]
        Get:28 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [2383 kB]
        Get:29 http://archive.ubuntu.com/ubuntu focal-updates/restricted i386 Packages [34.6 kB]
        Get:30 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [572 B]
        Get:31 http://archive.ubuntu.com/ubuntu focal-security/main i386 Packages [660 kB]
        Get:32 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [2500 kB]
        Get:33 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [13.2 kB]
        Get:34 http://archive.ubuntu.com/ubuntu focal-security/universe i386 Packages [617 kB]
        Get:35 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [891 kB]
        Get:36 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [19.2 kB]
        Get:37 http://archive.ubuntu.com/ubuntu focal-security/multiverse i386 Packages [7196 B]
        Get:38 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [23.6 kB]
        Get:39 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [548 B]
        Get:40 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [2267 kB]
        Get:41 http://archive.ubuntu.com/ubuntu focal-security/restricted i386 Packages [33.3 kB]
        Get:42 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [572 B]
        Get:43 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [45.7 kB]
        Get:44 http://archive.ubuntu.com/ubuntu focal-backports/main i386 Packages [36.1 kB]
        Get:45 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [1420 B]
        Get:46 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [25.0 kB]
        Get:47 http://archive.ubuntu.com/ubuntu focal-backports/universe i386 Packages [13.8 kB]
        Get:48 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [880 B]
        Get:49 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
        Get:50 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
        Fetched 31.4 MB in 19s (1648 kB/s)
        Reading package lists...
        Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
        TIMED subp(['udevadm', 'settle']): 0.013
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/dev', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/proc', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/run', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys/firmware/efi/efivars', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'eatmydata', 'apt-get', '--quiet', '--assume-yes', '--option=Dpkg::options::=--force-unsafe-io', '--option=Dpkg::Options::=--force-confold', 'install', 'efibootmgr', 'grub-efi-amd64', 'grub-efi-amd64-signed', 'shim-signed'] with allowed return codes [0] (capture=False)
        Reading package lists...
        Building dependency tree...
        Reading state information...
        Some packages could not be installed. This may mean that you have
        requested an impossible situation or if you are using the unstable
        distribution that some required packages have not yet been created
        or been moved out of Incoming.
        The following information may help to resolve the situation:
        
        The following packages have unmet dependencies:
         grub-efi-amd64 : Conflicts: grub-pc but 2.04-1ubuntu26.17 is to be installed
         grub-pc : Conflicts: grub-efi-amd64
                   Conflicts: grub-efi-amd64:i386
        E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
        Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
        TIMED subp(['udevadm', 'settle']): 0.011
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/sys'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/run'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--make-private', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['umount', '/tmp/tmppcbx5_mt/target/dev'] with allowed return codes [0] (capture=False)
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: Installing packages on target system: ['efibootmgr', 'grub-efi-amd64', 'grub-efi-amd64-signed', 'shim-signed']
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: FAIL: installing missing packages
        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 1707, in builtin_curthooks
            install_missing_packages(cfg, target, osfamily=osfamily)
          File "/curtin/curtin/commands/curthooks.py", line 1318, in install_missing_packages
            distro.install_packages(to_add, target=target, osfamily=osfamily)
          File "/curtin/curtin/distro.py", line 424, in install_packages
            return install_cmd('install', args=pkglist, opts=opts, target=target,
          File "/curtin/curtin/distro.py", line 304, in run_apt_command
            cmd_rv = inchroot.subp(cmd, env=env)
          File "/curtin/curtin/util.py", line 787, in subp
            return subp(*args, **kwargs)
          File "/curtin/curtin/util.py", line 275, in subp
            return _subp(*args, **kwargs)
          File "/curtin/curtin/util.py", line 139, in _subp
            raise ProcessExecutionError(stdout=out, stderr=err,
        curtin.util.ProcessExecutionError: Unexpected error while running command.
        Command: ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'eatmydata', 'apt-get', '--quiet', '--assume-yes', '--option=Dpkg::options::=--force-unsafe-io', '--option=Dpkg::Options::=--force-confold', 'install', 'efibootmgr', 'grub-efi-amd64', 'grub-efi-amd64-signed', 'shim-signed']
        Exit code: 100
        Reason: -
        Stdout: ''
        Stderr: ''
        Unexpected error while running command.
        Command: ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmppcbx5_mt/target', 'eatmydata', 'apt-get', '--quiet', '--assume-yes', '--option=Dpkg::options::=--force-unsafe-io', '--option=Dpkg::Options::=--force-confold', 'install', 'efibootmgr', 'grub-efi-amd64', 'grub-efi-amd64-signed', 'shim-signed']
        Exit code: 100
        Reason: -
        Stdout: ''
        Stderr: ''
        
Stderr: ''

Since it occurs after stage-partitioning and staging-network, I couldn’t figure out a way to resolve these apt pkg conflicts.

Appreciate any help or pointer. Thanks!

1 Like

I’ve been getting a similar issue since Wednesday when trying to deploy custom images from packer with base 22.04, I think since grub2 released a new version which introduced this dependency problem. We didn’t change our maas setup at all but deployments started failing suddenly. I don’t know how to pin grub to a specific version in these curtin scripts. Attached is the relevant logs:

start: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: installing missing packages
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpx3l598zq/target', 'dpkg-query', '--list'] with allowed return codes [0] (capture=True)
Curtin config dependencies requires additional packages: ['e2fsprogs']
Running command ['dpkg', '--print-architecture'] with allowed return codes [0] (capture=True)
Running command ['apt-cache', 'pkgnames'] with allowed return codes [0] (capture=True)
Running command ['apt-cache', 'pkgnames'] with allowed return codes [0] (capture=True)
Skipping install of {'vlan', 'ifenslave', 'bridge-utils', 'grub-efi-amd64'}.  Not needed on netplan system.
start: cmd-install/stage-curthooks/builtin/cmd-curthooks: Installing packages on target system: ['grub-efi-amd64']
Running command ['mount', '--bind', '/dev', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/proc', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/run', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys/firmware/efi/efivars', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpx3l598zq/target', 'apt-get', '--quiet', '--option=Acquire::Languages=none', '--option=Dir::Etc::sourcelist=/tmp/tmpijf91v3u/sources.list', '--option=Dir::Etc::sourceparts=/tmp/tmpijf91v3u/sources.list.d', 'update'] with allowed return codes [0] (capture=False)
Running in chroot, ignoring command 'start'
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [856 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [11.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [36.5 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-security/multiverse amd64 c-n-f Metadata [260 B]
Get:9 http://archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [953 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-security/restricted amd64 c-n-f Metadata [532 B]
Get:11 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [788 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [16.7 kB]
Fetched 3000 kB in 3s (1116 kB/s)
Reading package lists...
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.023
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/dev', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/proc', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/run', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys/firmware/efi/efivars', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpx3l598zq/target', 'eatmydata', 'apt-get', '--quiet', '--assume-yes', '--option=Dpkg::options::=--force-unsafe-io', '--option=Dpkg::Options::=--force-confold', 'install', 'grub-efi-amd64'] with allowed return codes [0] (capture=False)
Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  grub-efi-amd64-bin grub-efi-amd64-signed
The following packages will be REMOVED:
  grub-gfxpayload-lists grub-pc
The following NEW packages will be installed:
  grub-efi-amd64
The following packages will be upgraded:
  grub-efi-amd64-bin grub-efi-amd64-signed
2 upgraded, 1 newly installed, 2 to remove and 6 not upgraded.
Need to get 3028 kB of archives.
After this operation, 422 kB disk space will be freed.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64-signed amd64 1.187.6+2.06-2ubuntu14.4 [1389 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64-bin amd64 2.06-2ubuntu14.4 [1592 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64 amd64 2.06-2ubuntu14.4 [47.1 kB]
Preconfiguring packages ...
Fetched 3028 kB in 0s (44.9 MB/s)
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device)
(Reading database ... 40435 files and directories currently installed.)
Preparing to unpack .../grub-efi-amd64-signed_1.187.6+2.06-2ubuntu14.4_amd64.deb ...
Unpacking grub-efi-amd64-signed (1.187.6+2.06-2ubuntu14.4) over (1.187.4~22.04.1+2.06-2ubuntu14.2) ...
Preparing to unpack .../grub-efi-amd64-bin_2.06-2ubuntu14.4_amd64.deb ...
Unpacking grub-efi-amd64-bin (2.06-2ubuntu14.4) over (2.06-2ubuntu14.2) ...
(Reading database ... 40435 files and directories currently installed.)
Removing grub-gfxpayload-lists (0.7) ...
dpkg: grub-pc: dependency problems, but removing anyway as you requested:
 grub-efi-amd64-signed depends on grub-efi-amd64 | grub-pc; however:
  Package grub-efi-amd64 is not installed.
  Package grub-pc is to be removed.

Removing grub-pc (2.06-2ubuntu7.2) ...
Selecting previously unselected package grub-efi-amd64.
(Reading database ... 40413 files and directories currently installed.)
Preparing to unpack .../grub-efi-amd64_2.06-2ubuntu14.4_amd64.deb ...
Unpacking grub-efi-amd64 (2.06-2ubuntu14.4) ...
Setting up grub-efi-amd64-bin (2.06-2ubuntu14.4) ...
Setting up grub-efi-amd64 (2.06-2ubuntu14.4) ...
mount: /var/lib/grub/esp: special device /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part15 does not exist.
Failed: grub-install --target=x86_64-efi  --no-nvram
WARNING: Bootloader is not properly installed, system may not be bootable
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
Setting up grub-efi-amd64-signed (1.187.6+2.06-2ubuntu14.4) ...
mount: /var/lib/grub/esp: special device /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part15 does not exist.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 32
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 grub-efi-amd64-signed
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.009
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpx3l598zq/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: Installing packages on target system: ['grub-efi-amd64']
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: FAIL: installing missing packages
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
1 Like

I managed to resolve this by having a customized script on image building:

dpkg-query -f '${binary:Package}\n' -W | grep grub | xargs apt-mark unhold

This allows curtin to do dpkg-reconfigure for all grub- packages while installing.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.