[Solved] /boot partition has no space.

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Tuxkid

[Solved] /boot partition has no space.

Post by Tuxkid »

When I installed Linux Mint 17.2, it configured /boot with only 100 Mb of space. Since each new kernel update keeps previous ones, there is no space for anything new since 4.4.0-127.. How do I go about removing stale kernels?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: /boot partition has no space.

Post by gm10 »

If you only installed kernels via the Update Manager then you can use it to remove them, go View > Linux kernels, click each one and select remove except for those you want to keep. If you installed kernels via other sources then you'll probably have to remove them in other ways, e.g. Synaptic or apt-get.

Once you install a new version of Mint I suggest not to have a separate /boot partition, there's no good reason for it these days.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: /boot partition has no space.

Post by Flemur »

Tuxkid wrote: Fri Jul 20, 2018 6:07 amWhen I installed Linux Mint 17.2, it configured /boot with only 100 Mb of space.
That's not big enough for more than one kernel.
Since each new kernel update keeps previous ones,
I'm pretty sure that's wrong.
there is no space for anything new since 4.4.0-127.. How do I go about removing stale kernels?
To change/update kernels you'll have to make /boot larger or do some hacking, like move the files somewhere else and makes links to them.

Edit: after you enlarge the /boot partition, you should probably

Code: Select all

sudo grub-install /dev/sda  # (PROBABLY sda = the DISK, not partition, you want to boot from)
sudo update-grub
because grub needs to know where the start of the /boot partition.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Tuxkid

Re: /boot partition has no space.

Post by Tuxkid »

Flemur wrote: Fri Jul 20, 2018 11:55 am
Tuxkid wrote: Fri Jul 20, 2018 6:07 amWhen I installed Linux Mint 17.2, it configured /boot with only 100 Mb of space.
That's not big enough for more than one kernel.
I didn't set the size. The setup gui didn't offer such a choice. But I made a mistake. It's not quite as small as I indicated. 236 Mb, not 100Mb which is still too small. I notice that LM 17.3 makes 15Gb so that installation should have no such problem.
Since each new kernel update keeps previous ones,
I'm pretty sure that's wrong.
I updated the kernel when aptitude updated packages. Maybe there's an option to remove stale kernels but it's not the default with aptitude safe-upgrade.
there is no space for anything new since 4.4.0-127.. How do I go about removing stale kernels?
To change/update kernels you'll have to make /boot larger or do some hacking, like move the files somewhere else and makes links to them.

Edit: after you enlarge the /boot partition, you should probably

Code: Select all

sudo grub-install /dev/sda  # (PROBABLY sda = the DISK, not partition, you want to boot from)
sudo update-grub
because grub needs to know where the start of the /boot partition.
I'd prefer to avoid the process of copying files and linking to them to get the partition larger -- too much room for error for me with limited skill. I'd prefer to enlarge the partition if it's safe to do so with gparted? Or do I still need to copy everything to a temporary place, then copy them back after /boot has been enlarged?
User avatar
JerryF
Level 16
Level 16
Posts: 6564
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: /boot partition has no space.

Post by JerryF »

Tuxkid wrote: Fri Jul 20, 2018 6:07 am When I installed Linux Mint 17.2, it configured /boot with only 100 Mb of space. Since each new kernel update keeps previous ones, there is no space for anything new since 4.4.0-127.. How do I go about removing stale kernels?
I have installed 17.2 many times and it does not create a /boot partition automatically. You would have had to create it with the Something else option.

Yes, anytime that you install a newer kernel, the older one remains so that you can boot using that older one just in case you can't boot using the newer one.

I usually keep 2 kernels. If and when I install a new kernel, I immediately delete the oldest one which leaves the previous kernel that I was using just in case I need to boot using the previous kernel.

If you're going to use Gparted, run it from a live USB/DVD and before doing that, make sure you backup important files.
Flemur wrote: Fri Jul 20, 2018 11:55 am
Edit: after you enlarge the /boot partition, you should probably

