Bug 744717 - Removing old kernel cleans up too much of grub.cfg (GRUB2)
Removing old kernel cleans up too much of grub.cfg (GRUB2)
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: grubby (Show other bugs)
16
x86_64 Linux
unspecified Severity urgent
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-10 06:03 EDT by Vedran Miletić
Modified: 2012-04-06 04:13 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-06 04:13:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
grub.cfg before (7.89 KB, text/plain)
2011-10-24 12:16 EDT, Vedran Miletić
no flags Details
grub.cfg after (6.72 KB, text/plain)
2011-10-24 12:16 EDT, Vedran Miletić
no flags Details
grub.cfg before (no Xen) (3.01 KB, text/plain)
2011-10-24 17:31 EDT, Vedran Miletić
no flags Details
grub.cfg after (no Xen) (1.28 KB, text/plain)
2011-10-24 17:34 EDT, Vedran Miletić
no flags Details
grub.cfg with 3 kernels (3.30 KB, text/plain)
2011-10-26 16:12 EDT, Vedran Miletić
no flags Details
grub.cfg after removing one kernel (2.02 KB, text/plain)
2011-10-26 16:13 EDT, Vedran Miletić
no flags Details
grub.cfg after removing two kernels (1.31 KB, text/plain)
2011-10-26 16:13 EDT, Vedran Miletić
no flags Details
use dummy entries for text following kernel entries so it is preserved (3.36 KB, patch)
2011-10-27 09:23 EDT, Mads Kiilerich
no flags Details | Diff

  None (edit)
Description Vedran Miletić 2011-10-10 06:03:28 EDT
After removing .rc8 kernel, I'm left with:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora (3.1.0-0.rc9.git0.0.fc16.x86_64)' --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd1,msdos1)'
	search --no-floppy --fs-uuid --set=root 37525b59-2458-4117-82ac-b3f5e70b20dc
	echo 'Loading Fedora (3.1.0-0.rc9.git0.0.fc16.x86_64)'
	linux	/vmlinuz-3.1.0-0.rc9.git0.0.fc16.x86_64 root=UUID=a846cda4-53e5-46f7-a4a6-6294def2f423 ro quiet rhgb SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=croat
	echo 'Loading initial ramdisk ...'
	initrd /initramfs-3.1.0-0.rc9.git0.0.fc16.x86_64.img
}

i.e. everything after that is stripped. While I personally don't care too much about it since everything works OK without, it is probably a bug so I'm reporting it here.
Comment 1 Mads Kiilerich 2011-10-24 11:53:00 EDT
That must have been done by grubby.

Did you see any error messages when removing the kernel?

Can you reproduce the problem and show how grub.cfg looked before?
Comment 2 Vedran Miletić 2011-10-24 12:15:16 EDT
Yes, I can reproduce it every time. There are no error messages on the console.

I will attach the files.
Comment 3 Vedran Miletić 2011-10-24 12:16:03 EDT
Created attachment 529920 [details]
grub.cfg before
Comment 4 Vedran Miletić 2011-10-24 12:16:36 EDT
Created attachment 529921 [details]
grub.cfg after
Comment 5 Vedran Miletić 2011-10-24 12:17:25 EDT
Also, it's not Xen related. On another machine without Xen installed it strips all the content after the kernel entry.
Comment 6 Mads Kiilerich 2011-10-24 12:51:26 EDT
I assume these configs were before and after removing 3.1.0-0.rc9.git0.0.fc16.x86_64. Grubby apparently assumed that the removed entry included the start of the submenu that followed it and it thus created a config file with invalid syntax. That might be a different bug.

Can you show similar config files for a non-Xen machine?
Comment 7 Vedran Miletić 2011-10-24 17:31:28 EDT
Created attachment 529970 [details]
grub.cfg before (no Xen)

This is how it would look without Xen before
Comment 8 Vedran Miletić 2011-10-24 17:34:35 EDT
Created attachment 529971 [details]
grub.cfg after (no Xen)

This is how it would look without Xen after

Whether it's Linux entries (generated by grub2-mkconfig) or Fedora entries doesn't change anything.

These files are not real (they are modified versions of files I posted previously) since I didn't back up grub.cfg files on machine without Xen where I had this issue. But this is really how they looked.
Comment 9 Mads Kiilerich 2011-10-24 19:38:01 EDT
(In reply to comment #6)
> I assume these configs were before and after removing
> 3.1.0-0.rc9.git0.0.fc16.x86_64. Grubby apparently assumed that the removed
> entry included the start of the submenu that followed it and it thus created a
> config file with invalid syntax. That might be a different bug.

This is now tracked on Bug 748551.


(In reply to comment #7)
> Created attachment 529970 [details]
> grub.cfg before (no Xen)
> 
> This is how it would look without Xen before

Thanks, but I haven't been able to reproduce any problem with grubby on this grub.cfg. Can you reproduce the problem?
Comment 10 Vedran Miletić 2011-10-26 16:11:59 EDT
Yes, it still happens. I will attach the files.
Comment 11 Vedran Miletić 2011-10-26 16:12:52 EDT
Created attachment 530376 [details]
grub.cfg with 3 kernels
Comment 12 Vedran Miletić 2011-10-26 16:13:18 EDT
Created attachment 530377 [details]
grub.cfg after removing one kernel
Comment 13 Vedran Miletić 2011-10-26 16:13:44 EDT
Created attachment 530378 [details]
grub.cfg after removing two kernels
Comment 14 Vedran Miletić 2011-10-26 16:15:36 EDT
By the way, why don't the scripts just re-run

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

after each kernel installation/removal? It does the job just fine.
Comment 15 Mads Kiilerich 2011-10-27 07:29:53 EDT
(In reply to comment #11)
> Created attachment 530376 [details]
> grub.cfg with 3 kernels

Ok, this first grub.cfg is bogus. Do you have any idea how the custom.cfg handling ended up inside the kernel entries?

(In reply to comment #14)
> By the way, why don't the scripts just re-run
> 
> # grub2-mkconfig -o /boot/grub2/grub.cfg
> 
> after each kernel installation/removal? It does the job just fine.

Yes, that would be a different of doing it. The Fedora way of doing it is however to use grubby no matter which boot loader is used.
Comment 16 Mads Kiilerich 2011-10-27 09:23:16 EDT
Created attachment 530483 [details]
use dummy entries for text following kernel entries so it is preserved

Now I don't understand how it was possible for me to _not_ reproduce the issue ;-)

It is not related to the malformed kernel entry.
Comment 17 Vedran Miletić 2011-11-01 18:55:03 EDT
Hi, does this mean this bug is fixed? Please get this into final release of Fedora 16 if anyhow possible.
Comment 18 Mads Kiilerich 2011-11-01 19:02:54 EDT
No, it is waiting for the package maintainer to pick it up.
Comment 19 Vedran Miletić 2011-12-10 15:15:14 EST
Hi Adam, I saw you pushed an update to grubby on Koji. This is probably still na issue in F17 and certainly in F16. Could you please take a look if this patch is acceptable?
Comment 20 Adam Williamson 2011-12-12 16:21:17 EST
I'm not really qualified to review the patch, I'm just pushing out work that I know is acceptable to F16. I'm happy to do the work of integrating the patch into grubby and pushing an update, but I'd prefer it if pjones would take a look and ack or nack it first.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 21 Brian Lane 2011-12-12 17:34:00 EST
This patch looks good to me.
Comment 22 Adam Williamson 2011-12-12 18:00:41 EST
I've committed it to grubby 'upstream', I'll wait on the other currently proposed change (https://bugzilla.redhat.com/show_bug.cgi?id=742720 ) before cutting a new grubby release and pushing it to rawhide.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 23 Vedran Miletić 2012-04-06 04:13:11 EDT
This seems to work now.

Note You need to log in before you can comment on or make changes to this bug.