Bug 1246094

Summary: rescue kernel should not generate when GRUB_DISABLE_RECOVERY="true"
Product: Red Hat Enterprise Linux 7 Reporter: Tereza Cerna <tcerna>
Component: grubbyAssignee: Peter Jones <pjones>
Status: CLOSED NOTABUG QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dracut-maint-list, harald, jskarvad, lmiksik, ovasik, pholica, pjones
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-17 14:19:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1223864, 1233004    

Description Tereza Cerna 2015-07-23 12:49:03 UTC
Rescue kernel should not generate when GRUB_DISABLE_RECOVERY="true" in /etc/default/grub. If the variable GRUB_DISABLE_RECOVERY is deleted, it works well.

Packages:
grub2-2.02-0.22.el7.x86_64
tuned-2.5.0-1.el7.noarch

Comment 4 Tereza Cerna 2015-09-11 11:50:24 UTC
My problem is connected with testing of tuned. If GRUB_DISABLE_RECOVERY is set to "true", rescue kernel generates $tuned_params and it is bug.
 
See the problem:

# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="console=tty0 vconsole.keymap=us console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT:+$GRUB_CMDLINE_LINUX_DEFAULT }\$tuned_params"

# grub2-mkconfig -o /boot/grub2/grub

# cat /boot/grub2/grub.cfg | grep vmlinuz
	linux16 /vmlinuz-3.10.0-306.0.1.el7.x86_64 root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
	linux16 /vmlinuz-3.10.0-302.el7.x86_64 root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
	linux16 /vmlinuz-3.10.0-295.el7.x86_64 root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
	linux16 /vmlinuz-0-rescue-d20fb34accd74a158e40457bf1d641bf root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params   

Problem is in last row with rescue kernel which contains string "$tuned_params".

Comment 5 David Cantrell 2015-09-14 18:35:50 UTC
This does not meet the criteria for a RHEL 7.2 blocker.  Moving this one to the 7.3 planning list.

At first glance, it appears there is confusion between grub's "recovery" entries, our own debug kernel boot entries, and the "rescue" boot loader entry created by dracut.  In order to figure out what the problem is, we need to see some more information from the problem system:

1) Sample grub.cfg files both before and after the files are updated.
2) What you expect to see in grub.cfg and what is there.
3) The contents of /etc/default/grub
4) The contents of /etc/sysconfig/kernel

Remember that the "recovery" boot menu entries are controlled by the GRUB_DISABLE_RECOVERY.  The GRUB_CMDLINE_LINUX_DEFAULT variable are the list of supplementary boot parameters to pass to the kernel.

