Bug 647976

Summary: Augeas does not support GRUB 2 configuration (as used by Ubuntu etc)
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: augeasAssignee: David Lutterkort <lutter>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 16CC: apevec, hbrock, lutter, mbooth, rrakus, slukasik, tbzatek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-04 21:12:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
GRUB 2 /boot/grub/grub.cfg from Ubuntu 10.10 none

Description Richard W.M. Jones 2010-10-30 07:53:34 UTC
Created attachment 456606 [details]
GRUB 2 /boot/grub/grub.cfg from Ubuntu 10.10

Description of problem:

There is no way to parse the GRUB 2 configuration used in
operating systems like Ubuntu.  Augeas lists nothing under
//files/boot and nothing relevant under //files/etc.

The GRUB 2 configuration format is slightly crazy though.
I have attached one from Ubuntu 10.10.

Version-Release number of selected component (if applicable):

augeas-0.7.3-1.fc14.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Run augtool on Ubuntu 10.10.
2. Look for configuration in //files/boot and //files/etc
3.
  
Actual results:

No configuration found.

Expected results:

We really should be able to parse GRUB 2 configuration,
particularly for virtualization.

Additional info:

Comment 1 David Lutterkort 2011-01-12 20:18:42 UTC
Sigh; when will people learn that a script is a horrible config file ?

I am not even sure how what's in the file would be presented in the tree; maybe look for the 'menuentry' stanzas ? I'd suspect that they can contain random scripts, too, though.

What would make a useful tree for your purposes ?

Comment 2 Richard W.M. Jones 2011-01-12 20:43:18 UTC
I'm trying to remember what I needed to parse grub configuration
for.  I think it was so I could find out which kernel is installed
/ booted.  In fact we removed that capability when we rewrote
virt-inspector.

I think we can leave this one for now.

Comment 3 Roman Rakus 2011-11-28 15:16:51 UTC
I will welcome a list of linux kernels in menu (menuentry) and associated arguments.

Comment 4 Roman Rakus 2011-11-28 15:23:11 UTC
Especially changing arguments. However if the grub2 is using scripting, it's...

Comment 5 Matthew Booth 2011-11-28 17:39:34 UTC
For anybody coming to this, this file is generated automatically. It comes with a warning at the top not to edit the file, as it is automatically generated. Its format is undocumented as far as I can determine, but appears to contain a mixture of scripting features and directives. The only reliable way to write a parser for it will be to RTFS, and then we may want to be selective about which parts we parse.

From what I can determine from a brief look, the most interesting user-editable configuration is in /etc/default/grub, which is a shellvars format file. Menu entries for individual kernels are generated by globbing /boot for linux kernels, and using the values from /etc/default/grub. There doesn't appear to be a sane way to add or remove an individual kernel.

That means that Roman's list of linux kernels is best determined by an equivalent glob (i.e. not by augeas). Kernel arguments are best read from /etc/default/grub. However, to get functionality equivalent to the grub lens, we'll want to explicitly parse GRUB_CMDLINE_LINUX.

<wtf>
But seriously, a set of scripts which generate another script, which is the actual config? That's up there with the simplicity of sendmail. You might as well just provide the user with a C compiler and call the program their custom config (Wait... UW IMAP actually did that. Stop! That wasn't a serious suggestion!).

This increase in theoretical flexibility has lead to a decrease in practical flexibility. We might do better long term to fix grub2 instead.
</wtf>

Comment 6 David Lutterkort 2013-01-04 21:12:40 UTC
Closing as can't fix; grub2 config appears to be completely uneditable