1

I just update, but, I don't want to restart the computer, 'cause it may not reboot

1
  • @saiarcot895 thanks for the reference, but for my current level it looks too automatic 'cause I want to leave the new kernel and two versions behind just for backup.
    – cumanacr
    May 30, 2015 at 6:56

2 Answers 2

1

Test this:

Open a terminal,

Press Ctrl+Alt+T

Run it:

sudo -i

OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')

CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')

LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"

METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"

OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)

apt-get purge $OLDCONF

apt-get purge $OLDKERNELS

apt-get autoremove

apt-get clean
0

First get your current kernel image

uname -r

Then find out what other kernels version you have installed (and not using usually)

sudo dpkg --list 'linux-image*'

Now time to remove all the other kernel using the following command

sudo apt-get remove

Don't remove the kernel image that was shown on the first command (its the one you are using).

Finally

cross your fingers
1
  • Thanks, I made this mini script to list the installed kernels, and then use sudo apt-get remove to uninstall the older ones. dpkg --list 'linux-image*' | grep ^ii | grep -v linux-image-generic | grep -v uname -r
    – cumanacr
    May 30, 2015 at 7:05

Not the answer you're looking for? Browse other questions tagged .