Update the kernel and clear useless files in ubuntu

Source: Internet
Author: User
Article Title: ubuntu kernel update and useless file cleanup. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

When I update the kernel for the first time, I am prompted

"Is the menu. list of the boot file automatically updated after being edited?

At that time, I thought I had to re-edit the update.

"No".

Why do I need to edit it? Due to hardware problems, I added the noapic parameter to start the system.

As a result, the problem arises. Although a new kernel is installed on the machine, but menu. list is not updated, I have to use the old kernel.

Manually add the file name of the new kernel to menu. list, because I don't know what uuid is, I didn't write it.

Restart the system...

Select the newly added kernel...

Boot successful...

...

The ubuntu system gets stuck at the startup screen.

After some searching, I got it done after asking a question.

Uuid seems to be the recorded hard disk information. I thought about copying the uuid of the old kernel to the new kernel, but I was afraid that it would be worse if there were any major errors because I didn't know what the uuid was.

After all, I am most afraid of the issue of "guiding" Hard Disk Data.

The following are some knowledge required to update the kernel:

Edit software source

Sudo gedit/etc/apt/sources. list

View the existing kernel of the system.

Dpkg-l | grep linux

Or

Dpkg? Get-selections | grep linux

Display current Kernel

Uname-

Upgrade the kernel

Apt-get dist-upgrade

Delete Kernel

Sudo apt-get remove kernel name

Files with an image need to be deleted and must contain all versions and other characters. Other related files are automatically deleted.

For example:

Sudo apt-get remove? Purge linux-image-2.6.24-19-generic

? The purge parameter indicates that the object is permanently deleted.

In addition, when I deleted the kernel 2.6.24-19, I forgot to use it. Fortunately, there is no risk. The current kernel cannot be deleted.

Update menu. list

Sudo update-grub

Back up menu. list and rename or delete it. This will automatically recreate the file. Copy the required items in the original menu. list to the new menu. list.

Grub does not add boot information from other systems during reconstruction. You just need to copy it from the original file.

System spam cleaning

Sudo apt-get autoclean clear old software Cache

Sudo apt-get clean all software caches

Sudo apt-get autoremove deletes isolated software that is no longer used by the System

Reference webpage:

Http://gflyer2911.spaces.live.com/blog/cns! 1966A72836DAFE56! 148. entry

Unlike Windows systems, Ubuntu Linux does not generate useless junk files. However, during cache upgrade, Ubuntu Linux does not automatically delete these files. Today, we will discuss how to clean these junk files.

1. Useful cleanup commands:

Sudo apt-get autoclean

Sudo apt-get clean

Sudo apt-get autoremove

These three commands mainly clean up and upgrade the cache and useless packages.

2. Clear the cache files of opera firefox:

Ls ~ /. Opera/cache4

Ls ~ /. Mozilla/firefox/*. default/Cache

3. Clear isolated packages in Linux:

In the graphic interface, we can use: gtkorphan

Sudo apt-get install gtkorphan-y

Run the following command on the terminal: deborphan

Sudo apt-get install deborphan-y

4. Uninstall: tracker

Generally, I only need to install Ubuntu and delete tracker first. This will not only generate a large number of cache files, but also affect the boot speed. So you can delete it in Suntory.

5. Delete unnecessary kernels: Do not delete any errors. Remember !!

Run the command dpkg -- get-selections | grep linux on the terminal.

Kernel files with images

Delete the old kernel file:

Sudo apt-get remove Kernel File name (e.g.: linux-image-2.6.27-2-generic)

Delete the kernel and release the space. The space should be-MB.

Finally, don't forget to look at the current kernel: uname-

Appendix:

Temporary File directory for package management:

Package in

/Var/cache/apt/archives

If the download is not completed

/Var/cache/apt/archives/partial

After using Ubuntu for a while, you will find that many kernels are installed in the system due to automatic upgrades. As I have installed so many of the following, this leads to a long startup list. You must delete unnecessary items.

First, use the following command to list all installed kernels. In the following table, the kernel files with images are used. Select the package to be uninstalled and use apt-get to uninstall the package.

[Tc @ ibm: ~] $ Dpkg -- get-selections | grep linux

Libselinux1 install

Install linux-386

Install linux-image-2.6.15-23-386

Install linux-image-2.6.15-27-386

Install linux-image-2.6.15-27-686

Install linux-image-2.6.15-28-386

Deinstall linux-image-2.6.15-28-686

Install linux-image-386

Linux-kernel-headers install

Install linux-restricted-modules-2.6.15-23-386

Install linux-restricted-modules-2.6.15-27-386

Install linux-restricted-modules-2.6.15-27-686

Install linux-restricted-modules-2.6.15-28-386

Deinstall linux-restricted-modules-2.6.15-28-686

Install linux-restricted-modules-386

Linux-restricted-modules-common install

Linux-sound-base install

Util-linux install

The specific uninstall method is

Sudo apt-get remove linux-image-2.6.15-23-386

In this way, the kernel files can be automatically deleted and the disk space can be released.

In addition, you need to record a command.

Uname-

Use this command to view the Kernel used by the current system.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.