In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to remove the useless Linux kernel from a Ubuntu system? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Find useless images
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:
Copy the code
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:
Copy the code
The code is as follows:
Dpkg-- get-selections | grep linux
For example, my local display is as follows:
Copy the code
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.
Copy the code
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).
Copy the code
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.
Copy the code
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.
Copy the code
The code is as follows:
$sudo update-grub2
After reading the above, do you know how to remove the useless Linux kernel from the Ubuntu system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.