4

I keep running into the issue of the /boot partition filling up with old kernel images, which causes obscure errors during upgrades (but now I know what they are...).

Note that I already know how to fix this thanks to Ask Ubuntu: here's my favorite answer.

My question is, why does Ubuntu keep doing this, and isn't this a serious design flaw?

In reading questions related to /boot filling up, I have seen comments like "This happens because you assigned a small space for the boot partition or you have UEFI and forgot to increment the space.". However, I have encountered this problem on at least three different Ubuntu installations, spanning versions from 12 to 15, and I have never used anything other than the default install options. I've always done a clean Ubuntu install using the entire disk (no dual-boot), although the drive has usually had something else on it before.

Am I doing something wrong in the install (i.e. an option I should select)? I always assume the default options will be the safest.

Also, even if the install was different (i.e. no /boot, or a larger /boot), wouldn't this still be an issue? (i.e. if old kernel images are never deleted, they are going to eat up the disk space, which seems like a design flaw even if there is plenty of free space).

10
  • The default install option is not to create a separate /boot partition. You probably use encryption. – Pilot6 Jun 10 '16 at 21:41
  • @Pilot6 good point, but since using FDE is an absolutely smart idea, OP is right that the default options (with encryption) create a separate /boot. :) – Andrea Lazzarotto Jun 10 '16 at 21:43
  • Old kernels do get deleted here, not sure who told you they don't. – mikewhatever Jun 10 '16 at 22:28
  • I believe the comment from Pilot6 etc above are inaccurate; I have ended up with a (stupidly small) /boot partition on installs without encryption or LVM (no change to the default options, as I said...). In fact every Ubuntu install I have done has had this issue. Perhaps the installer should have a note on it: "Select this set of options to prevent obscure errors in a few months which will require Google searching and command-line hackery to fix"? – JereCB Jun 11 '16 at 21:04
  • I installed Ubuntu lots of times and I never had a separate /boot partition. It is created only if you choose to encrypt the file system. – Pilot6 Jun 13 '16 at 8:07
3

why does Ubuntu keep doing this?

Short version: safety.

Long version: the kernel is the most important part of an OS. It handles communication between hardware and software, among other things that I won't cover in detail here.

Changing the kernel might give you problems. Most of the time everything goes well, but the one time that something is screwed up you do want to have it working again quickly.

Say you are researching materials for your thesis and the deadline is approaching... suddenly a kernel upgrade breaks your Wi-Fi. Do you prefer to postpone your graduation for saving 150 MB of disk space?

I guess no, you don't want that. Here's why you reboot, select the previous kernel and go on with your work. Things like this don't happen often, but they may happen rarely and on some specific hardware, maybe only for one kernel release.

I actually experienced seeing my parents' PC not accepting any keyboard input after a kernel upgrade (a simple keyboard, not a wireless one). Now, using a PC without a keyboard is not nice.

isn't this a serious design flaw?

Not that serious, since benefits outreach the downsides and nowadays hard drives are basically always bigger than 250 GB. Even with 10 different kernels you would occupy only like 2 GB. Yes it starts to be a waste of space after a while, but not that noticeable. Moreover you can uninstall them manually, they are not locked.

Nevertheless, it's reasonable to say that only the last few kernels are needed. That's why Ubuntu 16.04 Xenial marks as "auto-removable" the old kernels, except the last 2.

I always assume the default options will be the safest

Indeed, your assumption is correct. Ubuntu won't never let you blindly overwrite your kernel without any backup solution.

8
  • 2
    I agree that it's a good idea to keep old kernels, but I think it should be limited to maybe two; I am glad to hear that it's a Ubuntu 16 fixes this; does "auto-removable" actually mean they will disappear by themselves? Also, the /boot partition should really be bigger. – JereCB Jun 11 '16 at 21:07
  • 2
    «does "auto-removable" actually mean they will disappear by themselves?» Software does not disappear by itself. You can, however, schedule a apt-get autoremove to happen daily or weekly and it will take care of it. – Andrea Lazzarotto Jun 11 '16 at 22:12
  • BTW thanks for your answer... it's good in terms of explaining the issue, but I still feel unsatisfied. I feel this problem will occur for other users and there is no clear answer as to how to prevent it. Some people want to just use the computer, and not wear a sys admin hat or hack around with the terminal. It's unfair to say "it's your fault for creating a small /boot partition" when the installer doesn't explain the options. I certainly never selected the "create a small /boot partition that requires frequent maintenance" option. – JereCB Jun 14 '16 at 9:12
  • 1
    @JereCB: +1 on yr question and on the accepted answer too. The pbm happens to many. I regularly see my separate 650 MB boot partition fill up completely with old kernel images and I have to regularly go and clean the mess up. I prefer to do so manually to control what is going on, although I could just as easily automate this with a small script and a cron job. Today, for instance, with 0% space left on my boot partition, I cleaned up 11 old kernel images (complete with headers) and that removed more than 36000 (small files) from my system. (I still run Trusty 14.04.5 on my 3 boxes.) – Cbhihe Apr 5 '17 at 20:34
  • +1 The fact that Ubuntu 16.04 Xenial has taken stock of the issue and now automatically deals with the clutter is good. Thanks for pointing this out. – Cbhihe Apr 5 '17 at 20:35
0

It is the user that is responsible for removing old, unneeded kernels. So is it also the admins task to keep an eye on free space. So no, I disagree that this is a problem, a security issue or a design flaw.

There is a method to automatically delete kernels but the debian and/or ubuntu devs consider it problematic to decide what an "unneeded kernel" is so this is not a task they want to make default (... yet).

I myself do not use a /boot so never run into this problem but if you do want one (lvm, encryption) 300Mb should be enough.

3
  • "It is the user that is responsible for removing old, unneeded kernels." – JereCB Jun 11 '16 at 21:07
  • 1
    "It is the user that is responsible for removing old, unneeded kernels." - I actually don't mind doing this, as I have become quite comfortable with the command line. However, to put this in context, I have installed Linux Mint on my parent's PC after Windows 10 imploded. For them, incomprehensible messages must be eliminated and the system needs to run stably with minimal intervention... If having a /boot partition is such an advanced configuration, the installer should make that clear as I never selected any strange options. – JereCB Jun 11 '16 at 21:13
  • PS I don't know how the Mint installer sets things up and I don't even know whether theirs has a /boot (must check next time I look) - I was just using that as an example of a system which needs to be stable and not generate problems for itself! – JereCB Jun 11 '16 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.