# Inadvertantly deleted my initramfs file; now can't boot

## yoquierotacob

In the process of building a gentoo kernel recently, I was trying to save some space and inadvertantly deleted my initramfs file.

Grub gives a cannot find file error, then bails out.

I am able to boot up with a Knoppix disk now, and access my disk drive, but the paths are different, and I think this screws up the build initramfs make... so I am blocked there as well.

Is it possible just to grab a generic dumbed down version of a initramfs file from somewhere and just drop it on my system?

Any ideas?

Thanks in advance,

Don

----------

## yther

I'd try booting with a System RescueCD, since that is based on Gentoo.  (Indeed, many people use it instead of the Gentoo install CD, as it comes with more tools.)  Then see the Gentoo Handbook for info on doing "chroot"... once you are "inside" your old system, you can build a new kernel or initramfs and install it.  This should work, but my Gentoo PC is down at the moment due to lack of power, so I can't test or help if it doesn't.   :Sad: 

Edit:  In case you are unable to burn another CD due to your system being borked, chroot should work with a Knoppix CD as well; once done, your paths will be correct.

Good luck!Last edited by yther on Wed Apr 28, 2010 12:40 am; edited 1 time in total

----------

## Princess Nell

You could try to check if your system boots into a usable state without initramfs. In the grub boot menu, press "c" to get a command line. "cat grub/grub.conf" prints grub.conf to the screen and gives you the name of the kernel file and kernel boot options. Enter "kernel /<your kernel filename here> <options>", return, and then "boot". If that works, this wiki link might help further http://en.gentoo-wiki.com/wiki/Initramfs.

Also: http://www.gnu.org/software/grub/manual/grub.html#Making-your-system-robust  :Wink: 

----------

## yzg

The fastest way is to boot from a minimal Gentoo CD and change root into

your hardrive to compile the kernel again.

```

mount  /dev/YOURHDD   /mnt/gentoo

mount -t proc none /mnt/gentoo/proc

mount -o bind /dev /mnt/gentoo/dev

cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

cd /mnt/gentoo

chroot /mnt/gentoo /bin/bash

env-update

source /etc/profile

#-------------------------------------------------------------------------------

#Kernel Compile

#------------------------------------------------------------------------------

#-------------------------------------------------------------------------------

#Grub configuration

#-------------------------------------------------------------------------------

grub-install --no-floppy --recheck /dev/YOURHDD

```

----------

## krinn

fastest way must be Princess Nell way.

Just a little easier way:

- in boot pickup your kernel line to boot as usual

- type e (for edit)

- now pickup the initramfs line and delete it (this will delete stuff only for that try, not in grub.conf)

- type b (to boot with the initramfs)

----------

