Bug#783532: grub-rescue-pc: The grub.cfg is oversimplified

Samuel Bronson naesten at gmail.com
Mon Apr 27 19:04:07 UTC 2015


Package: grub-rescue-pc
Version: 2.02~beta2-22
Severity: important

Dear Maintainer,

This is the grub.cfg from /usr/lib/grub-rescue/grub-rescue-cdrom.iso:

,----[ grub.cfg ]
| #
| # Sample GRUB configuration file
| #
| 
| # Boot automatically after 30 secs.
| set timeout=30
| 
| # By default, boot the GNU/Linux
| set default=gnulinux
| 
| # Fallback to GNU/Hurd.
| set fallback=gnuhurd
| 
| # For booting GNU/Linux
| menuentry "GNU/Linux" --id gnulinux {
| 	set root=(hd0,msdos1)
| 	linux /vmlinuz root=/dev/sda1
| 	initrd /initrd.img
| }
| 
| # For booting GNU/Hurd
| menuentry "GNU (aka GNU/Hurd)" --id gnuhurd {
| 	set root=(hd0,msdos1)
| 	multiboot /boot/gnumach.gz root=device:hd0s1
| 	module /hurd/ext2fs.static ext2fs --readonly \
| 			--multiboot-command-line='${kernel-command-line}' \
| 			--host-priv-port='${host-port}' \
| 			--device-master-port='${device-port}' \
| 			--exec-server-task='${exec-task}' -T typed '${root}' \
| 			'$(task-create)' '$(task-resume)'
| 	module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
| }
| 
| # For booting FreeBSD
| menuentry "FreeBSD (or GNU/kFreeBSD), direct boot" {
| 	set root=(hd0,msdos1,bsd1)
| 	kfreebsd /boot/kernel/kernel
| 	kfreebsd_loadenv /boot/device.hints
| 	kfreebsd_module /boot/splash.bmp type=splash_image_data
| 	set kFreeBSD.vfs.root.mountfrom=ufs:ad0s1a
| }
| 
| menuentry "FreeBSD (or GNU/kFreeBSD), via /boot/loader" {
| 	set root=(hd0,msdos1,bsd1)
| 	kfreebsd /boot/loader
| }
| 
| # For booting NetBSD
| menuentry "NetBSD" {
| 	set root=(hd0,netbsd1)
| 	knetbsd /netbsd
| }
| 
| # For booting OpenBSD
| menuentry "OpenBSD" {
| 	set root=(hd0,openbsd1)
| 	kopenbsd /bsd
| }
| 
| # For booting Microsoft Windows
| menuentry "Microsoft Windows" {
| 	set root=(hd0,msdos1)
| 	chainloader +1
| }
| 
| # For booting Memtest86+
| menuentry "Memtest86+" {
| 	set root=(hd0,1)
| 	linux16 /memtest86+.bin
| }
| 
| # Change the colors.
| menuentry "Change the colors" {
| 	set menu_color_normal=light-green/brown
| 	set menu_color_highlight=red/blue
| }
`----

Problems I'm having with this:

1. All of the entries hardcode the first partition of the first drive
   as the rootfs, and some even hardcode a partition table format.

2. It doesn't load the "lvm" module, which evidently isn't autoloaded
   as needed like many of the others are, and it's not exactly obvious
   that "insmod lvm" is what's needed to get LVM working.

3. It would be nice if it did "set pager=1" so that stuff like "ls
   $prefix/i386-pc" wouldn't overflow the screen, which would make it
   easier to figure out stuff like "insmod lvm".

4. The timeout seems uncalled for; it's better to let users take their
   time in a rescue scenario.

5. It *almost* seems like you should bundle memtest86+ into the rescue
   image, if it wouldn't run the risk of extra binNMUs just to update
   that.  (Is it strange that I was surprised, when checking the
   changelog just now, to find that memtest86+ had been touched in the
   last year?)

I suppose there's not much to be done about #1 besides making it clear
that the menu items are just examples and will only work on the
simplest of systems, though:

While "search --file" might be enough to find the kernel/initrd on
systems without a separate /boot FS (thanks to the vmlinuz/initrd.img
symlinks on the root fs), we would still need to be able to tell the
kernel and/or initrd where to find the rootfs, which is tricky enough
*without* being restricted to grub's scripting language...

... except I just noticed the "probe" command, which lets us put the
UUID or LABEL for the discovered root filesystem into a variable, so
maybe it *is* possible to make this actually boot Debian GNU/Linux boxes
without split /boot automatically.

P.S. Thankfully, it *did* help me rescue the other machine, though
maybe I should have just grabbed a netinst image ...

-- Package-specific info:

[Most of this stuff redacted because I'm reporting this from the
machine I burned the rescue medium on, not the one I used it on.]

*********************** BEGIN /proc/mdstat
cat: /proc/mdstat: No such file or directory
*********************** END /proc/mdstat

-- System Information:
Debian Release: 8.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

-- no debconf information



More information about the Pkg-grub-devel mailing list