Bug 212649

Summary: Missing grub-set-default command
Product: Red Hat Enterprise Linux 5 Reporter: Jason Edgecombe <jwedgeco>
Component: grubAssignee: Václav Pavlín <vpavlin>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: aaron.hamid, agentme49, atodorov, bsingh, curtis, horsley1953, jim, jreed, jwest, Marc.Herbert+rhzilla, mishu, mvattakk, rdassen, rrajaram, seandarcy, sergio, ss, vorpal, wnefal+redhatbugzilla
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: grub-0.97-13.8.el5 Doc Type: Bug Fix
Doc Text:
Cause - the documented command was planned but not yet developed when we initially shipped this software, and wound up being implemented in a different way Consequence - the documented behaviour was not what wound up being shipped Fix - update the package documentation to reflect shipped behavior Result - users should be able to read the right documentation now.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 07:40:46 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:
Bug Depends On:    
Bug Blocks: 807973    
Attachments:
Description Flags
Change for the documentation in the package none

Description Jason Edgecombe 2006-10-27 20:39:23 UTC
Description of problem:
Missing grub-set-default command. The info pages refer to it, but it isn't
installed as part of the grub package. This would be very nice to have.

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


How reproducible:
always

Steps to Reproduce:
1. standard install with grub rpm
2. run grub-set-default
3. command not found
  
Actual results:


Expected results:


Additional info:

Comment 1 Curtis Doty 2007-10-05 02:13:27 UTC
The old and outdated --once patch should be put out to pasture for these reasons:

 - as noted above, then documentation would reflect the actual functionality

 - putting this in grub.conf is more self-describing than requiring a manual
grub shell hack

 - one could actually know what entry will be rebooted next by a simple cat
/boot/grub/default whereas with the old --save patch it's hidden inside the
binary stage2

Please toss that old crap out for F9+. Or...if there really are valid
dependencies, at least stop patching out the more modern upstream
savedefault/fallback functionality.

Comment 2 Tom Horsley 2009-03-04 18:15:57 UTC
I've just been trying to setup a nice robust multi-boot system with
fallback in fedora 10, and I see there is still no grub-set-default
command. It would sure be nice if I didn't spend a long time
believing the grub info docs only to discover all that stuff was
patched out (at least that's how I interpret comment #1 above).

Comment 3 jim 2010-03-02 00:24:10 UTC
grub-set-default is used to temporarily set a default for next boot such as the functionality in old LILO.  This command is needed again, it's still present in other linux distros that use Grub such as Fedora, this is not just a "nice to have", it's needed.  For example, it is used to test a grub default for a one-time boot, especially in datacenter environments, if a default does not work, then the old default takes over at the next boot, so a reset can be done, and the system is back to normal.  this is how LILO worked in older distros.

Comment 4 Tom Horsley 2010-03-02 01:01:46 UTC
You can do the equivalent of grub-set-default in the existing fedora grub,
but the documentation in the info files has nothing to do with the
commands grub supports to achieve this.

For instance:

savedefault --stage2=/boot/grub/stage2 --default=2 --once

this will make the default boot be entry #2 just for the next boot.

The "help savedefault" command in grub has all the documentation
I've been able to find on it.

I don't know if fedora 13 will be going to grub2 by default, but if
so, the entire universe will be stood on it's head then, rendering
this issue moot :-).

Comment 5 jim 2010-03-02 02:56:11 UTC
I'm an RHCE, this workaround is no big deal for me, however my contention is that this command is STILL documented in grub's man pages, and is still the accepted practice on other distros, therefore Red Hat should have never had made the decision to remove the command arbitrarily.  Further, the key here is to make linux easier to administer for new administrators and more consistent with the package's providers, as well as more consistent with the accepted documentation via the man pages.  Not to mention that Red Hat contains many scripts and shortcut commands that allow you to accomplish one administrative task with one command, where another distro forces you to run the individual commands (several commands to accomplish an admin task that Red Hat automates with one much easier and time saving command).  The original command with the package needs to be re-included.

Comment 6 sean 2010-05-09 17:39:13 UTC
Does anyone know the correct form for the savedefault command in grub.conf.

savedefault --stage2=/boot/grub/stage2 --default=0

works from the grub cli.

The same command in a grub.conf stanza does NOT work. These also don't work:

savedefault --stage2=/grub/stage2 --default=0
savedefault --stage2=(hd0,0)/grub/stage2 --default=0
savedefault 0
savedefault --default=0

Comment 7 sean 2010-05-09 23:39:16 UTC
With some more messing around, I also found odd behavior with --once

