Why is it unsafe to delete old kernels?

1

It's not unsafe. Using Linux, you can do exactly what you want if you know the right commands.

In the /boot directory, you can do a simple ls -la to have a long listing as well as to find any hidden files or directories (which are not supposed to be there if there are any!!).

From this information, you can assess the dates and old versions' files. Do not remove all of them, but the oldest files which correspond to same version.

At some point, I was thinking that it might be possible that, if you have compiled your kernel from source, then you will need to tweak a new one. The .config file, which I don't think is the case as per your explanation, will stay there.

So, if it happens that after deleting the old files corresponding to a single version and after rebooting your machine, it might be possible that you encounter a kernel panic.

The simple solution is to boot the machine with a live USB or CD/DVD Linux. chroot into it, and re-build the...

0 0
2

by

Sergei

Last Updated April 10, 2015 20:00 PM

I have run out of space in my boot drive, so I decided to remove old Kernels. I found this page which describes exactly what I should do: Lubuntu Documentation: Remove Old Kernels.

I have deleted the oldest kernel manually and now it is okay, but I don’t understand one thing: at the end of the article there is some code that can delete all old kernel versions, but it is marked as for advanced users only.

I don’t really understand what the danger is here. It sounds silly, but they seem to say that there might be more than one kernel used by a specific machine at the same time.

Is it possible that different apps on my Ubuntu machine can use different kernels simultaneously? Why is deleting all old kernels automatically considered to be dangerous?

Answers 4

Removing old kernels is not inherently unsafe, but if you remove all your kernels and reboot, you'll be left at an angry Grub...

0 0
3

Why is it unsafe to delete old kernels?

By | April 10, 2015 | Category Uncategorized

By Sergei

I have run out of space in my boot drive, so I decided to remove old Kernels. I found this page which describes exactly what I should do: Lubuntu Documentation: Remove Old Kernels.

I have deleted the oldest kernel manually and now it is okay, but I don’t understand one thing: at the end of the article there is some code that can delete all old kernel versions, but it is marked as for advanced users only.

I don’t really understand what the danger is here. It sounds silly, but they seem to say that there might be more than one kernel used by a specific machine at the same time.

Is it possible that different apps on my Ubuntu machine can use different kernels simultaneously? Why is deleting all old kernels automatically considered to be dangerous?

Source::...

0 0
4

Every month are new kernel updates, bug fixes and patches security system. If you regularly update your system, then your system gradually accumulates more the number of unused old kernels.

Thus, it is likely that the boot partition /boot on the hard drive will be filled in a certain period of time. If your /boot partition is full, you will not be able to upgrade, or can't even do a kernel upgrade to any latest available version. In this case, it is very important to regularly update the kernel and software. For this you must have enough free space in the /boot partition. To system to function correctly, you must have enough free space on the /boot and /root partitions.

We can easily remove the accumulated system cache, unwanted packages and dependencies using the following commands:

sudo apt-get autoremove sudo apt-get autoclean

But the problem is that this works only if the kernel was installed automatically, or if you installed them using the Update...

0 0
5
Post by Minas

So the delete keyword has been deprecated - so good bye manual

memory management...


Um, that's a misconception. If you want manual memory management, use

malloc(), free(), and emplace.


Post by Minas

I have read in some threads that delete is an unsafe operation. What

does this exactly mean? What is unsafe about it? What does it have

to do with the GC? (if there was no garbage collection, would it be

unsafe?)


The problem is that you can call delete on GC'd objects, which in some

cases causes bad interaction with the GC. That's why it has been

deprecated.

