[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [help-a-newb] setting grub



On Wed, Apr 6, 2011 at 10:56 AM, Joel Rees <joel.rees@gmail.com> wrote:
> On Sun, Mar 20, 2011 at 12:09 AM, Dom <toyer@rpdom.net> wrote:
>> On 19/03/11 13:29, Joel Rees wrote:
>>>
>>> I'm having the devil of a time trying to figure out how to set the
>>> default boot and how to chain in grub 2 in squeeze.
>>>
>>> I found something about using update grub and setting the default boot
>>> in a fle in /usr/share/grub, followed by doing an update-grub, but
>>> that doesn't change the default boot,
>>
>> You can change the default in file /etc/default/grub. Edit the
>> GRUB_DEFAULT= line to the entry number you want (starting with 0 for the
>> first entry in the grub menu.
>>
>> Then run update-grub.



> I think I got stuck for a while on update-grub being in /usr/sbin. Or
> was it grub-update ?

It's "/usr/sbin/update-grub".



>> I don't use chain loading, so am not sure how to do that. I think grub2
>> should automatically detect other OSen, is os-prober is installed, when
>> update-grub is run. I'm sure someone else here can advise you.
>
> Well, apparently, it doesn't find the other OSses until you do the
> /usr/sbin/grub-update . That's one problem. The other problem is that
> I don't want Debian to be the default right now. Maybe later.

Because update-grub runs "/etc/grub.d/30_os-prober" which runs os-prober.



> Another problem is the fragile linkage. If Debian ends up with more
> than two entries there, or if, for some reason I delete the rescue
> mode entry, having the third entry as the default suddenly is not what
> I want.
>
> With chainloading each system can maintain its own grub, and Debian's
> kernel install scripts don't need to know for Fedora's kernels.
>
> That doesn't completely solve things. That is, if Debian ever thinks
> it has to make a third entry, and the third entry was the default,
> what was default is no longer.

grub1's update-grub had the same fragile linkage - although I vaguely
remember an option to update the default entry but I could be
imagining things/thinking of something else.

I can think of two options (short of switching to LILO as has been
suggested in the past here).

1. Set "GRUB_DEFAULT=saved" in "/etc/default/grub" and run
"grub-set-default <n>"; update-grub". You will then always boot by
default with the last kernel with which you booted.

It isn't really what you're looking for but it could be good enough.

2. Set "GRUB_DEFAULT=0" in "/etc/default/grub", create
"/etc/grub.d/09_first-kernel", and run update-grub, where:

$ cat /boot/grub.d/09_first-kernel
#!/bin/sh
cat << EOF
menuentry "first kernel" {
set and insmod prelims
set root=...
search ...
linux ...
initrd ...
}
EOF

But you'll have to maintain this file manually.


Reply to: