This morning I faced a trouble when I turned my Ubuntu 12.04 computer on. Update manager showed up with some updates however when I go ahead to install them, it says I don't have enough space in my /boot partition. After getting crazy for a while and searching in google, I found that I should either resize my /boot partition to provide enough space or remove some unnecessary stuff from the existing /boot partition. Since the stuff in that partition are critical things such as older kernel, I was afraid about removing them. I thought the best solution would be resizing the partition but for that I need to boot the computer with a Ubuntu live CD.
Fortunately or unfortunately, I couldn't find a Ubuntu CD for this purpose at that moment. Therefore, I left my fear behind and decided to try the /boot clearing option. I issued following long command in the terminal which ran for a while printing various outputs and finally ended. At the end, I installed the updates and it worked fine thankfully. The good open source community saved my life :)
The command to remove older kernal files from /boot partition.
sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
References:
[1] http://askubuntu.com/questions/2793/how-do-i-remove-or-hide-old-kernel-versions-to-clean-up-the-boot-menu
[2] http://askubuntu.com/questions/280211/how-do-i-resize-my-boot-partition
No comments:
Post a Comment