0

I've been getting these messages right after I boot telling me I don't have enough space in my boot partition anymore. Today I reached a point I can't install anything else because of this. So I started researching how to resize it.

I found I could resize it using gparted, but I can't install it because there's no space left in /boot.

Some people suggested that those who need to clear some space in /boot should remove old kernels, but I have two issues with that: I don't know how to access /boot in the terminal and I'm not completely sure what a kernel is, so I might just as well delete something important or my current kernel, which I know can damage my OS.

What should I do?

3
  • 2
    Please run this first sudo apt autoremove Apr 9, 2017 at 15:48
  • You don't clean kernels manually, you uninstall them. Try @George's suggestion first. In theory it should remove all your old kernels except for the last 2 (including the one you're running). The kernel is the brains that run your hardware and software at the lowest level. Everything else is built on top of it. Think of it as the foundation for your OS
    – Will
    Apr 9, 2017 at 15:54
  • Do you have a separate partition for /boot or for /home or is your OS installed on one partition? If the latter is the case, sudo apt-get autoclean or even sudo apt-get clean would probably help as well. With the option autoclean you remove downloaded packages, that are no longer needed on your system and with the option clean you remove all downloaded packages.
    – jarleih
    Apr 9, 2017 at 17:19

2 Answers 2

1

Moving one installation from one partition to another.

Gparted

  1. Start a CD/DVD like "Parted Magic" or "GParted" "ubuntu"
  2. Start GParted
  3. Check which Partion you would like to copy to another.
  4. For this example I want to copy partition "sda6" to "sda5"
  5. Make sure that the target partition is larger than the source partition. ie. sda5 must be larger than sda6.
  6. Choose (click on) sda6 and choose "copy".
  7. Choose (click on) sda5 and choose "paste".
  8. Click on "Apply" and confirm the warning window.
  9. Gparted starts copy.
  10. Once the copy is finished both sda5 and sda6 will have the same UUID. This is very dangerous so we need to change the UUID on the sda5.
  11. In GParted choose the sda5 partition.
  12. Right click on the sda5 partition and choose "new UUID" from the context menu (also available in the "Partition" top menu)
  13. Click on "Apply" and confirm the warning window. This create's a new random UUID for sda5.

VERY IMPORTANT FROM THIS PONT ON YOU WILL ONLY BE EDITING FILES FROM THE NEW PARTITON "sda5"

DONT CHANGE OR TOUCH ANYTHING ON THE ORIGINAL PARTITION "sda6"

Terminal

  1. Open a terminal
  2. Type in "blkid" or "sudo blkid"
  3. You will notice that sda5 and sda6 have different unique uuid's.
  4. Leave that window open to use for copy and paste.

File Manager. IN sda5

  1. open the file manager and navigate to "/boot/grub/" and click on "grub.cfg" so you can edit it.
  2. You will need root priviliges to edit and save it afterwards

Text editor IN sda5

  1. Highlight the UUID from sda6 from the terminal window (eg. 573323d9-16f0-4517-9050-bd4e26da57b1) and select copy.
  2. Back to the grub.cfg in the text editor . Find the command "replace" or "find and Replace" in the menu. It will open the replace dialog.
  3. Now Paste the UUID of sda6 (eg. 573323d9-16f0-4517-9050-bd4e26da57b1) into the "find" field.
  4. Highlight the UUID from sda5 from the terminal window (eg. 5cbdd14f-5375-4876-8b42-d77a65b4bd81) and select copy.
  5. Now Paste the UUID of sda6 (eg. 5cbdd14f-5375-4876-8b42-d77a65b4bd81) into the "Replace" field.
  6. Important is to Click on "Replace all". Afterwards the UUID of sda6 will be replaced to that of sda5.

Change the Drive number IN sda5

  1. Keep the text editor open so as to change partion number
  2. Choose "replace" or "find and Replace" again.
  3. In the "find" field type "hd0,msdos6"
  4. In the "replace" field type "hd0,msdos5"
  5. Important is to Click on "Replace all". Thereafter sda6 will be replaced by sda5.
  6. Now select "save", to change the changes to the grub.cfg file.

One Last step the "fstab" IN sda5

File Manager. IN sda5

  1. open the file manager and navigate to "/etc/" and click on "fstab" so you can edit it.
  2. Once again you will need root priviliges to edit and save it afterwards.

Text editor IN sda5

  1. Highlight the UUID from sda6 from the terminal window (eg. 573323d9-16f0-4517-9050-bd4e26da57b1) and select copy.

  2. Find the command "replace" or "find and Replace" in the menu. It will open the replace dialog.

  3. Now Paste the UUID of sda6 (eg. 573323d9-16f0-4517-9050-bd4e26da57b1) into the "find" field.

  4. Highlight the UUID from sda5 from the terminal window (eg. 5cbdd14f-5375-4876-8b42-d77a65b4bd81) and select copy.

  5. Now Paste the UUID of sda6 (eg. 5cbdd14f-5375-4876-8b42-d77a65b4bd81) into the "Replace" field.

  6. Important is to Click on "Replace all". Afterwards the UUID of sda6 will be replaced to that of sda5.

AMOST DONE!!!! Reboot Your Computer as normal. You will of course reboot as normal from the sda6 partition.

Terminal.

  1. Start a Terminal 2: execute "sudo update-grub".

REBOOT.

  1. In the GRUB MENU you will notice that it will have an entry for sda5 eg"UBUNTU /dev/sda5".
  2. Start it, and if all goes well you will be booting sda5 and not sda6.

Terminal.

Now to make sda5 our default grub installation

  1. Start a Terminal

  2. execute "sudo grub-install /dev/sda"

3: execute "sudo update-grub".

REBOOT.

  1. In the GRUB MENU you will notice that it will have an entry for sda6 eg"UBUNTU /dev/sda6". This is the old sda6 installation.

  2. Start the first entry "UBUNTU" in GRUB and you will be booting into the new partition in sda5.

THAT'S IT!!!! Enjoy!!

3
  • Gosh this looks so wrong I don't know where to start commenting... how about... you don't manually edit /boot/grub/grub.cfg because it'll get overwritten as soon as you do sudo update-grub? Why are you coping partitions? You assume there's unallocated space on the HD to do that? All the user needs to do is to clear some space in their existing /boot.
    – heynnema
    Apr 9, 2017 at 17:37
  • It's basically From the following website, i just tried to simplify it. help.ubuntu.com/community/MovingLinuxPartition. It works fantastically, especially if you are running out of space.
    – Renver
    Apr 9, 2017 at 18:54
  • Please see help.ubuntu.com/community/MovingLinuxPartition. Sometimes its better to make a larger partition and do a copy than trying to free space. I just tried to simplify the process. I use it frequently and it works great.... Nothing wrong with that!!!
    – Renver
    Apr 9, 2017 at 19:02
0

Run:

$ dpkg -l '*linux-*'
ii  linux-image-4.7.1-040701-generic    4.7.1-040701.201608160432 amd64            Linux kernel image for version 4.7.1 on 64 bit x86 SMP
ii  linux-image-4.8.0-40-lowlatency     4.8.0-40.43               amd64           Linux kernel image for version 4.8.0 on 64 bit x86 SMP
ii  linux-image-4.8.0-41-lowlatency     4.8.0-41.44               amd64        Linux kernel image for version 4.8.0 on 64 bit x86 SMP

All the packages marked with ii are installed. Run:

$ uname -r
4.8.0-41-lowlatency

To see which kernel you are currently using.

Next step is to cleanup all the kernel packages that you aren't currently using, with something like this:

$ sudo apt remove linux-image-4.7.1-040701-generic

Unless you compiled a kernel manually, just removing the packages should clean /boot/ well enough.

In case you go with partitioning/resizing your /boot partition, I would strongly recommend to go with 1GB, you find a lot of recommendation to go with 300-500MB, but in my experience that's simply not enough for a long lived Ubuntu installation. The kernel stack up and Ubuntu doesn't remove them automatically. Manual removal can be annoying, especially when you run out of space in the midst of a larger system upgrade, going with 1GB avoids that and leaves some air. Saving 500MB is not worth the trouble you run into, as you already noticed.

Not the answer you're looking for? Browse other questions tagged .