Because I wanted to get more free space on my HDD, I deleted old kernels (dont ask me why I was so mad.). I accidentally deleted the active kernel too (3.2.0-27 on Ubuntu 12.04).

First I couldn't boot. I installed the kernels 3.2.0-23 and 3.2.0-27 via a live system (see here).

Now, when I start my system now, I only get these lines:

mountall: Event failed
fsck from util-linux 2.20.1
/dev/sda1: clean, 832254/40099840 files, 21092083/160394239 blocks
 * Stopping Flush boot log to disk
 * Stopping Enabling additional executable binary formats
 * Starting bluetooth daemon

Other PC specs:

  • Intel i5 2500K 4x 3.3 GHz
  • 8 GB RAM
  • /dev/sda1 is Ubuntu, about 1400GB
  • Zotac Nvidia GTX 560
  • ASRock Z68 Pro3

Thank you in advance!

EDIT: Here you can find some log files from /var/log: kern.log boot.log

  • Please provide logs from /var/log/messages. If you are not able to log in, you can obtain them while booted via live CD. Jul 18, 2012 at 15:51
  • dmesg | pastebinit please
    – ish
    Jul 18, 2012 at 17:16
  • I had originally thought that the problem here was that the kernel was not properly reinstalled. But I am not convinced this is true, and the upvotes on my answer (which provided a more detailed reinstallation procedure) made this question look answered in the questions list. So I've removed that answer, and posted it (with appropriate changes) in the question where it better belongs. Anyone who needs it can find it there. Good luck with this problem! Jul 20, 2012 at 16:04
  • Why not use live CD, connect to internet and do the software updates instead of resorting to long process?
    – all4naija
    Jul 21, 2012 at 12:45
  • 1
    The pastebin output you posted seems to be from the live CD boot. [ 0.000000] Command line: noprompt cdrom-detect/try-usb=true file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash -- Jul 22, 2012 at 2:31

4 Answers 4


Boot from the livecd, mount the hard disk, and reinstall the kernel. For example:

sudo -s
mount /dev/sda1 /mnt
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
chroot /mnt
apt-get install linux-image-3.2.0-27-generic-pae
  • Hi Psusi - I ran these commands (askubuntu.com/questions/89710/…) yesterday on a small laptop and accidentally erased my kernel. By following your instructions in this post I recovered my system in 2 minutes. If I had followed any other instructions I would still have been fighting to recover. Thanks again!
    – root-11
    Mar 23, 2013 at 8:43
  • I can confirm these instructions works also on 14.04 May 18, 2014 at 19:13
  • This is correct but there are several things worth noting: (1) Your root filesystem might not be /dev/sda1. (2) The network will normally not be accessible from within the chroot if you need to download the package with apt-get. (3) If your filesystem is encrypted, not only will it likely not be /dev/sda1 but the new kernel will (having been run from the LiveCD) not include the LUKS cryptsetup tools necessarily to unencrypt your disk while booting. Fixing this is possible, but much harder.
    – mako
    Jul 15, 2014 at 23:52

An option is a manual recovery:

Files are the easiest part. You can do what Ramchandra suggested, but if you want to preserve your apps you should avoid reinstalling (as that would, as you've seen, remove the apps.) If you want to avoid uninstalling the boot with a missing kernel:

  1. Boot to LiveCD.

  2. Using nautilus, open up the broken partition.

  3. Navigate to /home/myusernamehere. All your files will be there.

Some other files you might want to save:

  • /etc/apt/sources.list, if you have any manual repos.

After you are done with this, stick it onto a flash drive or email it to yourself.

Apps is a trickier part. I have come up with a somewhat roundabout solution that will take some time (most of it without you actively participating), but this should recover your apps (without settings/configurations)

  1. Stick around LiveCD.

  2. Navigate to /usr/lib. (It may take a while to load.)

  3. Woah! Huge amount of folders. Open up gedit in liveCD.

  4. Type this in gedit:


    sudo apt-get install folder1 folder2 folder3

...Where folder1 folder2 folder3 are the names of the folders.

These are all the programs you have installed on ubuntu (I think). Some of these (about 50%, maybe more) come with the system, so the arent necessary, but a safe bet is just put everything.

Another place to look for apps is /etc and /etc/alternatives. (Update me if I am missing any spots, internet!)

Save the file as .sh and email or flash drive it.

Now, when you first start up your computer (after total reinstall) you can run this script to sudo apt-get all your programs that you previously had. They'll be good as new!

  • 1
    This answer is incorrect in at least two ways: (1) It does not describe how to repair a system but rather how to backup, remove, and then reinstall your system! (2) It gets the back/reinstalling part wrong too! For reference: /usr/lib/ does not contain a list of packages and neither does /etc/alternatives. If you want a list of packages installed on your system, you can get one easily with: <code>dpkg --get-selections</code> and can restore it with <code>dpkg --set-selection</code> although on the newest version of Ubuntu getting the reinstall to work without dselect can take some effort.
    – mako
    Jul 15, 2014 at 23:48

Did you try the recovery option? You can install Ubuntu over an exisiting Ubuntu installation - all your files will remain. Though if you modify system files, those changes will be wiped out.

To do so, at the installer select advanced partition and use your ubuntu installed partition as / .

I have not tested it though.

  • First, thank you for your answer. The new installation without formatting helped! Now I have got all my data from my home directory. But: All applications, all settings and all my configurations are lost. In addition to that there are many bugs and glitches with the window manager and Unity. I also tried a new installation and this worked better for me.
    – slashcrack
    Jul 21, 2012 at 22:32

I only thought that I had deleted the kernel. Instead, I had somehow taken it out of the first in the queue of the kernels so that the system tried to boot with another kernel that was not the needed one. The needed kernel was not deleted. I solved this by choosing the right kernel from the advanced start menu. Either you know your kernel by having run uname -r before testing around, or you can test the list of kernels one by one (I had about 10 kernels).

See Ubuntu 20.04 black screen after installing, no booting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.