The intention was never to get rid of manual memory management. It was
to prevent unsafe interactions with the GC. If you don't want to use the
GC, use malloc(), free(), and emplace. (In fact, this way you can have
*both* GC and manual memory management. The emplace()'d objects will be
manually managed, and...

0 0
6

Removing old kernels:

(I suggest boot to latest kernel)

Remove Manually:

First list current kernel:

uname -r

Example output:3.19.0-28-generic

To list all kernels :

dpkg --list | grep linux-image

Now purge old kernels manually,(be sure don't purge current kernel)

For example:

sudo apt-get purge linux-image-3.16.0-34 linux-image-3.16.0-46 linux-image-3.16.0-48 linux-image-3.16.0-49

Note: In general to remove old kernels use linux-image-x.x.x-x where replace x with numbers.

Automatic:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Note: you can verify deleting kernels with following command-here the output excludes current loaded/running kernel .So please boot to latest kernel.

kernelver=$(uname -r | sed -r 's/-[a-z]+//') dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver

Reference...

0 0
7

Temporary files are a type of data created for holding information temporarily. Sometimes, Windows or some app needs to create a file only for limited use and then forgets to delete it. Some files get deleted after closing or uninstalling the program.

But most of them remain on your PC. These files take up quite a lot of space over time. These can be log files, downloaded files, unnecessary Windows registry entries, etc.

But many of you don’t know or are wondering what to do with them? Do we keep them or not? Will there be any problem if I delete those files?

Don’t worry I’m here to help you today. So, let’s get started with it.

Is it Safe to Delete Temp Files?

The main question that everyone asks is whether they should delete it or not? Well, the answer would be yes, you can go ahead and remove them.

Well, temp files aren’t that important in Windows 10. Once your system uses these files, there isn't any reason to keep those...

0 0
8
autoremove will indeed remove old kernels...that are marked as eligible for autoremove.

The script /etc/kernel/postinst.d/apt-auto-removal runs after each kernel install, and determines whether a kernel should be marked as eligible for autoremoval.
Header files, manual apt-marking, and other things may interfere with the script's work. Its just a script, neither perfect nor omniscient.

In 16.04 and later, you should not need to run autoremove manually. The unattended-upgrades package, included in all default *buntu desktops, will do an equivalent action to 'autoremove' daily. You can safely run autoremove in 16.04 in addition to the u-u daily...

0 0
9

The Ubuntu Kernel team will release new Kernel updates, bug fixes, and security patches every month. If you are a long-time Ubuntu user, and regularly updating your Ubuntu system, then it might be accumulated with lot of unused and old Kernels. So, there are chances that the /boot partition in your hard disk will run out of disk space over a period of time. If your /boot partition is full, you can’t upgrade the system or you can’t even upgrade your Kernel to any latest available version. This is no good, and it is very important to regularly update your Kernel and softwares. To do so, You should have enough free space in the /boot partition. This is why it is always a good practice to remove unused Kernels, unnecessary packages, dependencies, and system cache periodically. Keep in mind that in order to function Ubuntu system properly, you must have enough free space in /boot and /root partitions.

Of course, We can easily wipe out the system cache, unneeded packages and...

0 0
10

After installing a new Linux kernel, old kernels are not automatically deleted. They remain in your disk (/boot partition). You have to delete them manually. Why?

The main reason is to save disk space, which occupied by old kernels. Some systems may become unusable if not enough disk space is available in /boot partition. However, disk space is not a problem in modern systems.

An other reason is to clean up Grub boot menu. In Ubuntu, Grub boot menu is hidden by default. You can display it by pressing "SHIFT" continuously at boot time. More details in this post.

You will never delete your current kernel, of course. It is recommended to keep at least one or two older kernels, so you can boot your system in an emergency situation (hardware or software compatibility issues with the current kernel).

After removing old kernels, new grub boot menu will be available in next reboot.

In a healthy Debian system, each time you install a...

0 0
11

I generally recommend keeping at least two kernels for each Linux distribution. This is especially true when installing a new one; occasionally a new bug creeps in, or a filesystem error occurs, which causes a new kernel to not work. In such cases, having an older kernel around as a backup can greatly simplify recovery.

That said, you can limit the number of kernels on an Ubuntu system by doing:

sudo apt-get autoremove

This command will remove packages that were pulled in automatically by packages you've since removed. It will also remove all but two or three kernels, at least in most cases. (Sometimes it seems to leave more, but I'm not sure why.) It's possible to remove more kernels by using dpkg, but that's a little more tedious. You can simply use rm to delete kernels in /boot, but that creates package/filesystem inconsistencies, which are generally best avoided. (Such issues won't cause your system to blow up, but they might cause warnings when adding or deleting...

0 0
12

LVM installs and encrypted installs use a separate /boot partition. The partition by default is capable of holding only four or five kernels, and can fill to capacity quickly. To prevent your /boot partition from getting full, you need to configure automatic removal of old kernels, or manually remove old kernels regularly.

Changing the kernel providing packages on your system requires commands with root access, so please read RootSudo.

Removing old kernels is easy to do on a system with sufficient free space in your root parition or separate boot partition. You can remove them manually, or configure unattended-upgrades to do it automatically. If you receive or have received an error from a package management tool, manual removal may not work until the problem is fixed. See Problems section.

Manual Maintenance

Using Apt

You can remove old kernels with a simple autoremove command in a terminal:

sudo apt-get autoremove --purge

Note: In...

0 0
13

That seems normal to me. For each kernel package, most of the kernel code (modules such as drivers) is stored in /lib/modules/ (with some in /lib/firmware/).

On the other hand, the images in /boot require less than 10MB of disk space between them. The following lists the kernel image files for version 3.2.0-87 with sizes in kB.

4892 /boot/vmlinuz-3.2.0-87-generic 2836 /boot/System.map-3.2.0-87-generic 784 /boot/abi-3.2.0-87-generic 144 /boot/config-3.2.0-87-generic

Automatic removal of older / unused kernel packages

The following command is useful for automatically removing some (but not all) older / unused kernel packages:

sudo apt-get autoremove

Edit: I noticed that you are currently using the 3.13.0-43-generic kernel. It would be best to reboot the system to use the latest installed kernel, 3.13.0-55-generic. The above command would be most effective if you are already using the most recently installed...

0 0
14
W

e have four different versions of Linux kernel installed by the yum command under CentOS Linux. Currently, I am using only latest version 2.6.18-53.1.4.el5.

What is proper and suggested method to remove old kernels

from a CemtOS / Debian Linux server?


Most Linux distro keeps old kernel files so that you can revert in case of emergency pop up due to hardware or software incompatibility issues. A kernel is nothing but a set of files on Linux box. Following is the suggested way to remove old kernels safely on Linux based system.

uname -r
Sample outputs:

2.6.18-53.1.4.el5

Step #2: List all installed kernels

Use the rpm command or dpkg command on Linux:
# rpm -q kernel
Sample outputs (from RPM based distro such as CentOS/RHEL):

kernel-2.6.12-1.el5 kernel-2.6.18-17.el5 kernel-2.6.18-53.el5 kernel-2.6.18-53.1.4.el5

Debian / Ubuntu Linux user, enter:
$ dpkg --list 'linux-image*'
Sample outputs:

...
0 0
15

In our last article, we’ve explained how to delete old unused kernels in CentOS/RHEL/Fedora. In this article, we will explain how to delete old unused kernels in Debian and Ubuntu systems, but before moving further, you may want to install the latest version in order to take advantage of: security fixes, new kernel functions, updated drivers and so much more.

To upgrade your kernel to latest version in Ubuntu and Debian, follow this guide:

How to Upgrade Kernel to Latest Version in Ubuntu

Important: It is advisable to keep at least one or two old kernels to fall back to in case there is a problem with an update.

To find out the current version of Linux kernel running on your system, use the following command.

$ uname -sr Linux 4.12.0-041200-generic

To list all installed kernels on your system, issue this command.

$ dpkg -l | grep linux-image | awk '{print$2}' linux-image-4.12.0-041200-generic linux-image-4.8.0-22-generic...
0 0
16

JAXenter: There seem to be plans to remove the sun.misc.Unsafe API from JDK 9. What is the reason for that?

Christoph Engelbert: The reasons are actually pretty simple. First of all, there is a desire to split up the JDK itself into modules using Project Jigsaw, and another obvious reason is security. Since not all modules need to be installed, there is less chance of security issues on certain computers.

To support that, Project Jigsaw introduces a new kind of visibility. Next to private, package private and public there is a module. That means the module meta-data defines which packages are actually exported from the module – an idea pretty close to OSGi. Therefore, it is the intention to also clean up packages that were never meant to be visible to the user.

That said, sun.misc.Unsafe does not really disappear but is hidden from the user’s perspective. The JDK / JRE internals are still able to use it.

There is a very controversial debate going on...

0 0
17

This is quick guide howto delete/remove/clean old kernels on Fedora, CentOS, Red Hat (RHEL). I use here two kernel as example, if you want to keep other more or less, then adjust amount of installed kernels as you wish. Normally reason why you maybe want remove kernels is limited disk space, example on VPS servers and laptop. This is very easy task, you need yum-utils package.

Check Installed Kernels

rpm -q kernel kernel-2.6.32-279.el6.x86_64 kernel-2.6.32-279.2.1.el6.x86_64 kernel-2.6.32-279.5.2.el6.x86_64 kernel-2.6.32-279.9.1.el6.x86_64

Remove Old Kernels

Enter following command to

remove old kernel

:

## Install yum utils ## yum install yum-utils ## Package-cleanup set count as how many old kernels you want left ## package-cleanup --oldkernels --count=2

Make Amount of Installed Kernels Permanent

Edit /etc/yum.conf and set installonly_limit:

installonly_limit=2

If you liked this post please share it with your friends on the social...

0 0
18

Any physical sport leaves the possibility of getting injured. Any form of football has people getting injured, some seriously. So it can be unsafe, though the majority of the time there are no real dangers. Any physical sport leaves the possibility of getting injured. Any form of football has people getting injured, some seriously. So it can be unsafe, though the majority of the time there are no real dangers. Any physical sport leaves the possibility of getting injured. Any form of football has people getting injured, some seriously. So it can be unsafe, though the majority of the time there are no real dangers. Any physical sport leaves the possibility of getting injured. Any form of football has people getting injured, some seriously. So it can be unsafe, though the majority of the time there are no real dangers. Any physical sport leaves the possibility of getting injured. Any form of football has people getting injured, some seriously. So it can be unsafe, though the majority...

0 0
19
On Sat, Oct 27, 2012 at 01:03:14AM +0200, Minas wrote: > So the delete keyword has been deprecated - so good bye manual memory management... Um, that's a misconception. If you want manual memory management, use malloc(), free(), and emplace. > I have read in some threads that delete is an unsafe operation. What does this exactly mean? What is unsafe about it? What does it have to do with the GC? (if there was no garbage collection, would it be unsafe?) The problem is that you can call delete on GC'd objects, which in some cases causes bad interaction with the GC. That's why it has been deprecated. The intention was never to get rid of manual memory management. It was to prevent unsafe interactions with the GC. If you don't want to use the GC, use malloc(), free(), and emplace. (In fact, this way you can have *both* GC and manual memory management. The emplace()'d objects will be manually managed, and the others will be collected by the GC.) ...
0 0
20


but uname -a shows only an active kernel, it doesn't show all installed kernels.

perhaps:

Code:

linux:~# dpkg -l | grep linux-image ii linux-image-2.6.18-4-686 2.6.18.dfsg.1-12etch2 Linux 2.6.18 image on PPro/Celeron/PII/PIII/P4 ii linux-image-2.6.18-5-686 2.6.18.dfsg.1-13etch1 Linux 2.6.18 image on PPro/Celeron/PII/PIII/P4 linux:~#

I think the command you're looking for is

dpkg-query

, type:

man dpkg-query

to find how to use it.

I never keep a bloated system, which means I always get rid of the previous kernel, headers and kbuild packages related to that kernel(s). If I don't like the new kernel (which happened the other day when I could not install vmware-tools with the 2.6.22 kernel in Debian testing guest OS), I reinstall the previous kernel and remove the other, since I always keep all downloaded packages, only...

0 0
21

Anyone that does design or development (or even writing, really) as either a hobby or for a living knows that feeling of going back and looking at their old work – and cringing.

We know that we’re making progress in our work when we look at something we once did and think “What was I doing?”

The funny thing is, whatever we’re designing, developing, or writing today is going to be treated that way sometime in the not-so-distant future, right?

I digress on that point.

Anyway, for me, one of the things that I find myself debating is how long I should keep some of my open source code repositories around.

Delete Old Repositories Or No?

Here’s the thing: Open repositories serve as a bit of a paper trail of the work that we’ve done, and they also give us a place to help others out by showing how we’ve solved problems that they’re likely encountering.

Unfortunately, much of what we do can become outdated either because we’ve gotten better...

0 0
22

If you’ve using Ubuntu for a period of time, you may have old kernels that are no longer useful on your system. It may be annoying to have these kernel entries in Grub boot menu. So here’s how to remove the old kernels in Ubuntu 13.10 Saucy, Ubuntu 13.04 Raring.

The efficient way to do the job is using the Ubuntu Tweak, which lists all un-used kernels and gives an option at right-bottom corner to clean them up.

To install Ubuntu Tweak, download the DEB package in the right sidebar of this page. Then double-click to install via Ubuntu Software Center.

At the moment, Ubuntu Tweak is not ready for Ubuntu 13.10 Saucy. So below is the command line way:

1.) Press Ctrl+Alt+T to open terminal for running commands. Check current running kernel version.

uname -r

Don’t remove this kernel!

2.) Copy and paste below command and hit run to check list of installed Kernels on your system:

dpkg --list | grep linux-image

3.) Find out the kernels...

