Article Title: Linux GRUB guides the single-user mode in three ways. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories as a Linux system administrator, you may forget the Linux Super User Password, set/etc/inittab or/etc/rc. d/rc. files such as sysinit are incorrectly edited, which makes the system fail to start normally? To solve the preceding problems, you need to enter the linux root file system in read/write mode.
The following describes three methods for Linux single-user mode under GRUB boot:
Hardware environment: intel P4/1g ram/sata 80G software environment: 1) Fedora Core 3 (FC3) and Windows2000 advance server dual system. 2) LVM manages Linux partitions. 3)/boot/grub. conf file content: # grub. conf generated by anaconda # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a/boot partition. this means that # all kernel and initrd paths are relative to/boot/, eg. # root (hd0, 2) # kernel/vmlinuz-version ro root =/dev/VolGroup00/LogVol00 # initrd/initrd-version.img # boot =/dev/sda default = 1 timeout = 1000 splashimage = (hd0, 2) /grub/splash.xpm.gz hiddenmenu title Fedora Core (2.6.9-1.667) root (hd0, 2) kernel/vmlinuz-2.6.9-1.667 ro root =/dev/VolGroup00/LogVol00 rhgb quiet initrd/initrd-2.6.9-1.667.img title windows 2000 adv rootnoverify (hd0, 0) chainloader + 1
|
First, start the computer and the screen displays the following prompt:
Press any key to enter the menu Booting windows 2000 adv in 999 seconds…
|
Skip the timer with one click and go to the next step:
GNU GRUB version 0.95 (639K lower/103924K upper memory) Fedora Core (2.6.9-1.667) Windows 2000 adv
|
The following is the GRUB prompt:
'E' edit the startup command line before booting. 'A' edit the kernel parameters before booting. 'C' go to the grub command line.
|
Then, press the three different keys 'E', A', and 'C' to enter three different operations:
I. Quick Method
Select the ora Core (2.6.9-1.667) menu and press:
grub append>ro root=/dev/VolGroup00/LogVol00 rhgb quiet
|
Modify:
grub append>ro root=/dev/VolGroup00/LogVol00 single quiet
|
Press ENTER to complete the modification and booting to ENTER the Linux single-user mode:
Ii. Simple Method
Select the ora Core (2.6.9-1.667) menu and press e:
Root (hd0, 2) kernel/vmlinuz-2.6.9-1.667 ro root =/dev/VolGroup00/LogVol00 rhgb quiet initrd/initrd-2.6.9-1.667.img select kernel/vmlinuz-2.6.9-1.667 ro root =/dev/VolGroup00/LogVol00 rhgb quiet
|
Press the e key on the command line:
grub edit>kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
|
Modify:
grub edit>kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 single quiet
|
Press ENTER to complete the modification. Press the B key booting to enter the Linux single user mode:
Iii. manual method
Press the c key to enter the grub command line: (press the TAB key under the grub command line to obtain the grub Command help and the possible selection of the grub command)
Item)
grub>fstest (grub>filesystem tracing is now on grub>root (hd0,2)
|
(Specify the partition that stores the Linux kernel as the third partition of the first hard disk)
grub>filesystem type is ext2fs,partition type 0x83 grub>kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 single quiet
|
(Specify the Kernel File as/boot/vmlinuz-2.6.9-1.667, the kernel parameter is ro-readonly, the root partition is/dev/VolGroup00/LogVol00, rhgb-graphical startup, quiet-do not output boot Information)
grub>initrd /initrd-2.6.9-1.667.img
|
(Before the kernel is started, load the kernel module that supports system hardware devices-initrd image file-/boot/initrd-2.6.9-1.667.img and initialize RAM disk)
If the system configuration and script file are correct, the above three methods will appear in the Booting command-list:
remounting root filesystem in read-write mode:[OK]
|
Indicates that the root file system in linux single-user mode is readable and writable. If the system configuration and script file are incorrect, the root file system in linux single-user mode is read-only file system:
sh-3.00#mount ?o remount rw ?t ext3 /
|
By re-mounting the root file system to read/write, you can edit the system files with errors.