Code: Select all

sudo grub-install /dev/sda  # (PROBABLY sda = the DISK, not partition, you want to boot from)
sudo update-grub
because grub needs to know where the start of the /boot partition.
If I not mistaken, Grub placement will depend on how the disk is set up and if it's MBR or GPT.
Tuxkid

Re: /boot partition has no space.

Post by Tuxkid »

JerryF wrote: Fri Jul 20, 2018 10:40 pm
Tuxkid wrote: Fri Jul 20, 2018 6:07 am When I installed Linux Mint 17.2, it configured /boot with only 100 Mb of space. Since each new kernel update keeps previous ones, there is no space for anything new since 4.4.0-127.. How do I go about removing stale kernels?
I have installed 17.2 many times and it does not create a /boot partition automatically. You would have had to create it with the Something else option.
OK, I stand corrected. My memory of the process is lacking.
Yes, anytime that you install a newer kernel, the older one remains so that you can boot using that older one just in case you can't boot using the newer one.

I usually keep 2 kernels. If and when I install a new kernel, I immediately delete the oldest one which leaves the previous kernel that I was using just in case I need to boot using the previous kernel.
I like that approach. Just how did you go about deleting the oldest one? Is it a simple matter of

Code: Select all

 aptitude delete initrd.img-4.4.0-124-generic?
Is that the appropriate way to specify the target kernel? Will that take care of the vmlinuz*, abi*, config* etc files? That would be more straightforward than modifying the partition size.

Thanks for all the help.
gm10

Re: /boot partition has no space.

Post by gm10 »

Tuxkid wrote: Fri Jul 20, 2018 11:48 pm I like that approach. Just how did you go about deleting the oldest one? Is it a simple matter of

Code: Select all

 aptitude delete initrd.img-4.4.0-124-generic?
Is that the appropriate way to specify the target kernel? Will that take care of the vmlinuz*, abi*, config* etc files? That would be more straightforward than modifying the partition size.

Thanks for all the help.
No, never try it like that (not that it would work, but still, never try to remove those files manually). The easiest and safest way on Mint to remove a kernel is to do it through the Update Manager > View > Linux kernels, click the one you want to remove and click on Remove.
Tuxkid

Re: /boot partition has no space.

Post by Tuxkid »

gm10 wrote: Sat Jul 21, 2018 4:14 am
Tuxkid wrote: Fri Jul 20, 2018 11:48 pm I like that approach. Just how did you go about deleting the oldest one? Is it a simple matter of

Code: Select all

 aptitude delete initrd.img-4.4.0-124-generic?
Is that the appropriate way to specify the target kernel? Will that take care of the vmlinuz*, abi*, config* etc files? That would be more straightforward than modifying the partition size.

Thanks for all the help.
No, never try it like that (not that it would work, but still, never try to remove those files manually). The easiest and safest way on Mint to remove a kernel is to do it through the Update Manager > View > Linux kernels, click the one you want to remove and click on Remove.
I was led to understand that the Update Manager was appropriate only when it was used to install them. Otherwise, I should use apt or Synaptic. Is that not the case?

I'm having difficulty understanding the connection between what's visible to the Update Manager and what's in /boot/ such as

Code: Select all

-rw-r--r--  1 root root  6572944 Jan  6  2016 vmlinuz-3.19.0-32-generic
-rw-------  1 root root  7013728 Jan 24 12:00 vmlinuz-4.4.0-112-generic
-rw-------  1 root root  7041440 Feb 16 23:58 vmlinuz-4.4.0-116-generic
-rw-------  1 root root  7049120 Apr  3 07:39 vmlinuz-4.4.0-119-generic
-rw-------  1 root root  7053328 May 20 04:29 vmlinuz-4.4.0-127-generic
-rw-------  1 root root  7057968 Jun 15 02:53 vmlinuz-4.4.0-130-generic
I thought that meant those ending in 112, 116, 119, 127, 130 were
installed, but Update Manager also has one ending in 124 (which is
labelled as 'loaded'). So the loaded one doesn't appear in /boot?
Added to that, 127, 128 and 130 are listed but not installed.

What am I not understanding about /boot?
gm10

Re: /boot partition has no space.

Post by gm10 »

Tuxkid wrote: Sat Jul 21, 2018 5:40 am I was led to understand that the Update Manager was appropriate only when it was used to install them. Otherwise, I should use apt or Synaptic. Is that not the case?
As long as a kernel shows up in Update Manager's Linux kernels window, it's safe to remove it that way. There are some kernels that would not show up in Update Manager due to the way it detects them, that's when you'd need to use apt or Synaptic.

That said, old kernels that you originally installed via apt or Synaptic can be automatically removed via sudo apt-get autoremove --purge. Feel free to try it. Due to the way Update Manager installs kernels that command won't work for those though.
Tuxkid wrote: Sat Jul 21, 2018 5:40 am I'm having difficulty understanding the connection between what's visible to the Update Manager and what's in /boot/ such as

Code: Select all

-rw-r--r--  1 root root  6572944 Jan  6  2016 vmlinuz-3.19.0-32-generic
-rw-------  1 root root  7013728 Jan 24 12:00 vmlinuz-4.4.0-112-generic
-rw-------  1 root root  7041440 Feb 16 23:58 vmlinuz-4.4.0-116-generic
-rw-------  1 root root  7049120 Apr  3 07:39 vmlinuz-4.4.0-119-generic
-rw-------  1 root root  7053328 May 20 04:29 vmlinuz-4.4.0-127-generic
-rw-------  1 root root  7057968 Jun 15 02:53 vmlinuz-4.4.0-130-generic
I thought that meant those ending in 112, 116, 119, 127, 130 were
installed, but Update Manager also has one ending in 124 (which is
labelled as 'loaded'). So the loaded one doesn't appear in /boot?
Added to that, 127, 128 and 130 are listed but not installed.

What am I not understanding about /boot?
If it lists one as loaded, that probably means that it's the kernel that's currently in use. The command uname -r will tell you for sure. The command ls -l /vmlinuz will tell you where the current default kernel is located.

Never ever try to remove the currently active kernel. All the others are free game. If removing them via Update Manager does not work, open up Synaptic and in the sections list select "Kernel and modules". Installed packages are marked with a green square in front. You can now right-click and mark for complete removal every installed package in the "Kernel and modules" section that meets two conditions:
  1. It has a version number in the name ("Package" column)
  2. The version number ("Installed Version" column) is different from the one output by the uname -r command. Note that if the command outputs something like 4.4.0-130-generic and the "Installed Version" column says 4.4.0-130.156 or 4.4.0.130.156, that's still the same version. 4.4.0-127.153 would be a different version.
There is a possibility that the removal of some packages fails due to lack of space in /boot, but we'll talk about that should it happen.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: /boot partition has no space.

Post by Flemur »

Tuxkid wrote: Sat Jul 21, 2018 5:40 amI'm having difficulty understanding the connection between what's visible to the Update Manager and what's in /boot/ such as

Code: Select all

-rw-r--r--  1 root root  6572944 Jan  6  2016 vmlinuz-3.19.0-32-generic
-rw-------  1 root root  7013728 Jan 24 12:00 vmlinuz-4.4.0-112-generic
...
What am I not understanding about /boot?
Here's what I don't understand about it: you said /boot was 100Meg, which isn't enough space for two kernels, yet you have parts of six kernels in /boot...what do these commands return?

Code: Select all

df | grep boot
ls -lh /boot
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
JerryF
Level 16
Level 16
Posts: 6564
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: /boot partition has no space.

Post by JerryF »

