zoukankan      html  css  js  c++  java
  • 如何删除 CentOS 6 更新后产生的多余的内核?

    第一种方法:通过命令的方式解决多余的内核

    1.首先查看当前内核的版本号:

    [root@jxatei ~]# uname  -a

    Linux jxatei.server2.6.32-573.1.1.el6.x86_64 #1 SMP Sat Jul 25 17:05:50 UTC 2015 x86_64 x86_64x86_64 GNU/Linux

    2.查询系统中全部的内核:

    [root@jxatei ~]# rpm  -qa|grep kernel

    kernel-2.6.32-504.30.3.el6.x86_64

    kernel-headers-2.6.32-573.1.1.el6.x86_64

    kernel-2.6.32-573.1.1.el6.x86_64

    kernel-2.6.32-504.el6.x86_64

    dracut-kernel-004-388.el6.noarch

    kernel-firmware-2.6.32-573.1.1.el6.noarch

    3. 以上是我CentOS的内核版本号,其中红色为要删除的版本号:

    [root@jxatei ~]# yum  remove  kernel-2.6.32-504.30.3.el6.x86_64

    Loaded plugins: fastestmirror

    Setting up Remove Process

    Resolving Dependencies

    --> Running transaction check

    ---> Package kernel.x86_640:2.6.32-504.30.3.el6 will be erased

    --> Finished Dependency Resolution

    Dependencies Resolved

    =============================================================================================================================

     Package                  Arch                     Version                                  Repository                  Size

    =============================================================================================================================

    Removing:

     kernel                   x86_64                   2.6.32-504.30.3.el6                      @updates                   124 M

    Transaction Summary

    =============================================================================================================================

    Remove   1 Package(s)

    Installed size: 124 M

    Is this ok [y/N]: y

    Downloading Packages:

    Running rpm_check_debug

    Running Transaction Test

    Transaction Test Succeeded

    Running Transaction

    Repository base is listed more thanonce in the configuration

    Repository updates is listed morethan once in the configuration

    Repository extras is listed more thanonce in the configuration

    Repository centosplus is listed morethan once in the configuration

    Repository contrib is listed morethan once in the configuration

     Erasing:kernel-2.6.32-504.30.3.el6.x86_64  1/1                            Verifying:kernel-2.6.32-504.30.3.el6.x86_64  1/1                          Removed:

     kernel.x86_64 0:2.6.32-504.30.3.el6                                       Complete!                                            

     4.重启后就可以看到,内核被删掉了,同时多余的启动项也自动被删掉了。

       重启系统后,可以通过查看以下两个文件是否还有多余内核代码:

    [root@jxatei ~]#vi /boot/grub/grub.conf

    [root@jxatei ]# vi /boot/grub/menu.lst

    第二种方法:通过修改“menu.lst”文件,删除红色部分来解决多余的内核

     [root@jxatei ~]# vi  /boot/grub/menu.lst

    # grub.confgenerated by anaconda

    #

    # Note thatyou 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 arerelative to /boot/, eg.

    #          root (hd0,0)

    #          kernel /vmlinuz-version roroot=/dev/sda3

    #          initrd /initrd-[generic-]version.img

    #boot=/dev/sda

    default=0

    timeout=5

    splashimage=(hd0,0)/grub/splash.xpm.gz

    hiddenmenu

    title CentOS(2.6.32-573.1.1.el6.x86_64)

            root (hd0,0)

    "/boot/grub/menu.lst"25L, 1368C

    # grub.confgenerated by anaconda

    #

    # Note thatyou 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 arerelative to /boot/, eg.

    #          root (hd0,0)

    #          kernel /vmlinuz-version roroot=/dev/sda3

    #          initrd /initrd-[generic-]version.img

    #boot=/dev/sda

    default=0

    timeout=5

    splashimage=(hd0,0)/grub/splash.xpm.gz

    hiddenmenu

    title CentOS(2.6.32-573.1.1.el6.x86_64)

            root (hd0,0)

            kernel/vmlinuz-2.6.32-573.1.1.el6.x86_64 roroot=UUID=72640132-d6de-46b4-bceb-c7fff46de559 rd_NO_LUKS  KEYBOARDTYPE=

    pc KEYTABLE=usrd_NO_MD crashkernel=auto.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet

           initrd/initramfs-2.6.32-573.1.1.el6.x86_64.img

    titleCentOS (2.6.32-504.30.3.el6.x86_64)

            root (hd0,0)

       kernel /vmlinuz-2.6.32-504.30.3.el6.x86_64ro root=UUID=72640132-d6de-46b4-bceb-c7fff46de559 rd_NO_LUKS  KEYBOARDTYPE =pc KEYTABLE=us rd_NO_MDcrashkernel=auto.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet  initrd/initramfs-2.6.32-504.30.3.el6.x86_64.img

    第三种方法:通过修改”grub.cfg”文件解决多余的内核

    [root@jxatei ~]#vi /boot/grub/grub.conf

    # grub.confgenerated by anaconda

    #

    # Note thatyou 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 arerelative to /boot/, eg.

    #          root (hd0,0)

    #          kernel /vmlinuz-version roroot=/dev/sda3

    #          initrd /initrd-[generic-]version.img

    #boot=/dev/sda

    default=0

    timeout=5

    splashimage=(hd0,0)/grub/splash.xpm.gz

    hiddenmenu

    title CentOS(2.6.32-573.1.1.el6.x86_64)

            root (hd0,0)

    "grub.conf"17L, 755C

    # grub.confgenerated by anaconda

    #

    # Note thatyou 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 arerelative to /boot/, eg.

    #          root (hd0,0)

    #          kernel /vmlinuz-version roroot=/dev/sda3

    #          initrd /initrd-[generic-]version.img

    #boot=/dev/sda

    default=0

    timeout=5

    splashimage=(hd0,0)/grub/splash.xpm.gz

    hiddenmenu

    title CentOS(2.6.32-573.1.1.el6.x86_64)

            root (hd0,0)

            kernel/vmlinuz-2.6.32-573.1.1.el6.x86_64 roroot=UUID=72640132-d6de-46b4-bceb-c7fff46de559 rd_NO_LUKS  KEYBOARDTYPE=

    pc KEYTABLE=usrd_NO_MD crashkernel=auto.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet

       initrd/initramfs-2.6.32-573.1.1.el6.x86_64.img ~

           小结,其实第二、三种方法非常相似,都是修改文件,而且内容都是一样的。sky建议,如果我们要成为Linux专家,只有多使用命令的习惯性操作。 

  • 相关阅读:
    php程序员的弱点
    php cli 模式下执行文件,require 加载路径错误
    第一次!
    IO流(一)之IO流综述
    异常和错误
    Comparable与Comparator比较分析
    Collection与Map学习笔记(三)
    两个对象比较
    Collection与Map学习笔记(二)
    包装类、及装箱和拆箱
  • 原文地址:https://www.cnblogs.com/mengdeep/p/7492748.html
Copyright © 2011-2022 走看看