LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Unable to boot from grub, "error: unknown command initrd" (http://www.linuxquestions.org/questions/debian-26/unable-to-boot-from-grub-error-unknown-command-initrd-707282/)

R00ts 02-24-2009 08:09 PM

Unable to boot from grub, "error: unknown command initrd"
 
I'm running Debian testing and after a recent software update, suddenly I can no longer boot into my single Linux kernel image anymore. I did look at the software update before I did it and I don't believe that it removed any software packages. When I try to boot into my linux 2.6.26-1-amd64 image, I get the following message from grub:


"error: unknown command `initrd'"


The same error appears if I try to boot into single-user mode. I have a Windows XP partition on the same hard disk and I am still able to boot into that from grub. I've searched the net and haven't really found my same problem replicated anywhere. I would imagine that the problem is just that somehow the initrd package got removed in my last software update, but again I don't recall seeing any software that the update planned to remove.


Any thoughts on how I would go about fixing this problem? Since I'm unable to get into Linux at all, I imagine I'll have to use a LiveCD to get in and fix the problem, but I don't know where to begin looking. Any help would be appreciated.

zzak 02-24-2009 08:46 PM

When grub starts, highlight the Debian partition and hit "e" to edit.
You should see all the lines that appear in your Debian stanza in your
grub's menu.lst
Scroll down to the initrd line and hit "e" to edit.
The line should look something like:
initrd /boot/boot/initrd.img-2.6.26-1-amd64
(I'm guessing, since I've got the 32bit version)

If there was a change to the kernel, your grub menu.lst
should have been changed too.

It's handy to have a LiveCD handy for this.
If have a copy of Knoppix for this sort of thing.

CJS 02-24-2009 08:50 PM

I would try copying over a fresh Grub stage2 file to your Debian /boot/grub directory. I would guess that on your Live CD, you can find the original Grub files under the following directory:
Code:

/usr/lib/grub/*-pc/
Or at least that's where they are on a Ubuntu Live CD, so I would think Debian might use the same directory. You could always figure out where Grub has its original stage2 file by doing:
Code:

dpkg -L grub | grep stage2
Once you copy a new stage2 file to your Debian /boot/grub directory, how about letting me know if that fixes the problem or not.

dxqcanada 02-24-2009 08:52 PM

There appears to be a syntax error in your grub.conf file, concerning the initrd file.

When the Grub bootloader appears ... edit the entry (Grub should present you that option)


Shoot, typed too slow ... I am just repeating someone else's answer now.

R00ts 02-24-2009 09:19 PM

Yeah I already tried editing from the grub prompt to see if the problem was obvious. My initrd line is as follows:


initrd /boot/initrd.img-2.6.26-1-amd64


I'm pretty sure that is correct. But if initrd is for some reason no longer found on my system then of course that line would not work even if that line is correct.

jkerr82508 02-25-2009 06:17 AM

post deleted

tredegar 02-25-2009 12:53 PM

Quote:

I imagine I'll have to use a LiveCD to get in and fix the problem, but I don't know where to begin looking. Any help would be appreciated.
Boot from a live CD
Mount the partition that has /boot
Look at /mountpoint/boot/grub/menu.lst
-Are there syntax errors?
-What files is it referencing ( eg /boot/initrd.img-2.6.26-1-amd64 ) ?
-Do those files exist?

You may find in /mountpoint/boot/grub/ a backup of menu.lst from before the update took place. This may help you work out what has gone wrong.

If you can run this script https://sourceforge.net/projects/boo...ootinfoscript/ from your live CD, it will provide you with much useful information.

Download it, save it to a usb key, copy it over to your live distro, then execute it as bash /path/to/bootinfoscript as root. Read the output.
If you don't understand it, post it here, or to a pastebin on the www

If all else fails, from your live CD, post the /mountpoint/boot/grub/menu.lst file.
Note that we need the menu.lst from from your HDD (NOT the live CD!), and also post the output of ls -l /mountpoint/boot

R00ts 03-28-2009 10:53 AM

I put fixing this issue on the back burner for several weeks but I'm back at it again. I did find a backup file "initrd.img-2.6.26-1-amd64.bak" in my /boot folder that was dated Dec 16, while the file "initrd.img-2.6.26-1-amd64" was dated Feb 1 (which is when this problem began). I tried swapping the two files and rebooted hoping that it would fix the problem, but it made absolutely no difference and gave the same "initrd: unknown command" error.


I've studied my /boot/grub/grub.conf file and haven't found any problems with it. Below is the output of the bootinfoscript tredegar shared. Note that sda2 is the drive with the Linux install. hda1 is a backup drive I have connected in my PC but am not currently using. I couldn't see any problems from this script output but maybe I missed something. I still think the general problem is that somehow this initrd executable/script was uninstalled from my system.


Code:

============================= Boot Info Summary: ==============================

 => Grub0.95 is installed in the MBR of /dev/hda and looks on the same drive
    in partition #1 for /boot/grub/stage2 and /boot/grub/menu.lst.
 => Grub2 is installed in the MBR of /dev/sda and looks on the same drive in
    partition #2 for /boot/grub.
 => No boot loader is installed in the MBR of /dev/sdb

hda1: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info: 
    Operating System: 
    Boot files/dirs:  /boot/grub/menu.lst /etc/fstab

hda2: _________________________________________________________________________

    File system:      Extended Partition
    Boot sector type:  -
    Boot sector info: 

hda5: _________________________________________________________________________

    File system:      swap
    Boot sector type:  -
    Boot sector info: 

hda6: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info: 
    Operating System: 
    Boot files/dirs: 

sda1: _________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows XP
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows XP
    Boot files/dirs:  /boot.ini /ntldr /NTDETECT.COM

sda2: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info: 
    Operating System: 
    Boot files/dirs:  /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda3: _________________________________________________________________________

    File system:      Extended Partition
    Boot sector type:  -
    Boot sector info: 

sda5: _________________________________________________________________________

    File system:      swap
    Boot sector type:  -
    Boot sector info: 

sda6: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info: 
    Operating System: 
    Boot files/dirs: 

sdb1: _________________________________________________________________________

    File system:      vfat
    Boot sector type:  Fat16
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System: 
    Boot files/dirs: 

=========================== Drive/Partition Info: =============================

Drive: hda ___________________ _____________________________________________________

Disk /dev/hda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders, total 390721968 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00013859

Partition  Boot        Start          End          Size  Id System

/dev/hda1    *            63    27,792,449    27,792,387  83 Linux
/dev/hda2          27,792,450  390,716,864  362,924,415  f W95 Ext d (LBA)
/dev/hda5          27,808,515    29,768,444    1,959,930  82 Linux swap / Solaris
/dev/hda6          29,768,508  390,716,864  360,948,357  83 Linux


Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 640.1 GB, 640133946880 bytes
255 heads, 63 sectors/track, 77825 cylinders, total 1250261615 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x11181118

Partition  Boot        Start          End          Size  Id System

/dev/sda1                  63  156,264,254  156,264,192  7 HPFS/NTFS
/dev/sda2    *    156,264,255  234,388,349    78,124,095  83 Linux
/dev/sda3        234,388,350 1,250,258,624 1,015,870,275  5 Extended
/dev/sda5        234,388,413  244,348,649    9,960,237  82 Linux swap / Solaris
/dev/sda6        244,348,713 1,250,258,624 1,005,909,912  83 Linux


Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 1043 MB, 1043070976 bytes
64 heads, 32 sectors/track, 994 cylinders, total 2037248 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x1ccf8de1

Partition  Boot        Start          End          Size  Id System

/dev/sdb1    *            32    2,035,710    2,035,679  6 FAT16


blkid -c /dev/null: ____________________________________________________________

/dev/hda1: LABEL="/" UUID="19a90fbb-f8db-4095-b35a-9898f892c414" SEC_TYPE="ext2" TYPE="ext3"
/dev/hda5: LABEL="ID_FS_USAGE=oth" UUID="8ca44fb6-3fcc-4247-85f0-efda0079149e" TYPE="swap"
/dev/hda6: LABEL="/home" UUID="30c11b6d-34f8-4cd2-8518-0c1eb7fa09dd" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda1: UUID="16C8E416C8E3F1C3" TYPE="ntfs"
/dev/sda2: LABEL="root" UUID="569c09be-68c3-4e61-8b4b-8cfa7a8d791a" TYPE="ext3"
/dev/sda5: TYPE="swap"
/dev/sda6: UUID="c602a625-c8e6-4d62-9ab3-54ded5859a66" TYPE="ext3"
/dev/cloop0: LABEL="KNOPPIX_FS" TYPE="iso9660"
/dev/sdb1: SEC_TYPE="msdos" UUID="FCC5-6B0F" TYPE="vfat"

=============================== "mount" output: ===============================

rootfs on / type rootfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sr0 on /mnt-system type iso9660 (ro)
tmpfs on /ramdisk type tmpfs (rw,size=1048576k)
/dev/cloop on /KNOPPIX type iso9660 (ro)
unionfs on /UNIONFS type aufs (rw,noatime,si=fc24d8e2,xino=/ramdisk/.aufs.xino,noplink,br:/ramdisk=rw:/KNOPPIX=ro)
unionfs on /home type aufs (rw,noatime,si=fc24d8e2,xino=/ramdisk/.aufs.xino,noplink,br:/ramdisk=rw:/KNOPPIX=ro)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /UNIONFS/var/run type tmpfs (rw,size=10240k)
tmpfs on /UNIONFS/var/lock type tmpfs (rw,size=10240k)
tmpfs on /UNIONFS/var/log type tmpfs (rw,size=102400k)
tmpfs on /tmp type tmpfs (rw,size=1048576k)
udev on /dev type tmpfs (rw,size=20480k)
tmpfs on /dev/shm type tmpfs (rw,size=1048576k)
devpts on /dev/pts type devpts (rw,mode=1777)
/dev/sda1 on /media/sda1 type fuseblk (rw,nosuid,nodev,user_id=1000,group_id=1000,default_permissions,allow_other,blksize=4096)
/dev/sda2 on /media/sda2 type ext3 (rw,nosuid,nodev,errors=continue,data=ordered)
/dev/sda6 on /media/sda6 type ext3 (rw,nosuid,nodev,errors=continue,data=ordered)


=========================== hda1/boot/grub/menu.lst: ===========================

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.         
default                0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout                5

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title                Windows 95/98/NT/2000
# root                (hd0,0)
# makeactive
# chainloader        +1
#
# title                Linux
# root                (hd0,1)
# kernel        /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/hda1 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(single-user) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title                Debian GNU/Linux, kernel 2.6.26-1-amd64
root                (hd0,0)
kernel                /boot/vmlinuz-2.6.26-1-amd64 root=/dev/hda1 ro
initrd                /boot/initrd.img-2.6.26-1-amd64

title                Debian GNU/Linux, kernel 2.6.26-1-amd64 (recovery mode)
root                (hd0,0)
kernel                /boot/vmlinuz-2.6.26-1-amd64 root=/dev/hda1 ro single
initrd                /boot/initrd.img-2.6.26-1-amd64

title                Debian GNU/Linux, kernel 2.6.21-2-k7
root                (hd0,0)
kernel                /boot/vmlinuz-2.6.21-2-k7 root=/dev/hda1 ro
initrd                /boot/initrd.img-2.6.21-2-k7

title                Debian GNU/Linux, kernel 2.6.21-2-k7 (recovery mode)
root                (hd0,0)
kernel                /boot/vmlinuz-2.6.21-2-k7 root=/dev/hda1 ro single
initrd                /boot/initrd.img-2.6.21-2-k7

### END DEBIAN AUTOMAGIC KERNELS LIST

# Windows XP: trick it into thinking its on the IDE master drive
title Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd0,0)
root (hd1,0)
makeactive
chainloader +1

=============================== hda1/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
/dev/hda1      /              ext3    defaults,errors=remount-ro 0      1
/dev/hda6      /home          ext3    defaults        0      2
/dev/hda5      none            swap    sw              0      0
/dev/hdc        /mnt/cdrom      iso9660 ro,user,noauto  0      0
#/dev/sda1      /mnt/usbkey    vfat    user,noauto,umask=0  0    0
/dev/sda        /mnt/ipod        vfat        sync,user,noauto,umask=000        0        0


=================== hda1: Location of files loaded by Grub: ===================


  1.5GB: boot/grub/menu.lst
  1.4GB: boot/grub/stage2
  1.6GB: boot/initrd.img-2.6.18-1-k7.bak
  1.5GB: boot/initrd.img-2.6.21-2-k7
  6.8GB: boot/initrd.img-2.6.21-2-k7.bak
  6.0GB: boot/initrd.img-2.6.26-1-amd64
  6.9GB: boot/initrd.img-2.6.26-1-amd64.bak
  7.9GB: boot/vmlinuz-2.6.21-2-k7
  1.4GB: boot/vmlinuz-2.6.26-1-amd64
  6.0GB: initrd.img
  1.4GB: vmlinuz

================================ sda1/boot.ini: ================================

[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /noexecute=optin /fastdetect


=========================== sda2/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,2)
search --fs-uuid --set 569c09be-68c3-4e61-8b4b-8cfa7a8d791a
if font /usr/share/grub/ascii.pff ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set root=(hd0,2)
search --fs-uuid --set 569c09be-68c3-4e61-8b4b-8cfa7a8d791a
insmod png
if background_image /boot/grub/moreblue-orbit-grub.png ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.26-1-amd64" {
        set root=(hd0,2)
        search --fs-uuid --set 569c09be-68c3-4e61-8b4b-8cfa7a8d791a
        linux        /boot/vmlinuz-2.6.26-1-amd64 root=UUID=569c09be-68c3-4e61-8b4b-8cfa7a8d791a ro 
        initrd        /boot/initrd.img-2.6.26-1-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.26-1-amd64 (single-user mode)" {
        set root=(hd0,2)
        search --fs-uuid --set 569c09be-68c3-4e61-8b4b-8cfa7a8d791a
        linux        /boot/vmlinuz-2.6.26-1-amd64 root=UUID=569c09be-68c3-4e61-8b4b-8cfa7a8d791a ro single
        initrd        /boot/initrd.img-2.6.26-1-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_otheros ###

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
menuentry "Microsoft Windows XP Home Edition" {
        set root=(hd0,0)
        chainloader +1
}
### END /etc/grub.d/30_otheros ###

### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###

=============================== sda2/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
/dev/sda2      /              ext3    errors=remount-ro 0      1
/dev/sda6      /home          ext3    defaults        0      2
/dev/sda5      none            swap    sw              0      0
/dev/scd0      /media/cdrom0  udf,iso9660 user,noauto    0      0

=================== sda2: Location of files loaded by Grub: ===================


 100.1GB: boot/grub/grub.cfg
 100.1GB: boot/initrd.img-2.6.26-1-amd64
 100.1GB: boot/initrd.img-2.6.26-1-amd64.bak
 100.2GB: boot/vmlinuz-2.6.26-1-amd64
 100.1GB: initrd.img
 100.2GB: vmlinuz


tredegar 03-28-2009 12:45 PM

Thanks for posting the bootinfo output.

I can't see where the problem lies, but I do notice that
the grub which is giving you problems is grub2
http://www.gnu.org/software/grub/
I believe grub2 is still under development, and maybe you can expect a few bugs.
I'm still happily using grub0.97, and know nothing about grub2. Sorry.

Maybe you should try the grub2 mailing list or wiki (links on the gnu.org page above) ?


All times are GMT -5. The time now is 11:03 AM.