


How to remove useless Linux kernel in Ubuntu
Find useless mirrors
First of all, you can check the currently used kernel, you can get the information through the command: uname -a a . For example, it shows on my desktop For:
Copy the code
The code is as follows:
magc @ magc-desktop : ~ $ uname-a
Linux magc-desktop 2 . 6 . 24 -19-RT # 1 SMP prempt RT Thu August 21, 02:08336003 UTC 2008 i686 GNU/Linux
Then decide which ones need to be removed by looking at the list of all kernels on this machine:
Run command:
Copy code
The code is as follows:
dpkg - get-selections|grep linux
For example, my machine displays:
Copy code
The code is as follows:
magc @ magc-desktop : ~ $ dpkg-get-selections | grep Linux
libselinux1 installation
Linux-Universal Installation
linux-headers-2.6.24-19 Installation
Linux-headers-2.6.24-19-Universal Installation
linux -headers-2.6.24-19-rt installation
linux-headers-2.6.24-21 installation
Linux-headers-2 . 6 . 24-21-universal installation
linux-headers-2.6.24-21-rt installation
Linux-headers-generic installation
linux-headers-rt installation
Linux-image-2 . 6 . 24-19-Universal Uninstall
linux-image-2.6.24-19-rt Installation
Linux-image-2 . 6 . 24-21-Universal Installation
Linux-Image-Universal Installation
linux-image-rt Installation
Linux-Restricted-Module-2.6.24-19-Universal Uninstallation
Linux-restricted-module-2.6.24-19-rt installation
Linux-restricted-module-2.6.24-21-Universal installation
Linux-restricted-module -Common Installation
Linux-Restricted-Module-Common Installation
Linux-Restricted-Module-rt Installation
linux-rt Installation
Linux - Sound-based installation
Linux-Ubuntu-modules-2.6.24-19-Universal Uninstall
Linux-Ubuntu-modules-2.6.24-19-rt Installation
Linux-Ubuntu-module-2.6.24-21-Universal installation
util-linux installation
util-linux-locales installation
where The image is a 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 remove other useless kernels.
How to clean the old kernel image
Before deleting the old kernel, please remember that it is best to keep the two latest kernels (the latest and the previous version) to Prevent the main version from being wrong. Now let's see how to clean old kernel on Ubuntu.
The Ubuntu kernel image contains the following packages.
Linux-image-:kernel image
linux-image-extra-:additional kernel module
Linux-header-:kernel header file
First, check the kernel image installed in the system.
Copy code
The code is as follows:
$ dpkg - list | grep linux-image
$ dpkg -list | grep Linux-title
Among the listed kernel images, you can remove specific versions (such as 3.19.0-15).
Copy 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 deletes the kernel image and its related kernel modules and header files.
Please note that if you have not upgraded your kernel, deleting the old kernel will automatically trigger the installation of the new kernel. In this way, after deleting the old kernel, the GRUB configuration will be automatically upgraded and the relevant GRUB entries in the GRUB menu will be deleted.
If there are many useless cores, you can use shell expressions to delete multiple cores at once. Note that this bracket expression only works in bash or a compatible shell.
Copy code
The code is as follows:
$ sudo apt-get purge Linux-image-3 . 19 . 0-{ 18, 20, 21, 25}
$ sudo apt-get purge Linux-headers-3 . 19 . 0-{18, 20, 21, 25}
The face command will delete 4 kernel images: 3.19.0-18 , 3.19.0-20, 3.19.0-21, 3.19.0-25.
If for any reason the GRUB configuration is not upgraded correctly after removing the old kernel, you can try to manually update the configuration using the update-grub2 command.
Copy code
The code is as follows:
$ sudo update-grub2
The above is the detailed content of How to remove useless Linux kernel in Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

CentOS installation steps: Download the ISO image and burn bootable media; boot and select the installation source; select the language and keyboard layout; configure the network; partition the hard disk; set the system clock; create the root user; select the software package; start the installation; restart and boot from the hard disk after the installation is completed.

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

Docker uses Linux kernel features to provide an efficient and isolated application running environment. Its working principle is as follows: 1. The mirror is used as a read-only template, which contains everything you need to run the application; 2. The Union File System (UnionFS) stacks multiple file systems, only storing the differences, saving space and speeding up; 3. The daemon manages the mirrors and containers, and the client uses them for interaction; 4. Namespaces and cgroups implement container isolation and resource limitations; 5. Multiple network modes support container interconnection. Only by understanding these core concepts can you better utilize Docker.

CentOS hard disk mount is divided into the following steps: determine the hard disk device name (/dev/sdX); create a mount point (it is recommended to use /mnt/newdisk); execute the mount command (mount /dev/sdX1 /mnt/newdisk); edit the /etc/fstab file to add a permanent mount configuration; use the umount command to uninstall the device to ensure that no process uses the device.

After CentOS is stopped, users can take the following measures to deal with it: Select a compatible distribution: such as AlmaLinux, Rocky Linux, and CentOS Stream. Migrate to commercial distributions: such as Red Hat Enterprise Linux, Oracle Linux. Upgrade to CentOS 9 Stream: Rolling distribution, providing the latest technology. Select other Linux distributions: such as Ubuntu, Debian. Evaluate other options such as containers, virtual machines, or cloud platforms.

CentOS has been discontinued, alternatives include: 1. Rocky Linux (best compatibility); 2. AlmaLinux (compatible with CentOS); 3. Ubuntu Server (configuration required); 4. Red Hat Enterprise Linux (commercial version, paid license); 5. Oracle Linux (compatible with CentOS and RHEL). When migrating, considerations are: compatibility, availability, support, cost, and community support.

How to use Docker Desktop? Docker Desktop is a tool for running Docker containers on local machines. The steps to use include: 1. Install Docker Desktop; 2. Start Docker Desktop; 3. Create Docker image (using Dockerfile); 4. Build Docker image (using docker build); 5. Run Docker container (using docker run).