Comment 6 Jaroslav Škarvada 2015-09-15 08:54:16 UTC
(In reply to David Cantrell from comment #5)
Isn't possible to unify it? My understanding is that parameters from GRUB_CMDLINE_LINUX are added to all kernels and GRUB_CMDLINE_LINUX_DEFAULT only to non rescue kernels. Seeing GRUB_CMDLINE_LINUX_DEFAULT parameters added to images with -rescue- in name seems a bit confusing to me.

Comment 7 Peter Jones 2015-09-15 14:56:41 UTC
See /usr/lib/dracut/dracut.conf.d/02-rescue.conf from dracut-config-rescue for details here - the anaconda team does not own this code; it's part of dracut.

Comment 8 Harald Hoyer 2015-09-15 17:49:04 UTC
$ rpm -qf /usr/lib/dracut/dracut.conf.d/02-rescue.conf
dracut-config-rescue-043-60.git20150811.fc24.x86_64

Just uninstall "dracut-config-rescue".

$ rpm -qfl /usr/lib/dracut/dracut.conf.d/02-rescue.conf
/etc/kernel/postinst.d/51-dracut-rescue-postinst.sh
/usr/lib/dracut/dracut.conf.d/02-rescue.conf
/usr/lib/kernel/install.d/51-dracut-rescue.install

/etc/kernel/postinst.d/51-dracut-rescue-postinst.sh:
[…]
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
[…]

It uses grubby to install the rescue initramfs entry. Not sure if that is to blame here.

Comment 9 Harald Hoyer 2015-09-15 17:50:59 UTC
(In reply to Tereza Cerna from comment #4)
> My problem is connected with testing of tuned. If GRUB_DISABLE_RECOVERY is
> set to "true", rescue kernel generates $tuned_params and it is bug.
>  
> See the problem:
> 
> # cat /etc/default/grub 
> GRUB_TIMEOUT=5
> GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
> GRUB_DEFAULT=saved
> GRUB_DISABLE_SUBMENU=true
> GRUB_TERMINAL_OUTPUT="console"
> GRUB_CMDLINE_LINUX="console=tty0 vconsole.keymap=us console=ttyS0,115200
> rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto
> vconsole.font=latarcyrheb-sun16 rhgb quiet"
> GRUB_DISABLE_RECOVERY="true"
> GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT:
> +$GRUB_CMDLINE_LINUX_DEFAULT }\$tuned_params"
> 
> # grub2-mkconfig -o /boot/grub2/grub
> 
> # cat /boot/grub2/grub.cfg | grep vmlinuz
> 	linux16 /vmlinuz-3.10.0-306.0.1.el7.x86_64
> root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us
> console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01
> rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto 
> vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
> 	linux16 /vmlinuz-3.10.0-302.el7.x86_64 root=/dev/mapper/VolGroup00-LogVol00
> ro console=tty0 vconsole.keymap=us console=ttyS0,115200
> rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto
> vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
> 	linux16 /vmlinuz-3.10.0-295.el7.x86_64 root=/dev/mapper/VolGroup00-LogVol00
> ro console=tty0 vconsole.keymap=us console=ttyS0,115200
> rd.lvm.lv=VolGroup00/LogVol01 rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto
> vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params
> 	linux16 /vmlinuz-0-rescue-d20fb34accd74a158e40457bf1d641bf
> root=/dev/mapper/VolGroup00-LogVol00 ro console=tty0 vconsole.keymap=us
> console=ttyS0,115200 rd.lvm.lv=VolGroup00/LogVol01
> rd.lvm.lv=VolGroup00/LogVol00 crashkernel=auto 
> vconsole.font=latarcyrheb-sun16 rhgb quiet $tuned_params   
> 
> Problem is in last row with rescue kernel which contains string
> "$tuned_params".


And no... dracut does not add "$tuned_params" here... that would be new-kernel-pkg/grubby.

Assigning back to grubby.

Comment 10 Jaroslav Škarvada 2015-09-16 07:59:50 UTC
This is probably not grubby. It happens when grub2-mkconfig is executed, thus there must be problem in some grub template.

The problem is that the content of GRUB_CMDLINE_LINUX_DEFAULT environment variable is added to the rescue kernels, which I think shouldn't.

Comment 11 Jaroslav Škarvada 2015-09-16 08:11:45 UTC
Reproducer:

echo 'GRUB_DISABLE_RECOVERY="true"' >> /etc/default/grub
echo 'GRUB_CMDLINE_LINUX_DEFAULT="isolcpus=1"' >> /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg

grep rescue /boot/grub2/grub.cfg

Current result:
vmlinuz rescue images with 'isolcpus=1'

Expected result:
a) No rescue images because of GRUB_DISABLE_RECOVERY="true"
b) 'isolcpus=1' not added to rescue images

Comment 12 Peter Jones 2015-09-17 14:19:03 UTC
(In reply to Jaroslav Škarvada from comment #11)
> Reproducer:
> 
> echo 'GRUB_DISABLE_RECOVERY="true"' >> /etc/default/grub
> echo 'GRUB_CMDLINE_LINUX_DEFAULT="isolcpus=1"' >> /etc/default/grub
> 
> grub2-mkconfig -o /boot/grub2/grub.cfg
> 
> grep rescue /boot/grub2/grub.cfg
> 
> Current result:
> vmlinuz rescue images with 'isolcpus=1'
> 
> Expected result:
> a) No rescue images because of GRUB_DISABLE_RECOVERY="true"
> b) 'isolcpus=1' not added to rescue images

You are getting this parameter because when dracut makes its rescue image, it copies parameters from the default.  But your "expected result" #1 is simply a bad expectation.  If you don't want dracut's rescue images, you need to not install dracut-config-rescue .