Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Remove old kernel on Ubuntu     - Visual Studio Code experience (Linux)

- MySQL simple operation notes under Linux (Database)

- Compression decompression command under Linux (Linux)

- Android project and coding specifications (Programming)

- Nginx caching using the official guide (Server)

- Difference Redhat5 and 6 YUM source configuration (Linux)

- Linux memory management -free learning experience (Linux)

- Android Send HTTP POST requests (Programming)

- Java is simple to read and write HDFS Demo (Programming)

- Linux CPU Monitoring Index (Linux)

- MySQL Server Time Synchronization Problem (Database)

- Python Flask environment to build (Linux)

- Sorting algorithm of dichotomy (binary) insertion sort algorithm (Programming)

- Linux Apache server security (Linux)

- RedHat Linux 6.4 install Oracle 10g error (Database)

- Ant command-line compiler Android project (Programming)

- How to download apk file from the Google Play store on Linux (Linux)

- error no.2013 lost connection Tom with SQLServer during query (Database)

- Linux signal and orphans, and zombie process (Programming)

- Linux batch copy data script (Linux)

  Remove old kernel on Ubuntu
  Add Date : 2016-04-26      
  Question: In the past I've upgraded a couple of kernels on my Ubuntu. Now I want to delete these old kernel image to save my disk space. How to use the easiest way to remove the previous version of the kernel on Ubuntu?

On Ubuntu, there are several ways to upgrade the kernel. In the Ubuntu Desktop, the software update allows you to check and update to the latest kernel on a daily basis. On the Ubuntu server, one of the most important security updates is unattended-upgrades package will automatically update the kernel. However, you can also manually using apt-get or aptitude commands to update.

Over time, sustained kernel update will accumulate a large number of cores in the system no longer in use, waste your disk space. Each module kernel image and its associated / header files can take up 200-400MB disk space, and therefore no longer in use by the kernel and wasted disk space will rapidly increase.

GRUB manager for each old kernel maintains a GRUB entry, in case you want to use them.

As part of a disk cleanup, if you do not use them, you can consider clean out these images.

How to clean up the old kernel image

Before deleting old kernel, remember to leave two best recent kernel (the latest and previous versions), to prevent major releases error. Now let us look at how to clean up the old kernel in Ubuntu.

In Ubuntu kernel image contains the following packages.

linux-image-: the kernel image
linux-image-extra-: additional kernel modules
linux-headers-: kernel headers
First check the kernel image installed on your system.

$ Dpkg --list | grep linux-image
$ Dpkg --list | grep linux-headers
Listed in the kernel image, you can remove a specific version (eg 3.19.0-15).

$ Sudoapt-get purge linux-image-3.19.0-15
$ Sudoapt-get purge linux-headers-3.19.0-15
The above command will delete the kernel image and its associated kernel modules and header files.

Note that if you have not upgraded the kernel then delete the old kernel will automatically trigger install the new kernel. So after deleting the old kernel, GRUB configuration will be automatically upgraded to remove the GRUB menu relevant GRUB entry.

If you have a lot of useless kernel, you can use the shell expression once delete multiple cores. Note that this bracket expression is valid only in bash or compatible shell.

$ Sudoapt-get purge linux-image-3.19.0- {18,20,21,25}
$ Sudoapt-get purge linux-headers-3.19.0- {18,20,21,25}

The above command will remove four kernel image: 3.19.0-18,3.19.0-20,3.19.0-21 and 3.19.0-25.

If for any reason GRUB configuration after deleting the old kernel does not have the right to upgrade, you can try to manually update the configuration with update-grub2 command.

$ Sudo update-grub2
Now restart to verify that GRUB menu has been properly cleaned up.
- Fun music library in Linux using command line (Linux)
- Java multi-threaded shared communications variables (Programming)
- The PostgreSQL database pg_dump command line does not enter a password method (Database)
- U disk to install Windows and Ubuntu 15.04 dual system (Programming)
- RHEL5 stalled due to power service error system can not start (Linux)
- Spacewalk Linux system configuration and installation (Linux)
- Text editing and viewing text Linux command (Linux)
- How to prevent page five invisible killer (Linux)
- Vi (Vim) keyboard map and its basic commands (Linux)
- You can not ignore the seven Git tips (Linux)
- ORA-30926 and MERGE tables empty the temporary occupation problem (Database)
- Linux under DB2SQL1024N A database connection does not exist. SQLS (Database)
- Python kills corresponding process according to pid (Programming)
- LVM management reduces swap partition space to the root partition (Linux)
- Python several standard types of built-in functions (Programming)
- CentOS6 installation configuration rsh (Server)
- Linux command to view the system status (Linux)
- How to Install Node.js in CentOS 7 (Linux)
- Under CentOS yum install Nginx smooth switch mounted to Tengine (Server)
- Linux user login and IP restrictions (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.