LWN.net Logo

GRUB 2.00 released

GRUB 2.00 released

Posted Jun 29, 2012 7:24 UTC (Fri) by alspnost (guest, #2763)
Parent article: GRUB 2.00 released

I guess it's me, but I still find GRUB2 impossible to use. Gone are the happy days when compiling and installing new kernels was a routine experience, and when editing your GRUB config was a simple task. In my view, GRUB2 is just absurdly over-complex for 99% of all users. But I guess I'm missing something - pointers to a good quality instruction guide are welcome.


(Log in to post comments)

GRUB 2.00 released

Posted Jun 29, 2012 7:51 UTC (Fri) by idupree (subscriber, #71169) [Link]

I know Debian's done crazy things with their GRUB configuration, but my manual GRUB2 installation is dirt simple:

grub.cfg:

#timeout in seconds:
set timeout=3

#default counts menuentries in order from 0, i.e.
#this references "Arch-no-nouveau-pushed".
set default=1

menuentry "Arch-force-nouveau" {
  linux /archboot/vmlinuz-linux cryptdevice=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:files root=/dev/mapper/files gpt nouveau modeset=1 printk.time=1
  initrd /archboot/initramfs-linux.img
}
menuentry "Arch-no-nouveau-pushed" {
  linux /archboot/vmlinuz-linux cryptdevice=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:files root=/dev/mapper/files gpt printk.time=1
  initrd /archboot/initramfs-linux.img
}
menuentry "Arch-lts-fallback-3.0kernel" {
  linux /archboot/vmlinuz-linux-lts cryptdevice=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:files root=/dev/mapper/files gpt nouveau modeset=1 printk.time=1
  initrd /archboot/initramfs-linux-lts-fallback.img
}
menuentry "Rescue iso (sysresccd 2.7.0, kernel rescue64 3.2.x)" {
  loopback loop /systemrescuecd-x86-2.7.0.iso
  linux (loop)/isolinux/rescue64 docache isoloop=systemrescuecd-x86-2.7.0.iso
  initrd (loop)/isolinux/initram.igz
}
menuentry "Arch memtest86+" {
  linux16 /archboot/memtest86+/memtest.bin
}

(context - I have a dedicated bootloader partition. I mount its /archboot onto my Arch Linux /boot partition (using fstab). grub2-install takes care of what happens before this partition [I install grub using SysRescCD]. My distro's initramfs takes care of what happens after.)

GRUB 2.00 released

Posted Jun 29, 2012 8:06 UTC (Fri) by HelloWorld (guest, #56129) [Link]

It should also be mentioned that entries like these can be put in /boot/grub/custom.cfg where they won't be overwritten the next time grub.cfg is regenerated.

GRUB 2.00 released

Posted Jun 29, 2012 15:48 UTC (Fri) by Aliasundercover (subscriber, #69009) [Link]

All the layers get tiresome. A configuration file for a script to write a configuration file which gets interpreted like a script...

Some honor this as the "Unix" way but it feels like pushing on a string to me.

GRUB 2.00 released

Posted Jun 29, 2012 16:54 UTC (Fri) by HelloWorld (guest, #56129) [Link]

If you don't want to use grub-mkconfig, nothing stops you from writing grub.cfg by hand, so what's the problem? I'm not saying everything is perfect with Grub2's configuration handling, it's just that I completely fail to see how Grub1 is any better.

GRUB 2.00 released

Posted Jun 29, 2012 21:08 UTC (Fri) by Aliasundercover (subscriber, #69009) [Link]

Right, then we get back to grub.cfg getting trashed by the automatic tools. Pick your poison, complicated script to generate a script vs. care to backup and fix a less complicated hand written config file every time the automatic stuff gets loose with it.

GRUB 2.00 released

Posted Jun 29, 2012 23:41 UTC (Fri) by HelloWorld (guest, #56129) [Link]

Entries in /boot/grub/custom.cfg won't be overwritten.

GRUB 2.00 released

Posted Jul 8, 2012 16:21 UTC (Sun) by hodoscek (subscriber, #5290) [Link]

What about /etc/grub.d/40_custom file. This is official place to put your stuff that you want to boot. After changing the file just run

grub2-mkconfig -o /boot/grub2/grub.cfg

I use it all the times with Gentoo. But Ubuntu can do it too. So I still compile my own kernels and extend the 40_custom file, similar to grub1 or lilo in the ancient times. Not much changed :-)

Even simpler

Posted Jul 12, 2012 12:35 UTC (Thu) by alex (subscriber, #1355) [Link]

I just have /boot/kernel-stable, /boot/kernel-linus and /boot/kernel-ajb and take care not to update all of them at once. I believe I also have the Gentoo default installed kernel just in case I hose all of my custom kernels but I've never needed to go that far.

Re: Gone are the happy days

Posted Jun 29, 2012 13:17 UTC (Fri) by utoddl (subscriber, #1232) [Link]

I used to try to let all my installed distros share a /boot partition, but I got tired of fixing up grub.conf and/or menu.lst after each update. So for the last several years I've had a dedicated non-distro based "master" boot partition with a hand-installed GRUB, the only purpose of which was to chainload to the various distro specific GRUBs on distro specific boot partitions. This has worked well for years.

Now that GRUB has taken "Grand Unified" to heart and gone all probey on me and no longer wants to install boot code into anything other than the root of a disc, I suppose I'll have to come up with another strategy. Perhaps going back to a common /boot partition for all the distros is the way to go.

How do you, my fellow LWN readers, handle boot partition issues with multiple distros on one box? I'm looking for a strategy that works with rather than against the expectations of the various distros and how they do updates.

Re: Gone are the happy days

Posted Jun 30, 2012 0:31 UTC (Sat) by ralphdegennaro (subscriber, #35718) [Link]

I have a test box that I've done same and would like to do the same. I know it's a corner case to have Fedora, openSuse, Ubuntu, Kubuntu and Mageia on small test partitions. It'd be nice to have that setup work out-of-box tough.

What I could see as still problematic with a shared /boot is if distros have different versions of GRUB. When you do the install, each overwrites the other, right? And updates might create the wrong versioned config too, right? Excuse my ignorance if I'm confused...

I'll probably still end up installing one minimal to its own partition with its GRUB to sda. And then each distro's GRUB to their sda#. Last I looked, some OS's installers (like PC-BSD or other unmentionables) didn't support putting their boot loader not to the MBR. So I'll still need a USB stick to fix the "OS agnostic". Oh well....

Re: Gone are the happy days

Posted Jul 10, 2012 16:04 UTC (Tue) by HelloWorld (guest, #56129) [Link]

Grub2 offers the commands extract_entries_source and extract_legacy_entries_source, which read menu entries from another grub2/grub legacy configuration file. You can place these commands in your custom.cfg (usually /boot/grub{,2}/custom.cfg). I use them to read one distro's boot loader configuration from another one's so that in the end, all entries end up in the same menu. It makes sense to disable the os-prober script in /etc/grub.d when using this approach, otherwise you'll get many redundant entries.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds