On Mon, Mar 25, 2013 at 1:08 AM, Simon Hobson <[email protected]> wrote: > This is probably something really simple I've missed, but ... > > Sometimes I have to try and repair systems, and often it is "just" a matter > of booting it with another grub and then running grub-install on the system > so it can repair it's own grub. But, for something like a Debian Live disk, I > can't see how to break out of the grub menu and get to specify my own kernel > and initrd lines. > The specific case is where I've copied all the files to a new machine or > disk, so everything is there but the bootloader. Or the bootloader is damaged > in some way. > > Also, back in Grub 1 days, I could remember how to install grub just by > mounting the filesystem, chrooting to it, and issuing a few grub commands. > I've never managed to make this work with 1.99 (as currently installed with > Debian). Is there a simple set of commands that will do what worked in grub 1 > (going form memory here) : > hd0 = /dev/sda > root = (hd0,0) > install (hd0)
Assuming you've already chrooted (as you stated), then it's only one command "grub-install /dev/sda". If you haven't chrooted then it's two commands, "mount /dev/sda1 /mnt/ && grub-install --boot-directory=/mnt/boot/ /dev/sda". Also note that grub legacy also had a grub-install, and that your method from the grub shell would only have worked if a proper stage2 file already existed in /boot/grub/, which is something that grub-install would do. With grub2, grub-install copies all modules to /boot/grub/ and generates an appropriate core.img for your particular configuration (including support for things like GPT,LVM,LUKS,btrfs,zfs, etc as needed to access /boot/grub/). -- Jordan Uggla (Jordan_U on irc.freenode.net) _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