Tuxkid wrote: Fri Jul 20, 2018 11:48 pm
JerryF wrote: Fri Jul 20, 2018 10:40 pm Yes, anytime that you install a newer kernel, the older one remains so that you can boot using that older one just in case you can't boot using the newer one.

I usually keep 2 kernels. If and when I install a new kernel, I immediately delete the oldest one which leaves the previous kernel that I was using just in case I need to boot using the previous kernel.
I like that approach. Just how did you go about deleting the oldest one?
...

Thanks for all the help.
I use Update Manager, just as gm10 posted.
User avatar
JerryF
Level 16
Level 16
Posts: 6564
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: /boot partition has no space.

Post by JerryF »

Flemur wrote: Sat Jul 21, 2018 9:46 am ...
Here's what I don't understand about it: you said /boot was 100Meg, which isn't enough space for two kernels, yet you have parts of six kernels in /boot...
Tuxkid later mentioned that there's ~236 MB, not 100.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: /boot partition has no space.

Post by Flemur »

JerryF wrote: Sat Jul 21, 2018 10:36 amTuxkid later mentioned that there's ~236 MB, not 100.
Oops - but it's still not enough room for six kernels (he has at least part of six kernels there), which are > 55Meg each.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
JerryF
Level 16
Level 16
Posts: 6564
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: /boot partition has no space.

Post by JerryF »

Flemur wrote: Sat Jul 21, 2018 2:43 pm
JerryF wrote: Sat Jul 21, 2018 10:36 amTuxkid later mentioned that there's ~236 MB, not 100.
Oops - but it's still not enough room for six kernels (he has at least part of six kernels there), which are > 55Meg each.
Ah! :oops:
DAMIEN1307

Re: /boot partition has no space.

Post by DAMIEN1307 »

See if this doesnt remove stubborn leftover residual garbage from deleted kernels:...DAMIEN

Kernel Cleanup after Deletion

do these one at a time, dont worry if the first dpkg -l says error etc...just means nothing is there is all:

sudo apt autoremove

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

dpkg -l | grep '^rc' | awk '{print $2}' | xargs sudo apt-get purge

dpkg --get-selections | grep linux-headers && dpkg --get-selections | grep linux-image

then reboot a couple of times.
Tuxkid

Re: /boot partition has no space.

Post by Tuxkid »

gm10 wrote: Sat Jul 21, 2018 6:28 am
If it lists one as loaded, that probably means that it's the kernel that's currently in use. The command uname -r will tell you for sure. The command ls -l /vmlinuz will tell you where the current default kernel is located.

Never ever try to remove the currently active kernel. All the others are free game. If removing them via Update Manager does not work, open up Synaptic and in the sections list select "Kernel and modules". Installed packages are marked with a green square in front. You can now right-click and mark for complete removal every installed package in the "Kernel and modules" section that meets two conditions:
  1. It has a version number in the name ("Package" column)
  2. The version number ("Installed Version" column) is different from the one output by the uname -r command. Note that if the command outputs something like 4.4.0-130-generic and the "Installed Version" column says 4.4.0-130.156 or 4.4.0.130.156, that's still the same version. 4.4.0-127.153 would be a different version.
There is a possibility that the removal of some packages fails due to lack of space in /boot, but we'll talk about that should it happen.
Many thanks for that information. It didn't go very smoothly. I got a message

Code: Select all


E: linux-image-extra-4.4.0-127-generic: subprocess installed post-removal script returned error exit status 1

E: linux-image-extra-4.4.0-111-generic: subprocess installed post-removal script returned error exit status 1
when I attempted to delete 4.4.0-111. It appears to me that 127 was garbage and it needed to be deleted before 111 could be deleted. However, despite that, I was able to clear initrd.img-3.16.0-38-generic without any complaint.

I have managed to clear 87Mb for my /boot partition, and can make more space since I know how.

Thanks to the many contributors to this discussion. It has been immeasurably useful to me.
gm10

Re: /boot partition has no space.

Post by gm10 »

Tuxkid wrote: Sun Jul 22, 2018 2:16 am Many thanks for that information. It didn't go very smoothly. I got a message

Code: Select all


E: linux-image-extra-4.4.0-127-generic: subprocess installed post-removal script returned error exit status 1

E: linux-image-extra-4.4.0-111-generic: subprocess installed post-removal script returned error exit status 1
when I attempted to delete 4.4.0-111. It appears to me that 127 was garbage and it needed to be deleted before 111 could be deleted. However, despite that, I was able to clear initrd.img-3.16.0-38-generic without any complaint.
Ok, no problem, this wasn't entirely unexpected due to the lack of free space. You might be able to remove those above normally now since you cleared one of them, but otherwise see if this works:

Code: Select all

sudo update-initramfs -d -k 4.4.0-127-generic
sudo update-initramfs -d -k 4.4.0-111-generic
sudo dpkg -P linux-image-4.4.0-127-generic linux-image-extra-4.4.0-127-generic
sudo dpkg -P linux-image-4.4.0-111-generic linux-image-extra-4.4.0-111-generic
If the last two commands worked then do:

Code: Select all

sudo apt-get -f install
sudo apt-get autoremove
sudo update-grub
If it didn't work and fails on the post-removal script again, let me know and we'll simply temporarily disable that script and try again.
Tuxkid

Re: /boot partition has no space.

Post by Tuxkid »

gm10 wrote: Sun Jul 22, 2018 3:24 am
Ok, no problem, this wasn't entirely unexpected due to the lack of free space. You might be able to remove those above normally now since you cleared one of them, but otherwise see if this works:

Code: Select all

sudo update-initramfs -d -k 4.4.0-127-generic
sudo update-initramfs -d -k 4.4.0-111-generic
sudo dpkg -P linux-image-4.4.0-127-generic linux-image-extra-4.4.0-127-generic
sudo dpkg -P linux-image-4.4.0-111-generic linux-image-extra-4.4.0-111-generic
If the last two commands worked then do:

Code: Select all

sudo apt-get -f install
sudo apt-get autoremove
sudo update-grub
If it didn't work and fails on the post-removal script again, let me know and we'll simply temporarily disable that script and try again.
4.4.0-127 still appears in /boot.

Code: Select all

-rw------- 1 root root  7045024 Apr 17 10:10 vmlinuz-4.4.0-121-generic
-rw------- 1 root root  7046048 May  3 21:25 vmlinuz-4.4.0-124-generic
-rw------- 1 root root  7053328 May 20 04:29 vmlinuz-4.4.0-127-generic
I got this message (along with a lot else):

Code: Select all


nvidia_340_uvm.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-127-generic/kernel/drivers/video/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.
dkms: removing: virtualbox-guest 4.3.36 (4.4.0-127-generic) (x86_64)
That would explain why I had difficulty with (VirtualBox.)

Does that complicate matters?
gm10

Re: [Solved] /boot partition has no space.

Post by gm10 »

Shouldn't be a problem.

Did you get that post-removal script error message again though? That was the immediate thing I wanted to fix with those commands. If you didn't, then you should now be able to remove the remaining kernel packages via Synaptic. We'll clean up whatever is left manually afterwards, if anything.
Tuxkid

Re: [Solved] /boot partition has no space.

Post by Tuxkid »

gm10 wrote: Mon Jul 23, 2018 4:36 am Shouldn't be a problem.

Did you get that post-removal script error message again though? That was the immediate thing I wanted to fix with those commands. If you didn't, then you should now be able to remove the remaining kernel packages via Synaptic. We'll clean up whatever is left manually afterwards, if anything.
No. There is only 121 and 124 present and I have 140Mb of space on that partition.

Do I need to update grub again?

Thanks for all the help.
Locked

Return to “Installation & Boot”