[Techtalk] Grub2 entry for booting into shell
Miriam English
mim at miriam-english.org
Sun Feb 14 15:01:30 UTC 2016
Hi Gwen, I'm not completely sure what you want to do, so what I write
below might be completely off the mark. Do you want, on boot-up to be
presented with a normal grub menu with choices of operating systems to
boot into, and with one of the menu items the choice to boot into a
non-graphical bash shell version of linux?
I use Puppy Linux on most of my computers because it is small, fast,
easy to use, and lets you boot off a CD with the option of installing to
hard drive. It has a very easy-to-use legacy grub and grub4Dos installer
and gives you the opportunity to hand edit the menu.lst file that it
auto-generates.
But if I'm right that you want to boot into a bash shell then I think
the grub menu might be the wrong place to be looking. Perhaps you should
be looking at the .xinitrc file in the home directory of the partition
you want to boot into the shell.
If I understand what you want then I would add another very small
partition and install a minimal linux on it (Puppy is about 100MB,
DamnSmallLinux is even smaller) and either let the grub installer
auto-build the boot menu to include it in the menu list or else
carefully add it by hand. This is another really good thing about Puppy
-- if you screw up the boot menu you can just boot off the CD and edit
the menu, rinse, repeat, as many times as needed.
If the minimal Linux install is a graphical Linux like Puppy then you'll
need to hand edit the /root/.xinitrc file to stop it starting up the X
server. If you install DamnSmallLinux I don't think it uses X anyway so
you wouldn't need to edit anything in that case.
I hope this helps. And sorry if I completely misunderstood your
question, which I have a feeling I may have. :)
- Miriam
Gwen Morse wrote:
> 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.
>
--
As artists, it would be a hell of a lot easier if our audiences were
more tolerant of our penchant for boring them.
- Cory Doctorow
More information about the Techtalk
mailing list