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

Re: Is grub perfect? (was Re: Does LXDE really require lightdm?)



On Sun 29 Jun 2014 at 11:33:29 +1000, Zenaan Harkness wrote:

> On 6/28/14, Brian <ad44@cityscape.co.uk> wrote:
> > On Fri 27 Jun 2014 at 23:14:26 -0400, slitt wrote:
> 
> >> that's simple: Boot the damn computer with a menu to choose predefined
> >> kernel/initrd/disk combinations, and nothing else. And for gosh sakes,
> >> keep it in one file. If a config option is about "pretty", leave that
> >> feature out.
> >
> > The simplest possible grub.cfg would contain
> >
> >    menuentry "DescriptiveMenuItem {
> >    linux (hd0,msdos1)/vmlinuz root=/dev/sda1
> >    initrd (hd0,msdos1)/initrd.gz
> >    }
> >
> > This assumes a machine with a single disk and the root file system
> > (essentially where /sbin/init resides) on the first partition of the
> > same disk.
> >
> > There we are, a predefined kernel/initrd/disk combination. Four lines in
> > a single file. Problem solved.
> >
> > "No it's not!" will be the cry, "update-grub will overwite my grub.cfg."
> > Correct; so use dpkg-divert on /usr/sbin/update-grub and those nasty,
> > prettifying files in /etc/default/grub and /etc/grub.d will languish
> > unused. The problem is now well and truly solved.
> 
> That was _awesome_!
> 
> Thank you so much Brian!

Thank you, but I'm embarassed now because the diverting wasn't explained.

  dpkg-divert --rename --add /usr/sbin/update-grub
  ln -s /bin/true /usr/sbin/update-grub

The first command ensures any new file version is put on your machine.
The second one does nothing, which is what is wanted if grub.cfg is to
remain unalterd when, for example, there is a new kernel installed.

The idea is courtesy of Colin Watson, Debian, Ubuntu and GRUB developer.

I often use a very minimal grub.cfg on USB sticks which move between
machines and then the stanza above is better as

    menuentry "DescriptiveMenuItem {
    search --label --set=root <LABEL>		[or use UUID]
    linux /vmlinuz root=/dev/sda1
    initrd /initrd.gz
    }

"search" determines the grub device ((hd0,msdos1), say) and puts it
before /vmlinuz and /initrd, making the two stanzas equivalent. The
second is obviously more reliable because it removes the guesswork.


Reply to: