Reinstall latest linux kernel on Ubuntu 10.04
I have followed those instructions to clean up the boot menu of a Ubuntu 10.04 system. But somehow, I did not just remove the old versions, I also remove the latest one (don't laugh please). I only use Synaptic to remove them, I did not edit /etc/grub.d
Now, when I boot up the system, there is no Linux version available, only the memtest. I can boot up using the Ubuntu CD, and I see that the partition is still there with all the data.
How can I reinstall the latest linux kernel and have it available on my grub menu?
UPDATE
I followed JRT instructions but got permission errors while running apt-get. Running it a second time returns this output:
root@ubuntu:~# apt-get install linux-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up linux-image-2.6.32-25-generic (2.6.32-25.45) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-25-generic
grep: /proc/modules: No such file or directory
grep: /proc/modules: No such file or directory
grep: /proc/modules: No such file or directory
Running postinst hook script /usr/sbin/update-grub.
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
User postinst hook script [/usr/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.32-25-generic (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-2.6.32-25-generic; however:
Package linux-image-2.6.32-25-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 2.6.32.25.27); however:
Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-image-2.6.32-25-generic
linux-image-generic
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
UPDATE 2
I was able to fix the error by mounting the host system device nodes to the chroot environment. In another terminal, I typed this command:
mount --bind /dev /mnt/temp/dev
I was then able to run apt-get and re-install the kernel. I can now boot it and everything works.
My week-end is safe!
Boot from CD
BACKUP ALL PERSONAL DATA
Start a terminal, and change to root user.
sudo su < enter>
Let's mount root partition,
mkdir /mnt/temp < enter>
mount /dev/< root partition> /mnt/temp < enter>
chroot /mnt/temp < enter>
Now reinstall kernel:
apt-get install linux-generic < enter>