0 0
23

How to delete old Kernels in Ubuntu; Remove old Kernels in Ubuntu Linux. On Ubuntu, first list the installed Kernels and then remove old Kernels via CLI/Terminal.

Remove Leftover Temp Files

Run the following command to delete leftover temporary files.

sudo rm -rv ${TMPDIR:-/var/tmp}/mkinitramfs-*

Step 1

Find out the current version of Linux kernel being used on the system and then list all installed kernels on the said system. To do so, run the following set of commands:

$ uname -sr
$ dpkg -l | grep linux-image | awk '{print$2}'

Step 2

Run the following command to list all the kernels excluding the booted kernel in the package database, and their status.

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

Remove Old Kernels

Once the Kernel to be removed is identified, run the following commands. For the example, we will remove Linux Kernel...

0 0
24

Old Linux kernels can take up a considerable amount of disk space. Apt ("sudo apt-get autoremove") tries to remove uneeded packages, including old Linux kernels, but it may fail to remove all of them.

Apt may fail to remove old Linux kernels when using an Ubuntu version that's under development, if you encounter

THIS

bug (which still occurs in Trusty), or if you've installed the kernels manually.


There are various commands out there for mass removing old Linux kernels, but they complicated (and hard to remember), and not all are safe. So what's the safest way of mass purging old Linux kernels in Ubuntu? Well,

