Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Please Help! Live Server. Kernel image is gone, can't boot with md0 as root.

    Hi guys,

    Sorry to bug every one here, but I massed up, and now I have a serious problem on my hands. Do not know how to fix it. Please help.

    I was updating my Debian installation using aptitude. Everything went ok, or so I thought. After I installed a new printer using HPIJS driver, and it asked me to restart, not sure why, but by the time I realized I was rebooting the server, it was to late.

    In the process, during update, or while installing the printer, my 2.6 kernel image got erased! The only remaining image was 2.4.

    I had a Software RAID setup installed on my server. The layout is as such:

    md0 uses hda0 and hdc0
    md1 uses hda1 and hdc1

    Root file system is located on md0. And this is why I am so massed up. After trying to boot using 2.4 image I could not, because it telling me that kernel is too old. I then followed someones advise and used Debian disk to boot in the rescue mode, and using Denian menus, I was able to open a shell on /dev/md0 as root.

    I stupidly ran apt-get to install the 2.6 kernel, and that erased the 2.4 one, without installing 2.6! I do not know how

    I then was able to copy, vmlinuz-2.6.26-1-686, initrd.img-2.6.26-1-686, config-2.6.26-1-686, from another different server to the boot directory in the broken one. I rebooted and was able to set grub to boot from that new kernel image.

    It boots to the point where it's time to load root file system, and it just stops ;( I don't know what to do. The donor server I copied the kernel image from is also Debian, but does not have software raid setup. I suspect that maybe that's why it's not loading /dev/md0 as root.

    I can download files from public http sites directly to the server using wget, if you can post a kernel image for me to grab, I would be able to grab them and boot them.

    Please help, please! This is a live server, and it's been down for a while now. Please help.

    - B

  2. #2
    Hopefully it is a simple problem now. Are you sure your grub is configured correctly? It may just be pointing to the wrong drive. If that does not work then you have to see if the donor kernel had support for your raid setup. You are probably onto something when you said that this may be why it is getting stuck trying to mount.

    I would recommend booting into a debian livecd. You should be able to fix it from there.

    (Important Note: I am a gentoo guy and not all that familiar with the idiosyncrasies of debian, so if anyone sees a problem with the following, please post them.)

    If you have only deleted the image from your /boot partition, grab the image from the local disk and put it in there (you made it sound like this was not the case though).

    cp /mnt/localdisk/usr/src/linux/arch/<yourarch>/boot/bzImage /mnt/localdisk/boot/kernelname_from_your_grub_conf_file

    If you have deleted that image as well, then you will have to recompile the kernel (if it is still on your system somewhere, which I wasn't able to discern):

    1.) Boot to a livecd (preferably with the same compiler as you use)

    2.) Now mount the necessary places
    # mount -t proc none /mnt/localharddrive/proc
    # mount -o bind /dev /mnt/localharddrive/dev
    # mount -o bind /boot /mnt/localharddrive/boot #if your boot is on another partition
    4.) Chroot into your local disk (the one where you can compile your kernel)
    # chroot /mnt/localharddrive /bin/bash
    # env-update
    # source /etc/profile
    # export PS1="(chroot) $PS1"

    5.) You will now be chrooted into your local disk. Here you can recompile your kernel.
    # cd /usr/src/linux
    # make menuconfig
    # make && make modules_install

    If, during the updating process, it wiped all your available kernels from /usr/src, then you will have to re-install them, like you tried before. I'm not 100% about this, but being chrooted may solve your problem of the "missing reinstall" that you had earlier. You will want to follow your distribution instructions for installing and configuring your kernel. Example for debian:

    aptitude install linux-image-2.6-<ARCH>

    This should have downloaded your arch's kernel. Configure it as we did in step 5 and place the image in /boot

    As long as you have a kernel image in your /boot which is correctly pointed to by your grub/lilo configuration file you should be fine.

    I hope this helps...
    Last edited by sdimhoff; 03-12-2009 at 01:51 PM. Reason: Spelling
    Linux since: 2001
    Gentoo since: 2004
    - - - - - - - -
    I fix things until they break.

  3. #3
    Thank you for the help. What I actually ended up doing is something really ass backwords, but it worked, thank god. I had a spare drive and a space to place it into the server. I installed the drive, then installed Debian on in with support for md raids and mounted the old md0 as /old-root. After confirming that the installation worked and I could mount md0, I copied the kernel and init files form newly installed Debian to my old md0 system, reconfigured GRUB, rebooted, pulled out the drive, and everything worked like a charm.

    Unfortunately, during the update, the 'wonderful' aptitude tool chose to whipe my php4 install. Php4 is no longer in the main distribution! So I had to pull it from oldstable repository. I know php5 has been coming a long, but some sites on this server still use php4. So, I am stuck with it for now.

    Thank you for all the help.

    - B

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts