Bug 840079 - grubby can't handle multiple statements separated with ';' in grub2 grub.cfg
grubby can't handle multiple statements separated with ';' in grub2 grub.cfg
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: grubby (Show other bugs)
17
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-13 11:54 EDT by Henrik Johansson
Modified: 2013-08-01 04:58 EDT (History)
5 users (show)

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


Attachments (Terms of Use)
/etc/grub.d/40_custom (763 bytes, text/plain)
2012-07-13 11:55 EDT, Henrik Johansson
no flags Details
The unbootable and bootable /boot/grub2/grub.cfg (1.83 KB, text/plain)
2012-07-13 12:03 EDT, Henrik Johansson
no flags Details
Two grub.cfg-files (1.83 KB, application/x-compressed-tar)
2012-07-13 12:05 EDT, Henrik Johansson
no flags Details
Two new grub.cfg-files, generated and edited (1.35 KB, application/x-compressed-tar)
2012-07-24 16:33 EDT, Henrik Johansson
no flags Details
This grub.cfg was built when kernel-3.4.6-2.fc17.x86_64 was installed (4.46 KB, text/plain)
2012-07-25 15:17 EDT, Henrik Johansson
no flags Details
Manually edited grub.cfg, after install of kernel-3.4.6-2.fc17.x86_64 (4.38 KB, text/plain)
2012-07-25 15:18 EDT, Henrik Johansson
no flags Details
grub.cfg built by 'grub2-mkconfig -o /boot/grub2/grub.cfg' (9.72 KB, text/plain)
2012-07-26 15:32 EDT, Henrik Johansson
no flags Details
A log from my terminal window, at update of grub config (2.66 KB, text/plain)
2012-07-27 10:49 EDT, Henrik Johansson
no flags Details
Updated /etc/grub.d/40_custom (754 bytes, text/plain)
2012-07-31 13:28 EDT, Henrik Johansson
no flags Details

  None (edit)
Description Henrik Johansson 2012-07-13 11:54:21 EDT
Description of problem:
The system didn't boot after an upgrade (Software Updater)
kernel-3.4.4-5.fc17.x86_64 and grub2-tools-2.0-0.37.beta6.fc17.x86_64, was part of the update.

# uname -a
Linux xxxxxxxx 3.4.4-3.fc17.x86_64 #1 SMP Tue Jun 26 20:54:56 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
# rpm -qa | egrep kernel
kernel-devel-3.4.4-5.fc17.x86_64
kernel-headers-3.4.4-5.fc17.x86_64
abrt-addon-kerneloops-2.0.10-4.fc17.x86_64
kernel-devel-3.4.2-1.fc16.x86_64
kernel-3.4.4-3.fc17.x86_64
kernel-devel-3.4.4-3.fc17.x86_64
kernel-3.4.2-1.fc16.x86_64
libreport-plugin-kerneloops-2.0.10-3.fc17.x86_64
kernel-3.4.4-5.fc17.x86_64
# rpm -qa | egrep grub
grub2-tools-2.0-0.37.beta6.fc17.x86_64
grubby-8.12-1.fc17.x86_64
grub2-2.0-0.37.beta6.fc17.x86_64




How reproducible:
Twice

Steps to Reproduce:
1.Start the computer
2.
3.
  
Actual results:
Problem with grub-config, tried a network-boot.

Expected results:
Boot from local disk.

Additional info:
Found an extremely large boot-entry in /boot/grub2/grub.cfg, 40_custom, one row with more than 100000 chars.
The beginning of the row:
  set root='(hd1,3)';setlegacy_hdbias='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'=
The source-row, from /etc/grub.d/40_custom:
  set root='(hd1,3)'; set legacy_hdbias='0'

After a truncate of the long line, grub seemed OK.

Next problem:
The new kernel-3.4.4-5.fc17.x86_64, didn't boot.
Booted the previous kernel-3.4.4-3.fc17.x86_64.
Comment 1 Henrik Johansson 2012-07-13 11:55:55 EDT
Created attachment 598102 [details]
/etc/grub.d/40_custom
Comment 2 Henrik Johansson 2012-07-13 12:03:16 EDT
Created attachment 598107 [details]
The unbootable and bootable /boot/grub2/grub.cfg

Adding both the unbottable grub.cfg and the manually corrected.
Comment 3 Henrik Johansson 2012-07-13 12:05:43 EDT
Created attachment 598109 [details]
Two grub.cfg-files

The unbootable and the manually corrected /boot/grub2/grub.cfg.
Comment 4 Henrik Johansson 2012-07-24 16:33:10 EDT
Created attachment 600169 [details]
Two new grub.cfg-files, generated and edited
Comment 5 Henrik Johansson 2012-07-24 16:33:37 EDT
Removed the unbootable kernel-3.4.4-5.fc17.x86_64 and kernel-devel-3.4.4-5.fc17.x86_64, 'rpm --erase'.
Updated with 'Software Update' today, a new kernel (kernel-3.4.6-2.fc17.x86_64) was installed and a new grub.cfg was built.
The new grub.cfg had som extra characters at the end of 'set root'-row in the boot-entry from /etc/grub.d/40_custom. I edited grub.cfg before reboot, difference between the grub.cfg built by kernel install (grub.cfg.20120724) and the manually updated (grub.cfg):
[root@xxxxxxxx tmp]# diff grub.cfg grub.cfg.20120724 
104c104
<   set root='(hd1,3)';setlegacy_hdbias='0'
---
>   set root='(hd1,3)';setlegacy_hdbias='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'='0'

The kernel booted OK and SLED11 was also OK.

Adding an attachment with the new grub.cfg-files.
Comment 6 Henrik Johansson 2012-07-24 16:46:40 EDT
Found an old boot-entry in grub.cfg, the kernel is not installed:
menuentry 'Fedora (3.3.7-1.fc16.x86_64)' --class fedora --class gnu-linux --class gnu --class os {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root 7ac39dc2-383a-45dc-8516-9938939e3a11
        echo 'Loading Fedora (3.3.7-1.fc16.x86_64)'
        linux   /vmlinuz-3.3.7-1.fc16.x86_64 root=/dev/mapper/vg_uw000140-lv_root ro rd.md=0 rd.dm=0  KEYTABLE=sv-latin1 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=vg_uw000140/lv_swap rd.luks=0 rd.lvm.lv=vg_uw000140/lv_root LANG=en_US.UTF-8
        echo 'Loading initial ramdisk ...'
        initrd /initramfs-3.3.7-1.fc16.x86_64.img
}

Removed the old boot-entry, from grub.cfg.
Comment 7 Mads Kiilerich 2012-07-24 17:16:53 EDT
(Please upload files individually as text/plain - that is much easier to read and search than having to download archives.)

What do 'generated' in comment 4 mean?

Anyway: grubby can apparently not handle that you have two statements on one line. Try to put them on separate lines and see if that helps.
Comment 8 Henrik Johansson 2012-07-25 15:17:11 EDT
Created attachment 600384 [details]
This grub.cfg was built when kernel-3.4.6-2.fc17.x86_64 was installed
Comment 9 Henrik Johansson 2012-07-25 15:18:42 EDT
Created attachment 600385 [details]
Manually edited grub.cfg, after install of kernel-3.4.6-2.fc17.x86_64
Comment 10 Henrik Johansson 2012-07-25 15:48:26 EDT
I uploaded the latest files again (separate).

With generated I mean, built by kernel-install.

Does the kernel-install run grubby?
Are the existing grub.cfg used as one input to the new grub.cfg?
I separated the two statements in 40_custom.
I don't know how to test, the new 40_custom.
I tested 'grub2-mkconfig -o /tmp/test.cfg', but that generated warnings and a grub.cfg with lots of differences.
The warnings:
/usr/sbin/grub2-probe: warning: the device.map entry `hd0,1' is invalid. Ignoring it. Please correct or delete your device.map.
The file /boot/grub2/device.map:
# this device map was generated by anaconda
(hd0)      /dev/sda
(hd1)      /dev/sdb
(hd2)      /dev/sdc
(hd0,1)      /dev/sda1
[henrik@uw000140 ~]$
Comment 11 Mads Kiilerich 2012-07-25 15:52:54 EDT
(In reply to comment #10)
> Does the kernel-install run grubby?

yes

> Are the existing grub.cfg used as one input to the new grub.cfg?

for grubby, yes

> I separated the two statements in 40_custom.
> I don't know how to test, the new 40_custom.

You could edit the section in grub.cfg and verify that installing a new kernel doesn't mangle it.

> I tested 'grub2-mkconfig -o /tmp/test.cfg', but that generated warnings and
> a grub.cfg with lots of differences.

That is however the right and only way to generate a new grub.cfg.

> The warnings:
> /usr/sbin/grub2-probe: warning: the device.map entry `hd0,1' is invalid.
> Ignoring it. Please correct or delete your device.map.
> The file /boot/grub2/device.map:
> # this device map was generated by anaconda
> (hd0)      /dev/sda
> (hd1)      /dev/sdb
> (hd2)      /dev/sdc
> (hd0,1)      /dev/sda1

As it says: your device.map is invalid. That should however not matter for recent grubs - they will ignore it and issue a warning. Just remove it.
Comment 12 Henrik Johansson 2012-07-26 15:32:45 EDT
Created attachment 600590 [details]
grub.cfg built by 'grub2-mkconfig -o /boot/grub2/grub.cfg'

Renamed /boot/grub2/device.map before building new grub.cfg, grub2-mkconfig didn't create a new device.map.

Grub reports some error and displays three menu-entries:
- Fedora
- Advanced options for Fedora
- SUSE Linux Enterprise Desktop 11 - 2.6.27.39-0.3
It's only the SUSE-entry that is OKtouch any key to. The Fedora-entry reports some errors and ends with 'touch any key to continue...', the latest Fedora-kernel boots OK. 
The Advanced entry displays six Fedora-entries, only tested the first, it ends with 'touch any key to continue...', that entry doesn't boot.

Has changed to the previous grub.cfg.
Comment 13 Mads Kiilerich 2012-07-26 16:07:31 EDT
(In reply to comment #12)
> Grub reports some error and displays three menu-entries:
...
> The Fedora-entry reports some errors and ends with 'touch any key to continue...'

I guess that is because you haven't run 'grub2-install /dev/sda' with the grub version you have now (beta6?)? You thus have a config file that use some new features that your "old" installed bootloader don't know.
Comment 14 Henrik Johansson 2012-07-26 17:32:23 EDT
I didn't know that I should use grub2-install.
Anything more I should do, are there a HowTo for this?

When are device.map needed?
Comment 15 Mads Kiilerich 2012-07-26 19:02:46 EDT
See /usr/share/doc/grub2-tools-2.0/README.Fedora and https://fedoraproject.org/wiki/GRUB_2 (where I just added some extra info).

You most other users don't need device.map.
Comment 16 Henrik Johansson 2012-07-27 10:49:44 EDT
Created attachment 600801 [details]
A log from my terminal window, at update of grub config

The saved entry was 'Fedora Linux, with Linux 3.3.1-3.fc16.x86_64', the same kernel-version that I removed from grub.cfg. 
In grub.cfg it was the last Fedora-entry and not the default.

I've updated the grub config, as written in https://fedoraproject.org/wiki/GRUB_2.

I've tested the new config (bbot), several times, grub writes an error message before the menu is written, maybe about a file. I'm too slow reader.

I'tested four of the entries, all OK.
Comment 17 Mads Kiilerich 2012-07-27 11:14:28 EDT
(In reply to comment #16)
> The saved entry was 'Fedora Linux, with Linux 3.3.1-3.fc16.x86_64', the same
> kernel-version that I removed from grub.cfg. 
> In grub.cfg it was the last Fedora-entry and not the default.

I'm not sure what you are telling here - but it doesn't seem to be related to the issue reported on this issue.

> I've updated the grub config, as written in
> https://fedoraproject.org/wiki/GRUB_2.

Note that some parts of that page is wrong/outdated. I added a disclaimer.

> I've tested the new config (bbot), several times, grub writes an error
> message before the menu is written, maybe about a file. I'm too slow reader.

Bug 817187.
Comment 18 Henrik Johansson 2012-07-29 15:16:27 EDT
(In reply to comment #17)
> (In reply to comment #16)
> > The saved entry was 'Fedora Linux, with Linux 3.3.1-3.fc16.x86_64', the same
> > kernel-version that I removed from grub.cfg. 
> > In grub.cfg it was the last Fedora-entry and not the default.
> 
> I'm not sure what you are telling here - but it doesn't seem to be related
> to the issue reported on this issue.
This seems to be a problem, at a previous kernel-upgrade.
The references to a removed kernel, wasn't removed from /boot/grub2/grub.cfg and from the variable for the default 'menuentry'.
Comment 19 Mads Kiilerich 2012-07-29 19:09:09 EDT
(In reply to comment #18)

FWIW: I still don't get it. You could try to make a more explicit and self-contained description. But:
1. grubby will probably do all kind of bad things if there is a line it can't handle - including not removing old kernel entries.
2. Other than that, it doesn't seem like it is directly related to the problem you reported here.
Comment 20 Henrik Johansson 2012-07-31 13:28:25 EDT
Created attachment 601552 [details]
Updated /etc/grub.d/40_custom

Followed the suggestion in Comment 28 for Bug 817187.
'cp /boot/grub2/locale/en@quot.mo /boot/grub2/locale/en.mo'.
No error from Grub.

Are there still problems with the contents in /etc/grub.d/40_custom?
Comment 21 Mads Kiilerich 2012-07-31 15:03:13 EDT
(In reply to comment #20)
> Are there still problems with the contents in /etc/grub.d/40_custom?

I don't know. Try it.
Comment 22 Henrik Johansson 2013-04-30 15:26:53 EDT
It's OK to close this ticket.
No new grub.cfg-problems since 2012-07-31.
I'm saving a copy of grub.cfg at every kernel-update, as an insurance.
Upgraded to Fedora 18 2013-03-31.

/Henrik
Comment 23 Fedora End Of Life 2013-07-03 22:38:52 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 24 Fedora End Of Life 2013-08-01 04:58:53 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

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