NVIDIA / yum-packaging-nvidia-kmod-common

NVIDIA kernel module common files packaging for RHEL
Apache License 2.0
4 stars 6 forks source link

nvidia-kmod-common is wiping out custom blacklist in /etc/default/grub #3

Open jnm27 opened 1 year ago

jnm27 commented 1 year ago

We have ahci blacklisted in /etc/default/grub. But when we install nvidia-kmod-common, it wipes out that change.

https://github.com/NVIDIA/yum-packaging-nvidia-kmod-common/blob/main/nvidia-kmod-common.spec#L13

By default this is our command line:

GRUB_CMDLINE_LINUX="blacklist=nouveau,ahci rd.driver.blacklist=nouveau,ahci initcall_blacklist=efifb_driver_init crashkernel=256M rd.lvm.lv=rootvg/rootlv rd.lvm.lv=rootvg/swaplv rd.lvm.lv=rootvg/usrlv biosdevname=0 net.ifnames=1 audit=1 audit_backlog_limit=8192 rhgb quiet"

This is what happens when we install:

D: %post(nvidia-kmod-common-3:525.78.01-1.el8.noarch): scriptlet start
D: %post(nvidia-kmod-common-3:525.78.01-1.el8.noarch): execv(/bin/sh) pid 47301
D: Plugin: calling hook scriptlet_fork_post in selinux plugin
+ type -p grubby
/sbin/grubby
+ grubby --help
+ checkGrubby=0
+ '[' 0 -eq 0 ']'
+ /usr/sbin/grubby --update-kernel=ALL --args=rd.driver.blacklist=nouveau '--remove-args=nomodeset gfxpayload=vga=normal nouveau.modeset=0 nvidia-drm.modeset=1'
+ '[' '!' -f /run/ostree-booted ']'
+ '[' -f /etc/default/grub ']'
+ . /etc/default/grub
++ GRUB_TIMEOUT=5
+++ sed 's, release .*$,,g' /etc/system-release
++ GRUB_DISTRIBUTOR='Red Hat Enterprise Linux'
++ GRUB_DEFAULT=saved
++ GRUB_DISABLE_SUBMENU=true
++ GRUB_TERMINAL_OUTPUT=console
++ GRUB_CMDLINE_LINUX='blacklist=nouveau,ahci initcall_blacklist=efifb_driver_init crashkernel=256M rd.lvm.lv=rootvg/rootlv rd.lvm.lv=rootvg/swaplv rd.lvm.lv=rootvg/usrlv biosdevname=0 net.ifnames=1 audit=1 audit_backlog_limit=8192 rhgb quiet rd.driver.blacklist=nouveau'
++ GRUB_DISABLE_RECOVERY=true
++ GRUB_ENABLE_BLSCFG=true
kmittman commented 1 year ago

Hmm, I had thought we had solved this with #1 (merged as https://github.com/NVIDIA/yum-packaging-nvidia-kmod-common/commit/896d3dce59b4c09be31558ae3fee115fecf8891e) by first sourcing the existing GRUB config.

Actually, I wonder if this is due to the lack of double-quotes, which was added in #2 (merged in 530 as https://github.com/NVIDIA/yum-packaging-nvidia-kmod-common/commit/e7941a2c729ce0ffaf9a3236a7005e3f4f48b321).

@jnm27 could you please check if this reproduces with 530 driver packages?

Also might be helpful if you could post cat /proc/cmdline from reboot after installation, to see if it is preserving the previous config partially or not at all.

jnm27 commented 1 year ago

yeah, we actually can't reboot after this happens, because we need the ahci blacklist in order to boot. The cmdline in the output above does get set.

I don't think #2 would fix it because the code in that commit only applies if GRUB_CMDLINE_LINUX doesn't already exist in /etc/default/grub

jnm27 commented 1 year ago

I'd say do something like, get the existing blacklist param, and if nouveau is already in the param, don't do anything, else append ,nouveau to it.

jnm27 commented 1 year ago

It might be nice to have an option to not modify grub at all, for users that know that nouveau needs to be blacklisted and already have that in their config.

jnm27 commented 1 year ago

It's actually the grubby --args which is overwriting it, after which point it's too late to check the existing GRUB_CMDLINE_LINUX, because it would be overwritten already

jnm27 commented 1 year ago

To workaround this, I'm just going to overwrite checkGrubby=1 in the spec file to skip the check.

scaronni-nvidia commented 2 months ago

This is being overhauled for a newer release of the drivers like the following: