Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
231
rated 0 times [  231] [ 0]  / answers: 1 / hits: 231262  / 2 Years ago, sun, february 6, 2022, 5:27:57

I'm getting an error in software updater when I try and do my daily updates. it says:



The upgrade needs a total of 25.3 M free space on disk `/boot`.
Please free at least an additional 25.3 M of disk space on `/boot`.
Empty your trash and remove temporary packages of former installations
using `sudo apt-get clean`.


I tried typing in sudo apt-get clean into the Terminal but I still get the message. All of the pages I read seem to be for experienced Ubuntuers. I'm running Ubuntu 12.10. I want to upgrade to 13.04 but understand I have to finish these first.



This is the output from typing in cat /etc/fstab into the Terminal:



# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/ubuntu-root / ext4 errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=fa55c082-112d-4b10-bcf3-e7ffec6cebbc /boot ext2 defaults 0 2
/dev/mapper/ubuntu-swap_1 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
matty@matty-G41M-ES2L:~$


Output of df -h:



Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu-root 915G 27G 842G 4% /
udev 984M 4.0K 984M 1% /dev
tmpfs 397M 1.1M 396M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 992M 1.8M 990M 1% /run/shm
none 100M 52K 100M 1% /run/user
/dev/sda1 228M 222M 0 100% /boot
matty@matty-G41M-ES2L:~$


And dpkg -l | grep linux-image gives:



ii linux-image-3.5.0-17-generic 3.5.0-17.28 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-18-generic 3.5.0-18.29 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-19-generic 3.5.0-19.30 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-21-generic 3.5.0-21.32 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-22-generic 3.5.0-22.34 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-23-generic 3.5.0-23.35 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-24-generic 3.5.0-24.37 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-25-generic 3.5.0-25.39 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
ii linux-image-3.5.0-26-generic 3.5.0-26.42 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP
iF linux-image-3.5.0-28-generic 3.5.0-28.48 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP

More From » apt

 Answers
5

Note: this answer is meant to be more of an 'explanation' than providing the best/easiest way to remove old kernels. For the best/easiest way to remove old kernels, please review the other answers.




Okay, so from the output of /etc/fstab you posted, it seems that your /boot is mounted on a separate partition, and from the output of df -h, that partition is full. This is because there are old kernels installed that are not needed; you can tell that by looking at the output of dpkg -l | grep linux-image that you posted, where you can see more than one "linux-image" with different versions. We need to remove the old versions.



First, I want you to run the command uname -r in a terminal, this will show you the kernel version you are currently using. We never want to remove that kernel version. The command will say something like this 3.5.0-26-generic. Take a note of that number, 26! The following commands will assume that that's the kernel you're running.



The command to remove an old kernel version is:



sudo apt-get purge linux-image-x.x.x-xx-generic


...where the x characters are numbers. So, in your case, because you have a lot of old versions (17, 18, 19, etc...), we would have to run this command for each of the versions, like this:




  • sudo apt-get purge linux-image-3.5.0-17-generic

  • sudo apt-get purge linux-image-3.5.0-18-generic

  • sudo apt-get purge linux-image-3.5.0-19-generic



...and so on. But, there's a way to do all of this through one command. The command is this (DO NOT RUN THE COMMAND YET! Read the following. ):



sudo apt-get purge linux-image-3.5.0-{17,18,19,21,22,23,24}-generic


This command will remove the versions mentioned in the brackets. I didn't include versions 25, 26 and 28 because of the following reasons:




  • Didn't include 26 obviously because that is the kernel version you are currently running! That's the version we got from the command uname -r, remember? We never want to remove that!

  • Didn't include 28 because that's the one that your upgrade was trying to upgrade to (you can tell that from the iF status next it, meaning that it's "half configured").

  • Didn't include 25 because it is usually good practice to leave at least one old version. So since you're running 26, we'll keep 25, so we won't include it in the command above.



So if the last number in uname -r is 26 (or 28, or even 25), then it's safe to run the above command. Enter your password when prompted, and type y when asked. This will show a bunch of lines, and will eventually go back to the command prompt (in your case, matty@matty-G41M-ES2L:~$), hopefully without errors. When it's done, do df -h and look at the last line, the one that starts with /dev/sda1. You should find that it now has more space, and that the percentage used is less than 100% like it was before. You can now proceed with your update again.


[#31106] Monday, February 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fieldcheon

Total Points: 24
Total Questions: 105
Total Answers: 109

Location: Western Sahara
Member since Tue, Feb 16, 2021
3 Years ago
;