[Bug 2065299] Re: Find redhat kernel version command gives invalid output when multiple versions are installed

Anton Troyanov 2065299 at bugs.launchpad.net
Fri May 10 14:35:32 UTC 2024


** Also affects: curtin
   Importance: Undecided
       Status: New

** Changed in: maas
       Status: New => Triaged

** Changed in: maas
   Importance: Undecided => Medium

** Changed in: maas
    Milestone: None => 3.6.0

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to curtin.
https://bugs.launchpad.net/bugs/2065299

Title:
  Find redhat kernel version command gives invalid output when multiple
  versions are installed

Status in curtin:
  New
Status in MAAS:
  Triaged

Bug description:
  When building Rocky 9 images for MAAS, if you update the kernel in the
  source image and don't clean up the previous kernel version, the "rpm
  -q --queryformat "%{VERSION}-%{RELEASE}.%{ARCH}" kernel" command
  returns an invalid string like this:

  # rpm -q --queryformat "%{VERSION}-%{RELEASE}.%{ARCH}" kernel
  5.14.0-162.6.1.el9_1.x86_645.14.0-362.24.1.el9_3.0.1.x86_64

  
  This causes the subsequent initramfs command to fail, resulting in a failed OS deployment:

  finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/updating-initramfs-configuration: FAIL: updating initramfs configuration
  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 1918, in curthooks
      builtin_curthooks(cfg, target, state)
    File "/curtin/curtin/commands/curthooks.py", line 1863, in builtin_curthooks
      redhat_update_initramfs(target, cfg)
    File "/curtin/curtin/commands/curthooks.py", line 1696, in redhat_update_initramfs
      in_chroot.subp(dracut_cmd, capture=True)
    File "/curtin/curtin/util.py", line 792, in subp
      return subp(*args, **kwargs)
    File "/curtin/curtin/util.py", line 280, in subp
      return _subp(*args, **kwargs)
    File "/curtin/curtin/util.py", line 144, in _subp
      raise ProcessExecutionError(stdout=out, stderr=err,
  curtin.util.ProcessExecutionError: Unexpected error while running command.
  Command: ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpms1dg_tc/target', 'dracut', '-f', '/boot/initramfs-5.14.0-162.23.1.el9_1.x86_645.14.0-362.24.1.el9_3.0.1.x86_64.img', '5.14.0-162.23.1.el9_1.x86_645.14.0-362.24.1.el9_3.0.1.x86_64']
  Exit code: 1
  Reason: -
  Stdout: /etc/dracut.conf.d/50-curtin-storage.conf:add_dracutmodules+=" lvm"
          
  Stderr: 
          dracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!
          dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.
          
          dracut: Cannot find module directory /lib/modules/5.14.0-162.23.1.el9_1.x86_645.14.0-362.24.1.el9_3.0.1.x86_64/
          dracut: and --no-kernel was not specified
          
  Unexpected error while running command.


  The command should be altered to something that returns only the latest installed kernel version.
  For example:

  # ls -t /lib/modules | head -1
  5.14.0-362.24.1.el9_3.0.1.x86_64

To manage notifications about this bug go to:
https://bugs.launchpad.net/curtin/+bug/2065299/+subscriptions




More information about the foundations-bugs mailing list