according

to Dustin Kirkland, it's the "purge-old-kernels" command.



The

purge-old-kernelsman page

mentions that the command will never remove the currently running kernel. Also, by default, it will keep at least the latest 2 kernels, but you can override this using the "--keep" parameter (for instance "--keep 1" to...

0 0
25

It's actually kind of required to implement any kind of data structure that allocates more memory than minimally required for the number of elements inserted (i.e., anything other than a linked structure which allocates one node at a time).

Take containers like unordered_map, vector, or deque. These all allocate more memory than is minimally required for the elements you've inserted so far to avoid requiring a heap allocation for every single insertion. Let's use vector as the simplest example.

When you do:

vector vec; // Allocate memory for a thousand Foos: vec.reserve(1000);

... that doesn't actually construct a thousand Foos. It simply allocates/reserves memory for them. If vector did not use placement new here, it would be default-constructing Foos all over the place as well as having to invoke their destructors even for elements you never even inserted in the first place.

Allocation != Construction, Freeing != Destruction

Just generally...

0 0
26
...
0 0
27

Bioset on my computer seems to be embedded in the kernel. It starts with a parent process of 2. It encyrpts all internal communication.

Previously, I caught hacker on my serial terminal. After digging around it seems that I had been compromised by several items. Maybe windigo and ebuny. Trojanish type.

I can connect to the internet with low priv user, root connects to keyserver, and soon I have lots of dns/udp processes and kernel sockets open up.

This guy loves communication with udp packets to its primary servers.

Just letting you know my experience. Also if you are connecting to servers, you should remove all your local private keys and update your server keys. It spreads by via ssh.

Recommend everyone install ids, auditd, and configure their firefox really well. It has been a learning curve for...

0 0
28

Advertisement

The Raspberry Pi 2 5 Things You Can't Do With Raspberry Pi 2 was released in 2015 and brings improved speed and processing power to the line of computers first launched in 2012. If you don’t own one of these computers and you have children of a suitable age, you need to seriously think about bringing one home.

Put simply, the Raspberry Pi could transform your child’s life.

Don’t believe me? That’s okay, I’ve outlined five reasons below that explain why.

It’s the LEGO of Computers

Buying the bare Raspberry Pi board will give your children lots of fun, but they’ll be left with an exposed circuit board that could do with a case. Bringing the construction of a case into the equation is a good idea, and is the basis of the Kano kit Kano: The DIY Computer For Kids To Code and Learn (Review and Competition) , which we reviewed in April...

0 0