Skip to content

Duplicate GRUB_CMDLINE entries if no kernel_parameter bootmode is specified #71

Open
@jamesps-ebi

Description

@jamesps-ebi

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet-Server: 6.26.0
  • Puppet-Agent: 6.28.0
  • Distribution: Ubuntu 20.04.4
  • Module version: 3.2.0

How to reproduce (e.g Puppet code you use)

Using a puppet lookup with either 'deep', or 'hash' merge type (as below)

class profile::hiera::kernel_parameters {
  # Lookup for kernel_parameter resources
  lookup( 'kernel_parameters', Hash[String, Any], 'deep', {} ).each |String $name, Any $options| {
    # Set kernel_parameter resources
    ensure_resource( 'kernel_parameter', $name, $options )
  }
}

Specifying a kernel parameter in hiera without a specific 'bootmode' given, and also specifying some other kernel parameters elsewhere in the hiera hierarchy.

global.yaml - lowest priority

# Configure kernel parameters at boottime
kernel_parameters:
# disable ipv6 by default on every machine
  ipv6.disable:
    ensure: present
    value: '1'

node.yaml - highest priority

kernel_parameters:
  # quiet splash
  quiet:
    ensure: present
    bootmode: default
  splash:
    ensure: present
    bootmode: default

What are you seeing

The above can result in the kernel parameter (ipv6.disable) being duplicated between the GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX sections of /etc/default/grub file, similar to #38

# grep CMDLINE /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

What behaviour did you expect instead

Kernel parameters should only appear in one of either GRUB_CMDLINE_LINUX_DEFAULT or GRUB_CMDLINE_LINUX, but not both.

Explicitly specifying a bootmode will cause the kernel parameter to only appear in one of the two GRUB_CMDLINE* sections as expected.

Output log

Any additional information you'd like to impart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions