Results 1 to 5 of 5

Thread: Safely and easily removing old Linux and initrd images.

  1. #1
    Join Date
    Mar 2007
    Beans
    1,325

    Safely and easily removing old Linux and initrd images.

    Whenever I update the kernel and generate a new grub configuration file I get a list of old images like the list below. Often that kernel version has long been removed How can I safely and easily remove these?

    Code:
    Found linux image: /boot/vmlinuz-4.4.0-145-generic
    Found initrd image: /boot/initrd.img-4.4.0-145-generic
    Found linux image: /boot/vmlinuz-4.4.0-142-generic
    Found initrd image: /boot/initrd.img-4.4.0-142-generic
    Found linux image: /boot/vmlinuz-4.4.0-138-generic
    Found initrd image: /boot/initrd.img-4.4.0-138-generic
    Found linux image: /boot/vmlinuz-4.4.0-112-generic
    Found initrd image: /boot/initrd.img-4.4.0-112-generic
    Found linux image: /boot/vmlinuz-4.4.0-103-generic
    Found initrd image: /boot/initrd.img-4.4.0-103-generic
    Found linux image: /boot/vmlinuz-2.6.32-31-generic
    Found initrd image: /boot/initrd.img-2.6.32-31-generic
    Found memtest86+ image: /memtest86+.elf
    Found memtest86+ image: /memtest86+.bin

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safely and easily removing old Linux and initrd images.

    Code:
    sudo apt autoremove
    works on 16.04 and later.
    If it doesn't, post back and there are scripts.

    Removing the left over kernels from prior releases is manual, methinks. Just get the package name and remove it.
    Code:
    dpkg -l |grep linux-image-2.
    will find the 2.6 kernel package name.
    Last edited by TheFu; April 11th, 2019 at 06:55 PM.

  3. #3
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Safely and easily removing old Linux and initrd images.

    Code:
    # apt autoremove
    Doesn't work for these old files. It does work when a new kernel is installed.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safely and easily removing old Linux and initrd images.

    Try, sudo apt-get autoremove linux-image-4.4.0-1[0-3]* linux-image-2.*
    apt-get works with regex.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Safely and easily removing old Linux and initrd images.

    Try, sudo apt-get remove linux-image-4.4.0-1[0-3]* linux-image-2.*
    apt-get works with regex.

    Update: autoremove --> remove above.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •