LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Creating a kernel that boots STRAIGHT to command prompt? (https://www.linuxquestions.org/questions/linux-general-1/creating-a-kernel-that-boots-straight-to-command-prompt-214823/)

black hole sun 08-07-2004 07:58 PM

Creating a kernel that boots STRAIGHT to command prompt?
 
I'm running Fedora Core 2-Final and GRUB. I want a "failsafe" kernel that does not start X or any of the other fluff, just one that goes straight to a command prompt. How would I go about doing this?

Bruce Hill 08-07-2004 08:12 PM

Edit the run level in your /etc/inittab file and the kernel doesn't matter. You can for sure
use run level 1 with most any distro.

black hole sun 08-07-2004 08:23 PM

Quote:

Originally posted by Chinaman
Edit the run level in your /etc/inittab file and the kernel doesn't matter. You can for sure
use run level 1 with most any distro.

Thanks but that file applies to all of my kernels, doesn't it? I'd like to have something like old Mandrake 10 had, a failsafe kernel that boots into a command prompt but the others auto-started X. Note that if this isn't possible, I'll live with it :)

Bruce Hill 08-07-2004 08:52 PM

Can you check the Feodra CDs for a directory named kernels, and see if there's
one in there? Otherwise, if you still have the Mandrake CDs, perhaps you could
use the failsafe kernel from there - or at least look at the configuration and make
your own for Fedora. I think you can edit grub and pass an option to the kernel
to boot linux single (user) or something like that. I don't know grub, never could
figure it out, so I use LiLO.

kevinalm 08-07-2004 09:18 PM

It isn't the kernel, it's the arguments passed to the kernel on the append line for lilo or on the kernel line for grub. Iirc it's either "single" or "runlevel=1", something along those lines. Actually, I always kept a rh8 cd #1 around for that purpose. Just booted into rescue. Now I use a customized RIP (Rescue Is Possible) boot cd.

Bruce Hill 08-07-2004 09:43 PM

This is the entry in Mandrake's LiLO for the failsafe kernel:
Code:

image=/boot/vmlinuz
        label="failsafe"
        root=/dev/hdc8
        initrd=/boot/initrd.img
        append="failsafe acpi=ht resume=/dev/hda9 devfs=nomount"
        read-only


kevinalm 08-07-2004 10:13 PM

Ok, looks like mandrake uses "failsafe" as the keyword. Be warned that this is distro specific and highly variable.

Disillusionist 08-08-2004 12:33 PM

As you are using GRUB as your boot manager it's quite easy to do what you want:

Edit the grob config file generally /boot/grub/menu.lst

WARNING THIS COULD BE DANGEROUS

Copy the lines for your standard kernel eg:

Code:

title linux
    kernel (hd0,5)/boot/vmlinuz root=/dev/hda6 vga=0x317 hdd=ise-scsi hddlun=0 splash=silent showopts
    initrd (hd0,5)/boot/initrd

Create a new entry for your special Run Level (add the option init 3) eg:

Code:

title test
    kernel (hd0,5)/boot/vmlinuz root=/dev/hda6 vga=0x317 hdd=ise-scsi hddlun=0 splash=silent showopts init 3
    initrd (hd0,5)/boot/initrd

WARNING THIS COULD BE DANGEROUS

If you have an administrative tool for editing the Boot Configuration I strongly suggest you use it instead of hacking the text file.

Having made the changes above you can choose Testing as the image to load at boot time and it will stop at a login prompt at run level 3 (There are more run levels that 1 - Single User and 5 - Graphical Mode!)

If this all works out you can even make it your default image.

The easy option (assuming you don't want this as your default image, would be to type:

init 3 when given the option of which kernel to load.

bigrigdriver 08-08-2004 12:51 PM

According to the Grub Manual, grub allows one to create a text configuration file which can be referenced in the kernel line of grub.conf (or /grub/menu.lst if that's what you use), specifying any boot options you need. The only requirement is that the text file is referenced AFTER the kernel: something like kernel=/boot/vmlinuz <filename>.
However, the manual does not give any examples of the text file, or how to refer to it in the kernel line.
Using such an option may be just what you need.

After doing a little google research, I find that the command is 'configfile file', where configfile is the command, and file is the name of the file.


All times are GMT -5. The time now is 09:59 AM.