Ran my commands to remove unused old kernels on my new (to me) lubuntu 16.04 server and got a BIG surprise. Each kernel generation on this 64-bit system takes up nearly 300 MB. So keeping three kernel generations costs a hefty 1 GB of space. I am going to cut back my "keep margin" to 3 generations (I used to keep 5 on my old HDD based system). This system is booting from an old spare 16GB SSD that I had left over from a chromebook upgrade a while back. I've run into space issues twice already for unrelated reasons which I've already solved by moving these issues off to other non-boot partitions on other larger rotating magnetic HDD's
Here is the command line and output content (I highlighted the part that got my attention):
$ sudo apt-get purge linux-image-4.4.0-{24,22}-generic linux-headers-4.4.0-{24,22} linux-headers-4.4.0-{24,22}-generic
[sudo] password for user:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
tim@tim-HP-Compaq-Elite-8300-SFF:~$ sudo apt-get purge linux-image-4.4.0-{24,22}-generic linux-headers-4.4.0-{24,22} linux-headers-4.4.0-{24,22}-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libclass-data-inheritable-perl libcommon-sense-perl
libcrypt-openssl-bignum-perl libcrypt-openssl-rsa-perl libdata-random-perl
libdigest-hmac-perl libextutils-depends-perl libextutils-pkgconfig-perl
libfile-basedir-perl libfile-which-perl libgd-perl libgnome2-canvas-perl
libgnome2-gconf-perl libgnome2-perl libgnome2-vfs-perl libgnome2-wnck-perl
libgoo-canvas-perl libgoocanvas-common libgoocanvas3
libgtk2-appindicator-perl libgtk2-imageview-perl libgtk2-unique-perl
libgtkimageview0 libhttp-server-simple-perl libimage-magick-perl
libimage-magick-q16-perl libipc-system-simple-perl libjson-perl
libjson-xs-perl libmouse-perl libnet-dropbox-api-perl libnet-oauth-perl
libpath-class-perl libproc-processtable-perl libproc-simple-perl
libsort-naturally-perl libtypes-serialiser-perl libunique-1.0-0
libwww-mechanize-perl linux-headers-4.4.0-28 linux-headers-4.4.0-28-generic
linux-image-4.4.0-28-generic linux-image-extra-4.4.0-28-generic perlmagick
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
linux-headers-4.4.0-22* linux-headers-4.4.0-22-generic*
linux-headers-4.4.0-24* linux-headers-4.4.0-24-generic*
linux-image-4.4.0-22-generic* linux-image-4.4.0-24-generic*
linux-image-extra-4.4.0-22-generic* linux-image-extra-4.4.0-24-generic*
0 upgraded, 0 newly installed, 8 to remove and 10 not upgraded.
After this operation, 590 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 364617 files and directories currently installed.)
Removing linux-headers-4.4.0-22-generic (4.4.0-22.40) ...
Removing linux-headers-4.4.0-22 (4.4.0-22.40) ...
Removing linux-headers-4.4.0-24-generic (4.4.0-24.43) ...
Removing linux-headers-4.4.0-24 (4.4.0-24.43) ...
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-28-generic
Found initrd image: /boot/initrd.img-4.4.0-28-generic
Found linux image: /boot/vmlinuz-4.4.0-24-generic
Found initrd image: /boot/initrd.img-4.4.0-24-generic
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sdb1
Found Windows 7 (loader) on /dev/sdb2
Found Windows Recovery Environment (loader) on /dev/sdb3
done
Purging configuration files for linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
Removing linux-image-4.4.0-22-generic (4.4.0-22.40) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-28-generic
Found initrd image: /boot/initrd.img-4.4.0-28-generic
Found linux image: /boot/vmlinuz-4.4.0-24-generic
Found initrd image: /boot/initrd.img-4.4.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sdb1
Found Windows 7 (loader) on /dev/sdb2
Found Windows Recovery Environment (loader) on /dev/sdb3
done
Purging configuration files for linux-image-4.4.0-22-generic (4.4.0-22.40) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Removing linux-image-extra-4.4.0-24-generic (4.4.0-24.43) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-24-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-28-generic
Found initrd image: /boot/initrd.img-4.4.0-28-generic
Found linux image: /boot/vmlinuz-4.4.0-24-generic
Found initrd image: /boot/initrd.img-4.4.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sdb1
Found Windows 7 (loader) on /dev/sdb2
Found Windows Recovery Environment (loader) on /dev/sdb3
done
Purging configuration files for linux-image-extra-4.4.0-24-generic (4.4.0-24.43) ...
Removing linux-image-4.4.0-24-generic (4.4.0-24.43) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-28-generic
Found initrd image: /boot/initrd.img-4.4.0-28-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sdb1
Found Windows 7 (loader) on /dev/sdb2
Found Windows Recovery Environment (loader) on /dev/sdb3
done
Purging configuration files for linux-image-4.4.0-24-generic (4.4.0-24.43) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-24-generic /boot/vmlinuz-4.4.0-24-generic
$
Here is a link to my original post on removing kernels:
http://timbocephus.blogspot.com/2015/11/purging-old-kernels-and-headers-for.html
Featured Post
Friday, August 12, 2016
Subscribe to:
Posts (Atom)
MORE About Me...
My dad called me Timbocephus from time to time when I was growing up. He was a
Hank Williams fan at some point I believe.
Of course everyone recognizes the "Timbo" nickname. But going deeper into mid 20th century popular culture we find that Hank famously stuck the "Bocephus" moniker on his young son Hank Jr. There are several suggested sources for the "Bocephus" and you can find those on line very readily if you google it. Having said that, I like this one Best: The mysterious appelation that became part of American folklore in middle of the last century: Biblical/Latin Etymology: Some trace it back to a neoclassical blend of Beau (French for beautiful) and Cephas (the Aramaic name given to the Apostle Peter, meaning "stone"). [1] (https://gardenandgun.com/ask-gg-garden-thievery-and-the-birth-of-bocephus)
Of course everyone recognizes the "Timbo" nickname. But going deeper into mid 20th century popular culture we find that Hank famously stuck the "Bocephus" moniker on his young son Hank Jr. There are several suggested sources for the "Bocephus" and you can find those on line very readily if you google it. Having said that, I like this one Best: The mysterious appelation that became part of American folklore in middle of the last century: Biblical/Latin Etymology: Some trace it back to a neoclassical blend of Beau (French for beautiful) and Cephas (the Aramaic name given to the Apostle Peter, meaning "stone"). [1] (https://gardenandgun.com/ask-gg-garden-thievery-and-the-birth-of-bocephus)