In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to delete the useless Linux kernel under the Ubuntu system". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to delete the useless Linux kernel under the Ubuntu system".
Find useless images
After using Ubuntu for a while, you will find that many kernels have been installed in the system due to automatic upgrade. Old kernels that are never used need to be cleaned to save startup time and hard disk space.
First of all, you can see which kernel is currently in use, and you can get the information through the command: uname-a. For example, on my desktop, it reads:
The code is as follows:
Magc@magc-desktop:~$ uname-a
Linux magc-desktop 2.6.24-19-rt # 1 SMP PREEMPT RT Thu Aug 21 02:08:03 UTC 2008 i686 GNU/Linux
Then look at the list of all the kernels on the machine to decide which ones need to be deleted:
Run the command:
The code is as follows:
Dpkg-- get-selections | grep linux
For example, my local display is as follows:
The code is as follows:
Magc@magc-desktop:~$ dpkg-- get-selections | grep linux
Libselinux1 install
Linux-generic install
Linux-headers-2.6.24-19 install
Linux-headers-2.6.24-19-generic install
Linux-headers-2.6.24-19-rt install
Linux-headers-2.6.24-21 install
Linux-headers-2.6.24-21-generic install
Linux-headers-2.6.24-21-rt install
Linux-headers-generic install
Linux-headers-rt install
Linux-image-2.6.24-19-generic deinstall
Linux-image-2.6.24-19-rt install
Linux-image-2.6.24-21-generic install
Linux-image-generic install
Linux-image-rt install
Linux-restricted-modules-2.6.24-19-generic deinstall
Linux-restricted-modules-2.6.24-19-rt install
Linux-restricted-modules-2.6.24-21-generic install
Linux-restricted-modules-common install
Linux-restricted-modules-generic install
Linux-restricted-modules-rt install
Linux-rt install
Linux-sound-base install
Linux-ubuntu-modules-2.6.24-19-generic deinstall
Linux-ubuntu-modules-2.6.24-19-rt install
Linux-ubuntu-modules-2.6.24-21-generic install
Util-linux install
Util-linux-locales install
The one with image is the kernel file, so you can see that there are five kernel versions on my machine. I am currently using 2.6.24-19-rt, so I decided to delete other useless kernels.
How to clean up old kernel images
Before deleting the old kernel, keep in mind that it is best to keep two recent kernels (the latest and previous versions) in case the major version goes wrong. Now let's see how to clean up the old kernel on Ubuntu.
The Ubuntu kernel image contains the following packages.
Linux-image-: kernel image
Additional kernel modules for linux-image-extra-:
Linux-headers-: kernel header file
First check the kernel image installed on the system.
The code is as follows:
$dpkg-- list | grep linux-image
$dpkg-- list | grep linux-headers
In the listed kernel images, you can remove a specific version (such as 3.19.0-15).
The code is as follows:
$sudo apt-get purge linux-image-3.19.0-15
$sudo apt-get purge linux-headers-3.19.0-15
The above command removes the kernel modules and header files associated with the kernel image.
Note that if you have not upgraded the kernel, deleting the old kernel will automatically trigger the installation of the new kernel. This way, after the old kernel is deleted, the GRUB configuration is automatically upgraded to remove the relevant GRUB entry from the GRUB menu.
If you have a lot of useless kernels, you can use shell expressions to delete multiple kernels at once. Note that this parenthetical expression is valid only in bash or compatible shell.
The code is as follows:
$sudo apt-get purge linux-image-3.19.0- {18pr 20pr 21pr 25}
$sudo apt-get purge linux-headers-3.19.0- {18pr 20pr 21pr 25}
The face command deletes four kernel images: 3.19.0-18, 3.19.0-20, 3.19.0-21 and 3.19.0-25.
If the GRUB configuration is not upgraded correctly after removing the old kernel for any reason, you can try to update the configuration by hand using the update-grub2 command.
The code is as follows:
$sudo update-grub2
Restart now to verify that the GRUB menu has been cleaned correctly.
Thank you for your reading, the above is the content of "how to delete the useless Linux kernel under the Ubuntu system". After the study of this article, I believe you have a deeper understanding of how to delete the useless Linux kernel under the Ubuntu system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.