1

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!

  • A question for you, is did you remove the reference to the kernel or both the reference to it and the physical kernel? If the the later, I am sorry to say, you might be up a creek without a paddle. Howtogeek is usually a good reference site but I must admit I am disappointed that he did not mention to do the *uname -r* so you knew which kernel was the most current and that he does not give a clear caution or warning about this! Please refer to these http://rusiruboteju.wordpress.com/tag/synaptic-package-manager/ and http://tombuntu.com/index.php/2007/10/17/remove-ubuntu-kernels-you-dont-need/ – ricbax Oct 22 '10 at 14:42
  • 1
    This situation is not irretrievable, just might get quite technical. It's amazing how bad a linux machine has to get before a clean reinstall is the *only* solution. I ended up in a similar situation to this last night after doing an release upgrade but ended up rebooting the machine before it had finished. – JRT Oct 22 '10 at 14:49
  • @ricbax It was weird because I took note of the version I was using. I carefully remove only the other ones. After the operations, Synaptic showed that the only one left was the latest version. But I notice during the removal that "linux-generic" (without a version number) was also removed. Maybe that was a reference to the latest? – Pascal Dimassimo Oct 22 '10 at 16:05
  • Correct, linux-generic is a meta-package to the latest kernel. – JRT Oct 22 '10 at 17:10
  • Oh yeah, I forgot about *mount --bind* 'ing the pseudo-fs. With my problem, I was able to boot into single user mode by adding *init=/bin/bash* to the grub entry and start up enough of a system to be able to start networking and finish the install. Glad you got it sorted. – JRT Oct 22 '10 at 17:15

1 Answers1

2

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>

JRT
  • 663
  • 5
  • 8