grub---problem

Ralf Mardorf silver.bullet at zoho.com
Mon Nov 30 07:35:44 UTC 2015


On Mon, 30 Nov 2015 08:19:29 +0100, Ralf Mardorf wrote:
>You didn't read
>https://help.ubuntu.com/community/Grub2/Installing#via_the_LiveCD_terminal ;)
>
>via the LiveCD terminal
>
>This method uses the terminal from a LiveCD. The user must know the
>device name/partition of the installed system (sda1, sdb5, etc), which
>is then mounted from the LiveCD. GRUB 2 files are copied from the
>LiveCD libraries to the proper locations and MBR.
>
>This operation will write to the MBR and restore the modules and
>core.img to /boot/grub. It will not replace or restore grub.cfg or fix
>corrupted files. Boot the LiveCD, select "Try It", and open a terminal.
>
>info.png When using a LiveCD, due to GRUB 2 changes between Ubuntu
>releases, it is recommended that the user boots a LiveCD of the same
>release (11.10, 12.04, etc) as the release to be repaired. If the user
>has installed a different version of GRUB 2, use a LiveCD with the same
>GRUB 2 version.
>
>If necessary, use the fdisk command to help determine the partition on
>which Ubuntu is installed. The fdisk option "-l" is a lowercase "L".
>Look for one of the appropriate size or formatting. Running sudo blkid
>may provide more information to help locate the proper partition,
>especially if the partitions are labeled. The '
>
>    sudo fdisk -l
>    sudo blkid
>
>In the following commands:
>
>    Use the partition number of the Ubuntu installation with mount
>    command.
>
>    Do not use the partition number with the grub-install command.
>
>    X is the drive letter (a, b, c, etc.); Y is the partition number
>    (1, 5, etc).
>
>    --boot-directory is the folder in which the GRUB folder is located.
>    This is normally /boot but should be changed if the grub folder is
>    located elsewhere.
>
>    On systems with a separate /boot partition, that partition should
>    be mounted to /mnt/boot. For instance:
>    sudo mount /dev/sda6 /mnt/boot
>
>    grub-install will restore missing files in the grub folder but will
>    not restore intentionally deleted or corrupted files. To accomplish
>    these tasks GRUB 2 must be completely removed and reinstalled.
>
>    sudo mount /dev/sdXY /mnt # Example: sudo mount /dev/sda5 /mnt
>    sudo grub-install --boot-directory=/mnt/boot /dev/sdX # Example:
>    sudo grub-install --boot-directory=/mnt/boot /dev/sda

Ramachandran, FWIW the above does not generate a new grub.cfg
(menu), as mentioned by Oliver, if you need this, then you need to
chroot:

>the chroot is required because grub in ubuntu never uses grub-mkconifg
>directly, instead you use update-grub which assembles the proper ubuntu
>config from info on the rootfs ... 
>ergo: you need to chroot if you need to generate a config ...
>if the OP is just repairing a messed up boot record using grub-install
>for a system that has a working config already, then the chrooting is
>indeed not necessary ...

Regards,
Ralf




-- 
http://www.grundgesetz-gratis.de/





More information about the ubuntu-users mailing list