← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2009746] Re: dpkg-reconfigure cloud-init: yaml.load errors during MAAS deloyment of Ubuntu 23.04(Lunar)

 

** Changed in: cloud-init
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/2009746

Title:
  dpkg-reconfigure cloud-init: yaml.load errors during MAAS deloyment of
  Ubuntu 23.04(Lunar)

Status in cloud-init:
  Fix Released
Status in MAAS:
  Invalid
Status in maas package in Ubuntu:
  Invalid

Bug description:
  Affects  cloud-init 23.1.1 Lunar

  MAAS deployed Ubuntu 23.04 (Lunar) machines invoke `dpkg-reconfigure
  cloud-init`  which results in an exit 1 with the following traceback
  as seen in curtin logs:


  
  Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpwr8y_4f8/target', 'dpkg-reconfigure', '--frontend=noninteractive', 'cloud-init'] with allowed return codes [0] (capture=True)
  finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/writing-apt-config: FAIL: configuring apt configuring apt
  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 1692, in builtin_curthooks
      do_apt_config(cfg, target)
    File "/curtin/curtin/commands/curthooks.py", line 97, in do_apt_config
      apt_config.handle_apt(apt_cfg, target)
    File "/curtin/curtin/commands/apt_config.py", line 73, in handle_apt
      apply_debconf_selections(cfg, target)
    File "/curtin/curtin/commands/apt_config.py", line 167, in apply_debconf_selections
      dpkg_reconfigure(need_reconfig, target=target)
    File "/curtin/curtin/commands/apt_config.py", line 133, in dpkg_reconfigure
      util.subp(['dpkg-reconfigure', '--frontend=noninteractive'] +
    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/tmpwr8y_4f8/target', 'dpkg-reconfigure', '--frontend=noninteractive', 'cloud-init']
  Exit code: 1
  Reason: -
  Stdout: ''
  Stderr: Traceback (most recent call last):
            File "<string>", line 23, in <module>
          TypeError: load() missing 1 required positional argument: 'Loader'
          

  
  Ubuntu 23.04 Lunar has published PyYAML 6.0.1[1] which finally changed the signature on yaml.load to require a Loader= parameter.

  
  This traceback is due to a stale call to yaml.load() in cloud-init.postinst[2] that should have migrated to yaml.safe_load.

  In Jammy and and earlier, PyYAML was still emitting deprecation
  warning messages to stderr, but those warnings are silenced
  automatically by any invocation to `dpkg-reconfigure
  --frontend=noninteractive cloud-init`. So none of the warnings showed
  up in curtin or MAAS, until we got an explicit non-zero exit code.

  References:
  [1] Pyyaml 6.0.1 commit sync'd to lunar https://git.launchpad.net/ubuntu/+source/pyyaml/commit/?id=5308dbefbe5dc7ce4a19adbfdb4c4e08a798217d
  [2] yaml.load failure on Lunar: https://github.com/canonical/cloud-init/blob/ubuntu/devel/debian/cloud-init.postinst#L41

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/2009746/+subscriptions



References