`
DavyJones2010
  • 浏览: 154146 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Linux: Startup Analysis II -- GRUB analysis

阅读更多

Question Summary:

1> What is GRUB?

2> What's its position when Linux start up?

GRUB is BootLoader in Linux, its main focus is load Kernel.

 

1. GRUB configuration

1) The GRUB config file stores in "/boot/grub/grub.conf"

     Also it has a soft link "/etc/grub.conf"

2) "/boot" directory stores the file needed for system start up.

ls /boot
config-2.6.18-194.el5
lost+found
System.map-2.6.18.el5
grub
message
vmlinuz-2.6.18-194.el5
initrd-2.6.18-194.el5.img
symvers-2.6.18-194.el5-gz

 3) What stores in "/boot/grub/grub.conf"?

#grub.conf generated by anaconda
#...
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5)
            root(hd0,0)
            kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
            initrd /initrd-2.6.18-194.el5.img

1) default: the default start up os, in real server env, we will not install multiple os.

2) timeout: the default waiting time(second)

3) splashimage: GRUB GUI image. (hd0,0) --> hd(Hard Disk). hd0 the first hard disk. hd(0, 0) the first segment on the first hard disk.

    Here, (hd0,0) represents the hardware position of folder "/boot".

    So we can find splash.xpm.gz in /boot/grub directory.

4) hiddenmenu: If we comment this, then we can get the information of GRUB procession.

5) kernel: point out the position of kernel. ro means readonly.

6) initrd: load image file

 

2. Single user mode

1) Why should we use single user mode?

    We may forget the password for root.

    There may be file system chaos after a sudden power off.

    Single user mode enable us login system as root and don't have to input password.

    Single user mode disabled X-Window

2) How can we shift to single user mode?

e: edit current start menu
c: enter GRUB command line
b: start current selected start menu item
d: delete current line
Esc: return to GRUB start up GUI and cancel all the modification for current menu item.

1. Step into GRUB GUI when start up.

2. Press e into edit line mode

3. Move highlight to kernel row, and press e again into edit mode.

4. Add 1 or s to the end of this line like this: kernel /vmlinuz-2.6.18-194.el ro root=LABEL=/ rhgb quiet 1

5. Press b to boot the system with single user mode as root.

 

3. Setup password for GRUB

1) Why should we set password for GRUB?

    To prevent other people change the password or damage system when entering single user mode by using GRUB.

2) How should we set password for GRUB?

    Just have to add line before title.

#grub.conf generated by anaconda
#...
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 **********************
title CentOS (2.6.18-194.el5)
            root(hd0,0)
            kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
            initrd /initrd-2.6.18-194.el5.img

 

4. Recover GRUB

1) After startup and get into GRUB GUI, there is no menu displayed, only grub> prompt:

    That may results from a damaged row in grub.conf file.

     As convention, we should backup /boot directory for emergency use.

press c to enter grub command line.

grub> cat /boot/grub/grub.conf (look up the params)

grub> root (hd0,0) --> set root path as the /boot directory

grub> kernel (hd0,0)/vmlinuz-2.4.18-14 ro root=LABEL=/  --> set kernel file as ...

grub> initrd (hd0,0)/initrd-2.4.18-14.img  --> set initrd 

grub> boot

2) What if we cannot even get into GRUB GUI?

We have to use linux installation cd to recover the system.

分享到:
评论

相关推荐

    Vivado HLS | Export RTL报错 “ERROR: [IMPL 213-28]

    关于对2022.1.1以后VHLS不能生成IP核的解决补丁

    NordicSemiconductor::Device:Startup:8.27.0

    Error #541: 'NordicSemiconductor::Device:Startup:8.27.0' component is missing (previously found in pack 'NordicSemiconductor.nRF_DeviceFamilyPack_NordicLicense')

    StartupPitchPerfect:Startup Pitch Perfect - 初创公司的战场

    Startup Pitch Perfect - 初创公司的。 Startup Pitch Perfect 会根据“X 换 Y”的比喻自动生成一个随机的启动和标准推介平台(例如市场、产品、战略、团队)的所有幻灯片,向您的朋友推介。 现在轮到你了! 本...

    javaWEB总结(2): load-on-startup节点

    在Java Web开发中,`load-on-startup`节点是一个至关重要的概念,特别是在Servlet容器(如Tomcat)中。这个节点通常出现在Servlet的配置文件——web.xml中,它用于指定Servlet在Web应用程序启动时的加载顺序。`load-...

    最新版linux apache-tomcat-9.0.37.tar.gz

    5. **启动、停止和管理**:Apache Tomcat提供了一系列的脚本用于管理服务,如`bin/startup.sh`用于启动Tomcat,`bin/shutdown.sh`用于关闭Tomcat。这些脚本需要使用`sudo`权限执行。 6. **配置**:Tomcat的配置文件...

    Oracle10g视图的神图

    - **STARTUP_TIME**:启动时间。 - **LAST_BROWSED_SEQ**:最后浏览序列号。 - **LAST_BROWSED_NUM**:最后浏览编号。 - **LAST_DEQUEUE**:最后出队时间。 #### 全球固定视图(GV$ views) **概述:** 除了...

    startup-Bytedrops-2021:Starup-Bytedrops-2021

    【标题】"Startup-Bytedrops-2021"是一个与初创公司Bytedrops在2021年的活动或项目相关的主题。这个标题暗示了可能包含的是该公司的技术文档、项目代码、会议记录或者市场策略等内容,尤其关注点在于其在2021年的...

    nacos-server-2.3.0压缩包

    Linux/Unix/Mac启动命令(standalone代表着单机模式运行,非集群模式):sh startup.sh -m standalone如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行:bash startup.sh -m ...

    EurekaLog_7.5.0.0_Enterprise

    2)....Fixed: Range check error in processes information for x64 machines (affects startup of any EurekaLog-enabled module) 3)....Fixed: Auto-detect personality by project extension if --el_mode switch...

    tomcat启动的问题--apr

    2010-8-11 18:24:13 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 984 ms 2010-8-11 18:24:13 org.apache.catalina.core.StandardService start 信息: Starting service Catalina ...

    C51启动文件--STARTUp.A51--详细注释.docx

    ### C51启动文件STARTUp.A51详细解析 #### 文件概述 《C51启动文件--STARTUp.A51--详细注释.docx》是一份关于C51语言编程中启动文件(STARTUp.A51)的详细介绍文档。这份文档主要针对的是使用Keil C51编译器进行...

    MACINTOSH

    - **Bypass primary startup volume and seek a different startup volume (such as a CD or external disk)**:启动时按下 `Option-Command-Shift-Delete`,这可以让你跳过默认的启动磁盘,选择其他的启动介质如 CD...

    XShell5-Startup-Script-master.zip

    解压后,我们可以看到一个名为"XShell5-Startup-Script-master"的文件夹,这通常包含了脚本源代码、使用说明或其他相关辅助文件。用户需要根据自己的操作系统环境,对脚本进行适当的修改和配置,然后将它设置为...

    思科命令与华为命令对比

    - 思科:`erase startup-config`或`delete flash:startup-config` - 华为:`delete configuration` 9. **加密密码** - 思科:明文`0`,密文`7` - 华为:未直接提及,但可以使用`service password-encryption`...

    spring-startup-analysis:用于分析Java Spring中的bean构建的简单模块

    弹簧启动分析仪 该项目被设计为一个模块,您可以通过Maven引入,它会生成类似于下... <artifactId>spring-startup-analysis <version>1.1.0 将以下基本软件包添加到您的组件中: com.github.lwaddicor.springstartu

    创建oracle的后台服务OracleServiceORCL

    其中,-STARTUP 指定启动服务,-SID 指定服务的 SID,-USRPWD 指定服务的口令,-STARTTYPE 指定服务的启动类型,-PFILE 指定服务的参数文件。 关闭服务的基本语法为: oradim -SHUTDOWN -SID sid [-USRPWD 口令] ...

    Linux——java环境部署

    ### Linux——Java环境部署 #### 一、概述 在Linux环境下进行Java开发环境的搭建是一项基础而重要的工作。本文档将详细介绍如何在Linux系统中安装并配置Java环境,包括JDK与Tomcat的安装配置过程,并附带一些常用...

    p7331323_10204_AIX5L

    Applies to: Oracle Server - Enterprise Edition - Version: 10.2.0.4 to 11.1.0.6 ...NOTE:419871.1 - Failures due to "skgxpvfymmtu: process failed because of a resource problem in the OS" on 32-bit Linux

Global site tag (gtag.js) - Google Analytics