How to reinstall Grub2 from a live ROSA Desktop Linux

Guides, tutorials & docs
Post Reply
User avatar
andreas
Utente
Utente
Posts: 281
Joined: 1 November 2008, 20:03

How to reinstall Grub2 from a live ROSA Desktop Linux

Post by andreas »

After a windows installation or reinstallation (you know, it may happen with this stuff) you loose your grub2 boot manager. On my dual boot system it even happened me several times due to my particular system configuration that was not correctly handled either by windows or Rosa. Now that problem apparently has gone, but the need to re-install windows from time to time persists.

So, that's how to proceed starting from your live Rosa boot cd or usb (the latter is faster).

When your live Rosa is up, open a root console (Konsole from rosa start, then in the console digit su to login as root)

Now you have to identify your root partition, digit

Code: Select all

fdisk -l 
it is in the form sdxx.

Below an example of fdisk output from my pc

Code: Select all

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 256.1 GB, 256060514304 bytes, 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfd62263d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *      273105   461740229   230733562+   7  HPFS/NTFS/exFAT
/dev/sda2       461744073   500103449    19179688+   5  Extended
/dev/sda5       461744128   500103449    19179661   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 2748.8 GB, 2748767535104 bytes, 5368686592 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1fafbaf6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 2528.9 GB, 2528865419264 bytes, 4939190272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1fafbaf7

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1  4294967295  2147483647+  ee  GPT

Disk /dev/sdd: 713.8 GB, 713814966272 bytes, 1394169856 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1fafbaf8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *          63     9912104     4956021   82  Linux swap / Solaris
/dev/sdd2         9912105  1394168894   692128395    5  Extended
/dev/sdd5         9912168  1394168894   692128363+  83  Linux
Ok, my pc is a mess, but in my case sda is the boot disk and sda5 my root partition.

Now you have to mount your root partition

Code: Select all

mount /dev/sdxx /mnt
sdxx in my case is sda5, of course.

At this point you can install grub2 on your boot disk

Code: Select all

grub2-install --root-directory=/mnt/ /dev/sdx
in my case sdx is sda. Pay attention to the leading and ending forward slashes in mnt.

At this point you have to renew the configuration of grub2, as grub needs to recognize the new windows partition, or, as windows re installations tend to change the UUID of the disk, acquire the new UUID. So in the console digit

Code: Select all

update-grub2
and you're done.

You can now reboot and see again your grub boot loader
AndreaS

Procio Intel i7-4930k, mobo Asus X79-Deluxe, Adaptec raid 7805, Nvidia Quadro 6000 - Rosa Fresh R3 X64

User avatar
NicCo
Amministratore
Amministratore
Posts: 4740
Joined: 6 December 2007, 19:54

Re: How to reinstall Grub2 from a live ROSA Desktop Linux

Post by NicCo »

@ Andreas
Thanks having accepted my request writing this very usefull Guide!

Right now, I forwarded this link to ROSA devel ML, so they can share





bye, NicCo
.
--- Professional experience ---
Kernel designer, engineer, maintainer and tester for ROSA Desktop and OpenMandriva Lx O.S.

--- currently I'm playing with ---
LTS Kernels > Linux 4.1.12-nrjQL <<< Linux 3.18.17-nrjQL <<< Linux 3.14.46-nrjQL
EOL Kernels > Linux 3.19.8-nrjQL <<< Linux 3.17.8-nrjQL <<< Linux 3.15.10-nrjQL

User avatar
NicCo
Amministratore
Amministratore
Posts: 4740
Joined: 6 December 2007, 19:54

Re: How to reinstall Grub2 from a live ROSA Desktop Linux

Post by NicCo »

Now it's available also in Russian:

ROSA Wiki:
http://wiki.rosalab.ru/ru/index.php/%D0 ... 0%B0_Grub2





bye, NicCo
.
--- Professional experience ---
Kernel designer, engineer, maintainer and tester for ROSA Desktop and OpenMandriva Lx O.S.

--- currently I'm playing with ---
LTS Kernels > Linux 4.1.12-nrjQL <<< Linux 3.18.17-nrjQL <<< Linux 3.14.46-nrjQL
EOL Kernels > Linux 3.19.8-nrjQL <<< Linux 3.17.8-nrjQL <<< Linux 3.15.10-nrjQL

Post Reply