https://www.puppet.com/community logo
Join Slack
Powered by
# puppet
  • o

    Olmo

    03/21/2023, 4:56 PM
    message has been deleted
  • v

    vchepkov

    03/21/2023, 5:35 PM
    I need to make sure that kernel devel is installed for the working kernel This doesn't work
    Copy code
    package { 'kernel-devel':
      ensure => $facts['kernelrelease'],
    }
  • v

    vchepkov

    03/21/2023, 5:36 PM
    Because one can have several packages installed
    Copy code
    # puppet resource package kernel-devel
    package { 'kernel-devel':
      ensure   => '4.18.0-425.10.1.el8_7; 4.18.0-425.13.1.el8_7; 4.18.0-425.3.1.el8',
      provider => 'dnf',
    }
  • v

    vchepkov

    03/21/2023, 5:36 PM
    Can I express it via package resource or have to use an Exec ?
  • b

    Brian Schonecker

    03/21/2023, 5:41 PM
    Are you trying to install the kernel-devel package JUST for the currently running kernel or for all installed kernel RPMs?
    Debug: Facter: Loading external facts
    Debug: Facter: fact "operatingsystemmajrelease" has resolved to: 8
    Debug: Executing: '/bin/dnf -d 0 -e 1 -y install kernel-devel-4.18.0-425.10.1.el8_7.x86_64'
  • b

    Brian Schonecker

    03/21/2023, 5:41 PM
    Your first example worked for me.
  • b

    Brian Schonecker

    03/21/2023, 5:47 PM
    Are you trying to install the kernel-devel package JUST for the currently running kernel or for all installed kernel RPMs?
    Debug: Facter: Loading external facts
    Debug: Facter: fact "operatingsystemmajrelease" has resolved to: 8
    Debug: Executing: '/bin/dnf -d 0 -e 1 -y install kernel-devel-4.18.0-425.10.1.el8_7.x86_64'
  • v

    vchepkov

    03/21/2023, 5:47 PM
    it only works if no kernel-devel installed before
  • v

    vchepkov

    03/21/2023, 5:48 PM
    Copy code
    Error: Could not update: Failed to update to version 4.18.0-425.13.1.el8_7.x86_64, got version 4.18.0-425.3.1.el8; 4.18.0-425.10.1.el8_7; 4.18.0-425.13.1.el8_7 instead
  • b

    Brian Schonecker

    03/21/2023, 5:48 PM
    Define, "installed before", please. I have zero kernel-devel packages on my system at this time and your puppet code installs only one kernel-devel package which is appropriate to the running kernel
  • b

    Brian Schonecker

    03/21/2023, 5:48 PM
    Do you have a limit on the kernel in /etc/yum.conf?
  • v

    vchepkov

    03/21/2023, 5:48 PM
    You can have multiple kernel-devel packages installed
  • b

    Brian Schonecker

    03/21/2023, 5:49 PM
    max_kernels or something like that.
  • v

    vchepkov

    03/21/2023, 5:49 PM
    with different versions
  • b

    Brian Schonecker

    03/21/2023, 5:49 PM
    I mean /etc/dnf.conf.
  • b

    Brian Schonecker

    03/21/2023, 5:49 PM
    Sorry, I'm an old dog...still using yum.
  • v

    vchepkov

    03/21/2023, 5:49 PM
    I don't think it's related and it will be the same problem with yum
  • v

    vchepkov

    03/21/2023, 5:50 PM
    do this on you system
    Copy code
    puppet resource package kernel
  • v

    vchepkov

    03/21/2023, 5:51 PM
    you probably have more then one
  • b

    Brian Schonecker

    03/21/2023, 5:51 PM
    installonly_limit is the parameter I was (incorrectly) referring to.
  • v

    vchepkov

    03/21/2023, 5:52 PM
    that instruction to package provider as for how many versions to keep
  • v

    vchepkov

    03/21/2023, 5:52 PM
    it seems to me that package resource is not handling multiple versions of the same package
  • b

    Brian Schonecker

    03/21/2023, 5:53 PM
    Maybe try changing the value to four and re-run your puppet manifest?
  • v

    vchepkov

    03/21/2023, 5:53 PM
    It doesn't influence puppet
  • v

    vchepkov

    03/21/2023, 5:54 PM
    As I said, you can easily reproduce it, try to install another kernel-devel with a different version from the one you just installed
  • v

    vchepkov

    03/21/2023, 6:03 PM
    I wonder what that last option represent in the manual https://www.puppet.com/docs/puppet/7/types/package.html#package-attribute-ensure
  • v

    vchepkov

    03/21/2023, 6:03 PM
    Copy code
    /./
  • v

    vchepkov

    03/21/2023, 6:03 PM
    A regex? I tried, doesn't seem to work either
  • b

    Brian Schonecker

    03/21/2023, 6:37 PM
    message has been deleted
  • b

    Brian Schonecker

    03/21/2023, 6:42 PM
    @vchepkov, the behavior is the same if you use 'gpg-pubkey' instead of kernel-devel. The rpm command that dnf uses to report the current version of kernel-devel might be something to look at.
    Debug: Executing: '/bin/dnf -d 0 -e 1 -y downgrade kernel-devel-4.18.0-425.10.1.el8_7.x86_64'
    Debug: Executing: '/bin/rpm -q kernel-devel --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
    Error: Could not update: Failed to update to version 4.18.0-425.10.1.el8_7.x86_64, got version 4.18.0-425.13.1.el8_7; 4.18.0-425.3.1.el8; 4.18.0-372.26.1.el8_6 instead
    Error: /Stage[main]/Main/Package[kernel-devel]/ensure: change from '4.18.0-372.26.1.el8_6; 4.18.0-425.13.1.el8_7; 4.18.0-425.3.1.el8' to '4.18.0-425.10.1.el8_7.x86_64' failed: Could not update: Failed to update to version 4.18.0-425.10.1.el8_7.x86_64, got version 4.18.0-425.13.1.el8_7; 4.18.0-425.3.1.el8; 4.18.0-372.26.1.el8_6 instead
    [root@nfiv-cis-02d nfiiseed]# /bin/rpm -q kernel-devel --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}'
    kernel-devel 0 4.18.0 425.13.1.el8_7 x86_64kernel-devel 0 4.18.0 425.3.1.el8 x86_64kernel-devel 0 4.18.0 372.26.1.el8_6 x86_64[root@nfiv-cis-02d nfiiseed]#
1...333334335...428Latest