grub2 error: out of disk

16,393

Does Grub2 drop you into a grub rescue> prompt after this error? This thread suggests that getting the rescue prompt means Grub2 can't find a usable grub.cfg file. See Grub2 Rescue Mode for a method to locate your system installation and boot it. In short, you need these commands (see the link for details):

  1. ls (displays the partitions and devices Grub can see)
  2. set prefix=(hdX,Y)/boot/grub [*]
  3. set root=(hdX,Y)[*]
  4. set (shows Grub's environment; inspect the prefix= listing; make sure it matches what you set in step 3)
  5. ls /boot/ (should show the contents of your system's /boot -- kernels, initrd images, the grub folder, etc)
  6. insmod (hdX,Y)/boot/grub/linux.mod
  7. linux /vmlinuz root=/dev/sdXY ro [**]
  8. initrd /initrd.img
  9. boot

    • [*] replace (hdX,Y) with a value shown in the output of step 1, such as (hd0,1) or (hd3,9)
    • [**] replace sdXY with the correct designation, such as sda1 or sdc9. Y is the same as in (hdX,Y) but X will be a letter instead of a number.

If you can boot following those directions, you may be able to fix grub just by running:

sudo grub-install
sudo update-grub2

An alternative is suggested in this bug report. According to that, the error is generated by this line in Grub's configuration (grub.cfg):

if [ -n ${have_grubenv} ]; then save_env recordfail; fi

Removing that line seems to have helped fix booting problems, but some report the error still persists. See this post for how to remove that line from the Grub menu during boot, and for how to remove it from the configuration file generation script (/etc/grub.d/10_linux).

Unfortunately neither of these resources indicate what's causing the error.

Share:
16,393

Related videos on Youtube

Carl Smotricz
Author by

Carl Smotricz

I've been programming for 30 years and am getting to the point where I'm forgetting more than I learn. I answer questions here for the fun and challenge. I hope at least some of my answers help somebody. If you want to communicate with me directly, I have a firstname.lastname account with GMail.

Updated on September 17, 2022

Comments

  • Carl Smotricz
    Carl Smotricz almost 2 years

    I'm trying to make a 250G USB hard disk Ubuntu-bootable on a Compaq nc6220 laptop.

    I've removed all other disks, so /dev/sda (the USB disk) is the only disk other than CDROM.

    I installed Ubuntu 9.10 to this disk from the live CD, putting the bootloader on /dev/sda . The default system couldn't be booted, and nothing I did in the Grub menu/cmdline helped.

    So I chrooted onto the disk and did grub-install /dev/sda. That seemed to work fine, but Grub (1.97 beta 4) keeps coming up with

    error: out of disk

    Even when I drop to the command line to do something simple like ls or help, it's always the same error message.

    Any hints for resolving this, please?

    • Jjames
      Jjames over 14 years
      Wait a minute, are you trying to make an external USB-Harddisk bootable?
    • Carl Smotricz
      Carl Smotricz over 14 years
      @Bobby: Yes, I was trying to make an extern USB disk bootable. It's possible to configure it as bootable in the BIOS, and it does kinda boot, though inconsistently. I gave up without figuring out the whole problem, but it seems to have been timing related. It would work sometimes and sometimes not. I'm hoping that by the next time I have similar problems, grub2 will be more standard and have more robust error handling.
  • Carl Smotricz
    Carl Smotricz over 14 years
    Sorry to be so late with my answer: No, Grub didn't drop me into a rescue prompt; it came out with an error message and halted. I've meanwhile given up, partly because the requirement I had went away. Hopefully things will work better next time I try this stunt, whenever that will be. I'm going to accept your answer in appreciation of the work you put in, thank you!
  • Tom
    Tom over 10 years
    When I get to step 5. @ls /boot/@ I get the error "out of disk" again. Any idea what I should do at this point?