Booting: Knoppix Details


Let's go through the boot process again, this time examining each phase in a bit more detail and exploring some of the cheatcodes that are processed at each level.

Examining the Bootloader Phase

During the bootloader phase, the BIOS loads and runs the isolinux bootloader from the CD-ROM. At the end of the bootloader phase, the Knoppix splash screen displays. If you do not see the Knoppix splash screen, you might want to try out some of these fixes:

  • Check your BIOS to ensure that your system can boot from a CD-ROM.

  • Check the md5sum of the ISO to ensure that it was not corrupted during the download.

  • Make sure that you burn the ISO to the CD as an image and not as a file.

  • Make sure that you burn at a slow speed — less than 8x — to ensure that you get a good burn.

  • Run boot: memtest to check your system's memory.

  • Run boot: knoppix vga=0 testcd to check the CD.

If you've tried all of these options and Knoppix still does not display the splash screen, you may want to look into the Smart Boot Manager (http://btmgr.sourceforge.net/about.html), which automatically locates all bootable floppy, hard, and CD-ROM devices and enables you to boot from them even when the BIOS doesn't recognize them.

If you still have problems booting Knoppix, post a question to the knoppix.net forums (http://www.knoppix.net/forum). Be sure to include the Knoppix version, a brief description of your hardware, and any error messages.

At this stage of the boot process, there isn't much to look at. It pretty much either works or not. However, it is at the boot prompt that you type in cheatcodes that determine how the rest of the boot process progresses.

Examining the Text Phase

The text phase can be broken down into five stages. As Knoppix goes from stage to stage, it probes and configures more and more of your hardware. By pausing at each stage, you can examine what Knoppix has done and change it before moving on to the next stage.

Let's take a more detailed look at the stages in the text phase by using two additional cheatcodes, debug and -b, which tell Knoppix to pause and display a shell prompt at the end of each stage.

Exploring Stage 1

At the boot prompt, enter the following:

 knoppix debug -b 3 

This time, you see a lot more text fly by, and then the screen shown in Figure A-3 is displayed.

image from book
Figure A-3: Knoppix stopping at the end of the stage 1 boot process

This stage is very important because it tells you a lot, including the following:

  • Your machine can boot from the CD-ROM.

  • The default Linux kernel works with your machine.

  • Video mode is working.

At this stage, Knoppix is running a very stripped-down version of the ash shell. There's not a whole lot you can do except run the built-in ash commands and the few available external binaries. For example, you cannot type ls to get a listing of the files; there is no ls. Instead, use echo * or echo /proc/* to see a listing of files in the current directory or /proc, respectively. You can also do some simple looping to explore kernel settings or devices:

 for i in /proc/* ; do echo $i ; done 

The following cheatcodes are processed or have some effect during stage 1:

pnpbios=

vga=

acpi=

mem=

ide2=

nopcmcia

pci=

nosmp

noapic

debug

nomce

noapm

nousb

nofirewire

expert

modules-disk

noscsi

fromhd

atapicd

knoppix_dir=

knoppix_name=

dma

nodma

 

The most common problems seem to be issues with VGA settings, Direct Memory Access (DMA), power settings, and PNP BIOS. If you don't get to the stage 1 shell, reboot your machine and try booting with the following:

 knoppix vga=normal nodma noapic noacpi pnpbios=off acpi=off image from book    noapm debug -b 3 

If that doesn't work, you can turn off a lot of options using the failsafe kernel label:

 failsafe debug -b 3 
Note 

The boot command line has a limit of 256 characters.

Exploring Stage 2

To move on to stage 2, enter exit at the stage 1 shell prompt. A few lines of text messages appear, followed by this prompt:

 bash-3.00# 

The following cheatcodes are processed or have some effect during stage 2: bootfrom=, tohd, and toram.

Exploring Stage 3

To move on to stage 3, type exit at the stage 2 shell prompt. You'll then see a few lines of text messages followed by this prompt:

 root@console (deleted)[/]# 

No cheatcodes are processed when moving to stage 3. However, this does mark the end of the initial boot script, /linuxrc. When Knoppix leaves stage 3, /linuxrc is deleted and /etc/init takes over the boot process. Basically, /UNIONFS is set up in this stage.

Exploring Stage 4 (Emergency Mode)

Leave stage 3 by typing exit. You'll see the line "Starting the init process" followed by "Give root password for maintenance." Simply press the Enter key, and you will be in an emergencymode shell. At this point, the init program (/etc/init) has taken over and begun processing /etc/inittab. The only cheatcode processed at this stage is -b, which causes init to boot directly into a single user shell without running any other startup scripts. This enables you to modify those startup scripts, change environment variables, or load/unload modules before continuing the boot process.

Tip 

If you cannot get to the next stage, modify the file /etc/init.d/knoppix-autoconfig by placing a set -x command near the top. That commands tells Knoppix to display a lot of debugging information that may give you some clues as to why Knoppix does not successfully complete moving on to the next stage.

Exploring Stage 5 (Textmode Runlevel)

Move on to stage 5 by entering exit. Knoppix is then in textmode, specifically runlevel 3, in which you have a fully running Knoppix system. The big change between stages 4 and 5 is that the startup script /etc/init.d/knoppix-autoconfig ran, probing and configuring more of the hardware. Specifically, knoppix-autoconfig processes the following cheatcodes (some with examples):

myconf=/dev/sda1

myconf=scan

config=scan, myconfig=scan

floppyconfig, floppyconf

home=scan

splash

blind

brltty=type

port

table

alsa

alsa=es1938

lang=bg|be|ch|cn|cs|cz|da| de|dk|es|fi|fr|ie|it|ja|nl|pl|ru|sk|tr|tw|uk|us

keyboard=us, xkeyboard=us

testcd

desktop=fluxbox|icewm|kde|larswm|twm| wmaker|xfce

gmt|utc

tz

nohwsetup

noaudio

noagp

noswap

dma

nofstab

swap

config

nodhcp

 

knoppix-autoconfig also calls some auxiliary scripts that generate a number of configuration files, most notably all the files in /etc/sysconfig/.

Virtual Consoles

While you are in textmode, you should become familiar with switching between the four virtual consoles (VCs). You can tell which VC you are in by looking at the shell prompt. When you boot into textmode level, you are in the first VC by default. The first VC has a prompt with tty1. The second VC has a prompt with tty2, and so on. In addition, each VC is associated with one of the function keys F1 through F4, respectively. To switch to the second VC, press the key combination Ctrl+Alt+F2. To switch back to the first VC, press Ctrl+Alt+F1. The same is true for the other virtual consoles: press Ctrl+Alt+F3 for the third VC, and Ctrl+Alt+F4 for the fourth.

Runlevels

One other task that you should be familiar with is changing runlevels. A Linux runlevel is similar to Windows' safe mode. You can tell which runlevel you are in by entering the command runlevel, which displays two numbers: the previous runlevel and your current one. Knoppix comes predefined with seven runlevels, numbered 0 through 6. By default, Knoppix boots into number 5 (more on this in the next section). You can specify a different runlevel at the boot prompt. For example, earlier you specified runlevel 3 by entering knoppix 3 at the boot prompt.

Depending on the runlevel, different features or services are enabled or disabled. In Knoppix, the runlevels are divvied up this way: four for textmode, one for graphics mode, and two that power down the computer. In runlevel 1, Knoppix starts up in textmode level with only one VC. In runlevel 2, Knoppix starts up in textmode with four VCs. Runlevels 2, 3, and 4 act identically. Runlevel 5 is the graphics mode (more on this in the next section). Runlevels 0 and 6 are, respectively, for powering down or rebooting the machine. To change runlevels once Knoppix is running, use the init command. For example, to change to runlevel 1, enter init 1. To change back to runlevel 3, enter init 3.

Examining the Graphics Phase

To start the graphics phase of the boot process, enter init 5 from any virtual console. Of course, you could also get here by explicitly entering knoppix 5 at the boot prompt or by simply pressing the Enter key at the boot prompt because runlevel 5 (graphics mode, which displays the KDE desktop) is the default for Knoppix.

To start the graphics environment, /etc/init ran the script /etc/init.d/xsessions, which processed the following cheatcodes by default:

xserver=XFree86|XF86_SVGA

xkeyboard=us

xmodule=ati|radeon|fbdev|vesa|savage|s3|nv|i810|mga|svga|tseng

desktop=fluxbox|icewm|kde|larswm|twm|wmaker|xfce

nowheelmouse

wheelmouse

screen=1280x1024

xhrefresh=80 or hsync=80

xvrefresh=60 or vsync=60

 

From within graphics mode, you also can switch virtual consoles. To switch to the second VC, press Ctrl+Alt+F2. To return to the graphics virtual console, the fifth VC, press Ctrl+Alt+F5. You can also change runlevels by opening the K menu and selecting Run Command, and then typing sudo init 3 to change to runlevel 3, for example. You can also do this by first switching to a text VC and then entering init 3. To return to runlevel 5, enter init 5.

You can cycle between different graphics modes using Ctrl+Alt+Shift+= and Ctrl+Alt+. In addition, you can restart the X server by typing Ctrl+Alt+Backspace.

Examining the Shutdown Phase

To begin shutdown from graphics mode, open the K menu and select Logout, and then click either Turn Off Computer or Restart Computer, depending on whether you want to power off or reboot the machine. You can also shut down from a virtual console by entering poweroff or reboot. During the shutdown phase, Knoppix goes through two more stages before finally powering off. To proceed from one stage to the next, simply enter exit at the command line.

Cheatcodes processed during this phase are noeject and noprompt. Because of the way the scripts are currently written, if you specify noprompt (which instructs Knoppix not to prompt you to remove the CD and press Enter), you must also specify noeject. (which tells Knoppix not to eject the CD). If you specify only noprompt, Knoppix hangs just before rebooting.



Hacking Knoppix
Hacking Knoppix (ExtremeTech)
ISBN: 0764597841
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net