[Techtalk] Grub2 entry for booting into shell
Gwen Morse
gwen.morse at gmail.com
Wed Feb 10 11:49:32 UTC 2016
I'd like to create a GRUB2 menu option to allow me to boot into the shell
from the GRUB menu. I don't want to have to type 'e' and set it to 3
manually each time I want to do this. I would like grub to find the correct
name of my kernel files when it generates grub.cfg.
I copied the windows file and named it "11_linux_shell" in /etc/grub.d
This is what I have:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type
the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Gentoo Linux Kernel Shell (no X11)" --class gentoo --class
gnu-linux --class gnu --class os {
set gfxpayload="keep"
set root='hd0,msdos2'
echo 'Load Linux genkernel ...'
linux /boot/kernel-${GENKERNEL_ARCH}-${version}-gentoo
root=/dev/sda2 ro rootfstype=${_rootfstype} ${_kernel_params} 3
echo 'Load initial ramdisk ...'
initrd /boot/initramfs-genkernel-${GENKERNEL_ARCH}-${version}-gentoo
}
It's copying to /boot/grub/grub.conf exactly as I write it above, instead
of finding the correct values for each variable. But I'm not sure what I'm
supposed to do. I don't usually write my own shell scripts and I don't know
how to script it to force the substitution.
--
Program designers have a tendency to think of the users as idiots who need
to be controlled. They should rather think of their program as a servant,
whose master, the user, should be able to control it. If designers and
programmers think about the apparent mental qualities that their programs
will have, they'll create programs that are easier and pleasanter — more
humane — to deal with. -- John McCarthy
More information about the Techtalk
mailing list