If you at the first stanza (that is, you've booted up in default=0),

savedefault --stage2=/boot/grub/stage2 --default=1 --once

works. That is, the next reboot will take you to the second stanza, the second reboot will go back to the first stanza.

But, if the second stanza has ANY savedefault, even pointing to the first stanza, such as  savedefault 0, the second reboot will not go back to the first stanza, but continue with the second.

I'm dealing with a remote server. Undocumented or poorly documented behavior on controlling the boot loader is quite scary. Especially where it isn't the behavior described in the upstream manual or docs.

Comment 8 Tom Horsley 2010-05-10 00:30:47 UTC
> I'm dealing with a remote server.

I certainly don't know how to get it to work from inside
a grub.conf file, but I have a similar remote server, and
I just have scripts on the default boot system to run grub
manually and do the savedefault, then run reboot, which gets
me to the new system one time, then when I reboot it, I'm back to
the default system again, where I can run my script to feed
commands to grub and boot a different system.

It always takes two reboots to get to the system you really
want running, but it seems to work OK (as long as you aren't
in a big hurry :-).

Comment 9 MarcH 2010-07-08 14:29:06 UTC
Having the boatloader's documentation inconsistent with the actual implementation is a bad and really scary joke. Please patch GRUB in whatever crazy way you like but *only* if you also patch the documentation accordingly and keep the two consistent with each other. Come on, we are talking about bells and whistles here!

Comment 10 MarcH 2010-07-08 14:33:56 UTC
I obviously meant:

> Come on, we are NOT talking about bells and whistles here!    

Sorry for the noise. This is what happens when you mess with how systems boot... not.

Comment 11 Jack Perdue 2010-07-16 16:53:42 UTC
This is still an issue in FC13 and looks to be a definite issue in EL6 (at least the beta) and possibly FC14.  

My hack (once realizing the included documentation was worthless and finding this BR) for now (boot Windows so I can VNC in and reboot back to Linux) is:

#!/bin/sh
let WINBOOT=`grep ^title /boot/grub/grub.conf | grep -n Windows | cut -f 1 -d :`-1
echo Booting $WINBOOT - `grep ^title.\*Windows /boot/grub/grub.conf`
echo "savedefault --stage2=/boot/grub/stage2 --default=$WINBOOT --once" | grub
# EOF

(where I obviously have "Windows" in the title for that entry).

If there is a good reason to remove grub-set-default and not use a /boot/grub/default file, then the documentation (.info) should at least be updated so people don't waste time pursuing methods that have been patched out of the upstream code.

Comment 12 Aaron Hamid 2010-12-12 21:15:04 UTC
I'm an FC14 user and just spent some time searching for this command.  It's probably true that many users will not change their boot settings.  But we are talking about Linux here - many users will indeed do so (as I just have because I have problems with the latest kernel), and while it's simple enough to reboot once to get a default saved, this would have been a nice convenience to have.  It's probably not a good idea to invite people to experiment with custom grub scripts.

Comment 13 Ranjith Rajaram 2011-03-21 13:14:04 UTC
At the grub prompt can you enter the command

savedefault --default=N

Comment 14 MarcH 2011-03-21 14:22:11 UTC
> At the grub prompt can you enter the command...

This does not help when your server is far away from you: the typical "grub-set-default" use case.

If you are in front of the console then you typically do not even bother with "grub-set-default" in the first place; you just use the damn console instead.

Comment 15 Muhammad Riyas vk 2011-03-22 07:05:37 UTC
could this be a workaround to find out next boot? (it works for me at least :)

# xxd /boot/grub/stage2 |grep 0000200 |awk '{print $8}'

Comment 16 Chris Cowan 2011-07-24 03:30:46 UTC
>This does not help when your server is far away from you: the typical
"grub-set-default" use case.

He wasn't very specific - you use the savedefault command with the grub binary from within linux:

# echo "savedefault --default=N --once" | grub --batch

Then only the next boot will be item N; you can just do "reboot" after running the above line.

Comment 20 Sergio Basto 2012-03-21 02:08:27 UTC
 grub2-set-default exist , but if you want boot always the same entry 
you may add 
#cat /etc/default/grub
GRUB_DEFAULT="Windows" (for example my entry to always boot)

see bug #742720 , for the spaces problem .

Comment 21 RHEL Program Management 2012-04-02 09:00:07 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 23 Jack Reed 2012-06-13 06:11:17 UTC
David, as per your Comment 19, which command should be documented as a workaround for the absence of grub-set-default? Comment 4, 16, or another? (Assuming their syntax is broad enough for documentation purposes.) I can't detect any primacy amongst them. 

Or do you mean another command not provided here?

Comment 24 Peter Jones 2012-07-24 15:42:35 UTC
Created attachment 600060 [details]
Change for the documentation in the package

Comment 25 Jack Perdue 2012-07-24 18:35:24 UTC
re: comment #11 + #24... FWIW, thx for the documentation update... at the very least it will make it clearer for people still dealing with this version of grub

Comment 27 Peter Jones 2012-07-25 15:30:55 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause - the documented command was planned but not yet developed when we initially shipped this software, and wound up being implemented in a different way
Consequence - the documented behaviour was not what wound up being shipped
Fix - update the package documentation to reflect shipped behavior
Result - users should be able to read the right documentation now.

Comment 31 Alexander Todorov 2012-10-29 11:14:55 UTC
VERIFIED in grub-0.97-13.10.el5

Comment 33 errata-xmlrpc 2013-01-08 07:40:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0087.html

Comment 34 BugMasta 2016-06-02 06:04:06 UTC
you fucking cunts.

Comment 35 BugMasta 2016-06-02 06:19:15 UTC
Why am i pissed off? Because I'm here, having my time wasted, 10 years after this clusterfuck first reared its ugly head. 10 fucking years.


So this is the answer is it?:
  echo "savedefault --default=N --once" | grub --batch

Well, where is it documented? Why the fuck does this page:
  https://www.gnu.org/software/grub/manual/legacy/Booting-once_002donly.html
STILL refer to grub-set-default, when grub-set-default does not exist?

This bug was raised for el5.

Why the fuck is there still no proper documentation for the grub in el6, 10 years later?