How to: Linux delete or remove kernel
来源:互联网 发布:域名提供商查询 编辑:程序博客网 时间:2024/05/18 00:23
Q. I have multiple versions installed and I need to save disk space. I am using Cent OS Linux. How can I delete or remove a Linux kernel from my Linux distribution ?
A. Linux Kernel and related files are stored in following locations:
=> /boot - Stores actual kernel and related file such system man and initrd images,
=> /etc or /boot/grub - Stores grub.conf file (most distro use /boot/grub these days).
=> /iib/modules/KERNEL-VERSION/* - Linux device drivers (modules)
If kernel is installed using binary package system such as rpm, yum, up2date, apt-get etc you can remove with following commands:
Rpm based distro - Red Hat/CentOS/Fedora Core/Suse Linux
First find out all installed kernel version with following command:# rpm -qa | grep kernel-smp
or# rpm -qa | grep kernel
Output:
kernel-smp-2.6.9-42.ELkernel-smp-2.6.9-42.0.3.ELkernel-smp-2.6.9-42.0.8.EL
I've total 3 different kernel installed. To remove kernel-smp-2.6.9-42.EL type command:# rpm -e kernel-smp-2.6.9-42.EL
OR# rpm -vv -e kernel-smp-2.6.9-42.EL
.deb based distro - Debian or Ubuntu Linux
Again find out all installed kernel version:$ dpkg --list | grep kernel-image
Output:
ii kernel-image-2.4.27-2-386 2.4.27-10sarge1 Linux kernel image for version 2.4.27 on 386ii kernel-image-2.6.8-2-686 2.6.8-16sarge1 Linux kernel image for version 2.6.8 on PPro
Now remove kernel-image-2.4.27-2-386 with apt-get command itself:# apt-get remove kernel-image-2.4.27-2-386
OR$ sudo apt-get remove kernel-image-2.4.27-2-386
If you have custom compiled kernel you need to remove following files/dirs:
- /boot/vmlinuz*KERNEL-VERSION*
- /boot/initrd*KERNEL-VERSION*
- /boot/System-map*KERNEL-VERSION*
- /boot/config-*KERNEL-VERSION*
- /lib/modules/*KERNEL-VERSION*/
- Update grub configuration file /etc/grub.conf or /boot/grub/menu.lst to point to correct kernel version.
在Ubuntu下:
sudo rm -rf /lib/modules/*KERNEL-VERSION*
sudo rm -rf /usr/src/linux-headers-*KERNEL-VERSION*
sudo rm /boot/*KERNEL-VERSION*
sudo rm /var/lib/dpkg/info/linux-headers-*KERNEL-VERSION*
update-grub2更新grub即可
Caution: Removing working kernel may result into unstable / non- bootable Linux server system.
原始地址:http://www.cyberciti.biz/faq/debian-redhat-linux-delete-kernel-command/
- How to: Linux delete or remove kernel
- How To Remove Or Delete PPA In Ubuntu
- How to update or delete db
- How to add or remove a static ARP entry on Linux
- How to remove unused kernel from fedora 25
- How To Find Your Ubuntu or Kernel Version
- How to Compile the Linux Kernel
- How to: Compile Linux kernel 2.6
- how to jonin linux kernel developing
- How to: Compile Linux kernel 2.6
- how to got “linux-kernel mail list”
- How to patch the linux kernel patch
- How to: Compile Linux kernel modules
- How to: Compile Linux kernel 2.6
- How to: Compile Linux kernel 2.6
- how to compile the linux kernel
- How to sleep in the Linux kernel?
- How to remove space or newline characters from a string?
- java自学笔记之多态 内部类 异常处理
- 实现了wm手机无线共享电脑流量
- Qt5.2中的android环境搭建
- Java中的main()方法详解
- fork函数的用法总结
- How to: Linux delete or remove kernel
- CF 123D
- Hadoop学习笔记(三):Combiner funcitons
- windows x64 安装python科学计算模块numpy
- windows phone 系统托盘设置(顶部状态栏)
- Java基础--对javaBean的简单内省操作
- leetcode Merge Intervals
- ORACLE删除某用户下所有对象
- 详细分析局域网内通过无线实现Android端与PC端TCP/UDP通信的四种情况