How to remove old kernels and headers on linux mint 13

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 5:52 pm

I have Installed Linux Mint 13 Mate 64bit alongside Linux Mint 14 Cinnamon 64bit to replace Linux Mint 14 Mate 64bit. Now I get entries related to the old OS. I have installed Grub-customizer and removed them. But there are other entries that don't show up in Grub Customizer and still appear on tthe grub menu. Is there any command lines that can help me get rid of this mess???

The output of "uname -r" is:
Code: Select all
mohamed@mohamed-Inspiron-N5040 ~ $ uname -r
3.2.0-23-generic
mohamed@mohamed-Inspiron-N5040


The output of "dpkg -l | grep linux-image" is:

Code: Select all
mohamed@mohamed-Inspiron-N5040 ~ $ dpkg -l | grep linux-image
ii  linux-image-3.2.0-23-generic           3.2.0-23.36                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-generic                    3.2.0.23.25                             Generic Linux kernel image
mohamed@mohamed-Inspiron-N5040 ~ $


My /boot//grub/grub-cfg file looks like this:
Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos7)'
  search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
   set gfxpayload="$1"
   if [ "$1" = "keep" ]; then
      set vt_handoff=vt.handoff=7
   else
      set vt_handoff=
   fi
}
if [ ${recordfail} != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Linux Mint 13 MATE 64-bit, 3.2.0-23-generic (/dev/sda7)' --class linuxmint --class gnu-linux --class gnu --class os {
   recordfail
   gfxmode $linux_gfx_mode
   insmod gzio
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos7)'
   search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
   linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=99b2e85d-5b00-4f5e-8df0-22b737dd1c37 ro   quiet splash $vt_handoff
   initrd   /boot/initrd.img-3.2.0-23-generic
}
menuentry 'Linux Mint 13 MATE 64-bit, 3.2.0-23-generic (/dev/sda7) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
   recordfail
   insmod gzio
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos7)'
   search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
   echo   'Loading Linux 3.2.0-23-generic ...'
   linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=99b2e85d-5b00-4f5e-8df0-22b737dd1c37 ro recovery nomodeset
   echo   'Loading initial ramdisk ...'
   initrd   /boot/initrd.img-3.2.0-23-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_lupin ###
### END /etc/grub.d/10_lupin ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos7)'
   search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
   linux16   /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos7)'
   search --no-floppy --fs-uuid --set=root 99b2e85d-5b00-4f5e-8df0-22b737dd1c37
   linux16   /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober_proxy ###
menuentry "Linux Mint 14 MATE 64-bit, 3.5.0-17-generic (/dev/sda7) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos5)'
   search --no-floppy --fs-uuid --set=root af137352-32e8-4d14-ac26-b75086feead6
   linux /boot/vmlinuz-3.5.0-17-generic root=UUID=b90a38ab-e5f8-4787-95ca-41d8673db81d ro quiet splash $vt_handoff
   initrd /boot/initrd.img-3.5.0-17-generic
}
menuentry "Linux Mint 14 Nadia (14) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos5)'
   search --no-floppy --fs-uuid --set=root af137352-32e8-4d14-ac26-b75086feead6
   linux /boot/vmlinuz-3.5.0-17-generic root=UUID=af137352-32e8-4d14-ac26-b75086feead6 ro quiet splash $vt_handoff
   initrd /boot/initrd.img-3.5.0-17-generic
}
menuentry "Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda5) (on /dev/sda5)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos5)'
   search --no-floppy --fs-uuid --set=root af137352-32e8-4d14-ac26-b75086feead6
   linux /boot/vmlinuz-3.5.0-17-generic root=UUID=af137352-32e8-4d14-ac26-b75086feead6 ro quiet splash $vt_handoff
   initrd /boot/initrd.img-3.5.0-17-generic
}
menuentry "Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda5) -- recovery mode (on /dev/sda5)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos5)'
   search --no-floppy --fs-uuid --set=root af137352-32e8-4d14-ac26-b75086feead6
   linux /boot/vmlinuz-3.5.0-17-generic root=UUID=af137352-32e8-4d14-ac26-b75086feead6 ro recovery nomodeset
   initrd /boot/initrd.img-3.5.0-17-generic
}
### END /etc/grub.d/30_os-prober_proxy ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Last edited by Zorba on Sun Apr 28, 2013 6:13 pm, edited 2 times in total.
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Linux Mint is funded by ads and donations.
 

Re: How to remove old kernels and headers on linux mint 13

Postby jazz.h on Sun Apr 28, 2013 6:03 pm

I also have Linux Mint 13 Mate 64bit and 13 KDE.
From Mate I have deleted old kernels and headers by using Ubuntu Tweak > Janitor > Old kernel.
No problems so far...
jazz.h
Level 4
Level 4
 
Posts: 235
Joined: Sat Jun 18, 2011 7:13 am

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 6:05 pm

Tried that but didn't work :(
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby passerby on Sun Apr 28, 2013 6:14 pm

Run
Code: Select all
sudo update-grub2

It will tell you where the files pertaining to those unwanted entries are.
eg. Mine comes up with
Code: Select all
Found linux image: /boot/vmlinuz-3.8.5-030805-generic
Found initrd image: /boot/initrd.img-3.8.5-030805-generic

so if I wanted to remove the 3.8.5 entry, I'd delete those two files, then run update-grub2 again.
Home PC: Xubuntu 14.04 beta 2 x64, Nvidia GTX650, i7 3770K, 16GB RAM, Asus Xonar DX
Work PC: Mint 13 x64 XFCE, Nvidia GT620, i5 3470, 8GB RAM
Laptop: System76 Kudu Pro, Xubuntu 13.10 x64

My HTML5 login themes + screenshots
User avatar
passerby
Level 6
Level 6
 
Posts: 1321
Joined: Sun Dec 16, 2012 7:29 pm

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 6:17 pm

Code: Select all
sudo update-grub2

gave me:
Code: Select all
mohamed@mohamed-Inspiron-N5040 ~ $ sudo update-grub2
[sudo] password for mohamed:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Linux Mint 14 Nadia (14) on /dev/sda5
done


which ones should I remove?
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 6:31 pm

I want to remove these ntwo lines:
Code: Select all
menuentry "Linux Mint 14 MATE 64-bit, 3.5.0-17-generic (/dev/sda7) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby passerby on Sun Apr 28, 2013 6:34 pm

Do you have a separate /boot partition shared between both installs? Or perhaps two disks?
If not, it appears as though your other install is handling grub. Reboot into that installation and make the changes there.
Home PC: Xubuntu 14.04 beta 2 x64, Nvidia GTX650, i7 3770K, 16GB RAM, Asus Xonar DX
Work PC: Mint 13 x64 XFCE, Nvidia GT620, i5 3470, 8GB RAM
Laptop: System76 Kudu Pro, Xubuntu 13.10 x64

My HTML5 login themes + screenshots
User avatar
passerby
Level 6
Level 6
 
Posts: 1321
Joined: Sun Dec 16, 2012 7:29 pm

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 6:43 pm

I am runnig Linux Mint 13 Mate now.t is the one handling grub. The two OS'S have their separate ex4 and swap partitions :(
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 7:13 pm

:roll: Where is everyone??? :roll: :roll:
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 7:25 pm

I found this line on a Ubuntu forum:
Code: Select all
sudo apt-get purge $( dpkg --list | grep -P -o "linux-image-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )

Is it safe to use it???
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 8:23 pm

Heeeeeeeeeeeelp

Image
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun Apr 28, 2013 9:03 pm

I kept getting this issue with Mint 13 :shock: Does anyone have a solution. I like Mint and now I'm starting to think of ditching it :roll: :roll: ? :roll:
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby passerby on Sun Apr 28, 2013 9:43 pm

That command listed above will remove the kernels it finds other than the one currently in use.
I don't know about using it on a system with multiple installs.
You can just run the first part to see which kernels it finds:
Code: Select all
dpkg --list | grep -P -o "linux-image-\d\S+"
Home PC: Xubuntu 14.04 beta 2 x64, Nvidia GTX650, i7 3770K, 16GB RAM, Asus Xonar DX
Work PC: Mint 13 x64 XFCE, Nvidia GT620, i5 3470, 8GB RAM
Laptop: System76 Kudu Pro, Xubuntu 13.10 x64

My HTML5 login themes + screenshots
User avatar
passerby
Level 6
Level 6
 
Posts: 1321
Joined: Sun Dec 16, 2012 7:29 pm

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Mon Apr 29, 2013 9:17 am

Code: Select all
dpkg --list | grep -P -o "linux-image-\d\S+"
gave me::
Code: Select all
mohamed@mohamed-Inspiron-N5040 ~ $ dpkg --list | grep -P -o "linux-image-\d\S+"
linux-image-3.2.0-23-generic
mohamed@mohamed-Inspiron-N5040 ~ $


Shoud I edit grub.cfg instead?? :roll:

Does upgrading grub solve the issue? Because this issue is common only on LM 13 and the latest version of grub is more clean :roll: I made a tutorial on how to do it here viewtopic.php?f=42&t=132488.
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Mon Apr 29, 2013 11:53 am

Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Mon Apr 29, 2013 7:39 pm

What are these two ugly lines on my GRUB Menu :oops: :oops: :roll:

Code: Select all
menuentry "Linux Mint 14 MATE 64-bit, 3.5.0-17-generic (/dev/sda7) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class


BTW
Code: Select all
    grep menuentry /boot/grub/grub.cfg
gives:

Code: Select all
mohamed@mohamed-Inspiron-N5040 ~ $ grep menuentry /boot/grub/grub.cfg
menuentry 'Linux Mint 13 MATE 64-bit, 3.2.0-23-generic (/dev/sda7)' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry 'Linux Mint 13 MATE 64-bit, 3.2.0-23-generic (/dev/sda7) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry "Linux Mint 14 MATE 64-bit, 3.5.0-17-generic (/dev/sda7) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class gnu-linux --class gnu --class os {
menuentry "Linux Mint 14 Nadia (14) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.5.0-17-generic--b90a38ab-e5f8-4787-95ca-41d8673db81d (on /dev/sda5)" --class gnu-linux --class gnu --class os {
menuentry "Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda5) (on /dev/sda5)" --class gnu-linux --class gnu --class os {
menuentry "Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda5) -- recovery mode (on /dev/sda5)" --class gnu-linux --class gnu --class os {
mohamed@mohamed-Inspiron-N5040 ~ $
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Mon Apr 29, 2013 9:22 pm

Image

Image
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Thu May 02, 2013 7:14 pm

HELP
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby Zorba on Sun May 05, 2013 6:56 pm

HEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEELP
Image Image
User avatar
Zorba
Level 7
Level 7
 
Posts: 1982
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to remove old kernels and headers on linux mint 13

Postby WarBishop on Wed Jun 12, 2013 11:01 pm

Synaptic > Quick search box > type in linux-image

Mark for Removal > linux-image-generic 3.2.0.23.25
WarBishop
Level 1
Level 1
 
Posts: 1
Joined: Wed Jun 12, 2013 10:51 pm

Linux Mint is funded by ads and donations.
 
Next

Return to Installation & Boot

Who is online

Users browsing this forum: No registered users and 38 guests