Question: This morning linux-image-3.5.0-26-generic was installed during a software update. On my laptop this proved to be unusable after 10 minutes. I changed to linux-image-3.5.0-24-generic and all seems fine. I have updated the default grub2 selection to the 24-generic. How can I lock the default grub selection to this value so subsequent updates don't overwrite and make themselves default?

Answer: 
### how to lock a kernel grub entry

With a bit of command line trickery, you can get the default of grub to always be a particular grub entry no matter when a new kernel is installed or updated.

In a terminal type:

```
fgrep menuentry /boot/grub/grub.cfg

```

This will display all your grub entries - for example

![enter image description here](https://i.imgur.com/aBtcj9w.png)

Highlight the entry you want to default to - for example 'Ubuntu, with Linux 3.2.0-31' in the screen-shot. Right click and choose `copy`

Type

```
gksu gedit /etc/default/grub

```

Change the entry

```
GRUB_DEFAULT=0

```

to

```
GRUB_DEFAULT='2>Ubuntu, with Linux 3.2.0-31-generic'

```

i.e. paste the entry you want (including the quotes) BUT PREFIX with the text *2>*

Save, then type

```
sudo update-grub

```

The text *2>* is important because this informs Grub that the entry to boot from exists in the sub-menu called "Previous Linux entries"
I just searched and found this file:

```
/etc/default/grub

```

Command `grub-mkconfig` (or `update-grub`) uses this file for default values. Try editing line `GRUB_DEFAULT=0` to `GRUB_DEFAULT=1`.