{"id":29,"date":"2016-01-31T14:34:19","date_gmt":"2016-01-31T13:34:19","guid":{"rendered":"https:\/\/kerms.hobby-site.org\/?p=29"},"modified":"2016-01-31T14:34:19","modified_gmt":"2016-01-31T13:34:19","slug":"repair-linux-mbr-after-windows-install","status":"publish","type":"post","link":"https:\/\/kerms.hobby-site.org\/?p=29","title":{"rendered":"Repair Linux MBR after Windows install"},"content":{"rendered":"<h2><span id=\"Situation\" class=\"mw-headline\">Situation<\/span><\/h2>\n<p>After installing Windows alongside Linux, GRUB has been replaced by the Windows bootloader. How do you get GRUB back into the MBR?<\/p>\n<p>Note &#8222;has been&#8220;. When openSUSE is installed according to recommendation to keep a <a class=\"external text\" href=\"https:\/\/old-en.opensuse.org\/Bugs\/grub#How_does_a_PC_boot_.2F_How_can_I_set_up_a_working_GRUB.3F\" rel=\"nofollow\">neutral MBR<\/a> that Grub will have been installed to a partition rather than the MBR, which will result in a simpler &#8222;repair&#8220; procedure..<\/p>\n<h2><span id=\"Procedure\" class=\"mw-headline\">Procedure<\/span><\/h2>\n<p>You have to make sure to be able to boot into openSUSE. You can do this either by using the Rescue System mode on the installation DVD or by using a CD with<a class=\"external text\" href=\"http:\/\/www.plop.at\/en\/bootmanager.html\" rel=\"nofollow\">Plop Boot Manager<\/a> or <a class=\"external text\" href=\"http:\/\/www.supergrubdisk.org\/\" rel=\"nofollow\">Super Grub Disk<\/a>, for example. Note that you can let boot any ISO on USB with <a class=\"external text\" href=\"http:\/\/unetbootin.sourceforge.net\/\" rel=\"nofollow\">UNetbootin<\/a>. Then you can repair the Master Boot Record with a few commands:<\/p>\n<h3><span id=\"If_using_grub2_.28default_on_openSUSE_13.1.29\" class=\"mw-headline\">If using grub2 (default on openSUSE 13.1)<\/span><\/h3>\n<p>Open a terminal and type commands. Firstly elevate your priviledges (not required in Rescue System mode):<\/p>\n<pre>sudo -i\r\n<\/pre>\n<p>Figure out from the partition table what is your (main) linux partition, e.g. \/dev\/sda3:<\/p>\n<pre>fdisk -l\r\n<\/pre>\n<p>Then type:<\/p>\n<pre>mount \/dev\/sda3 \/mnt\r\nmount --bind \/dev \/mnt\/dev\r\nmount --bind \/proc \/mnt\/proc # maybe superfluous\r\nmount --bind \/sys \/mnt\/sys # maybe superfluous\r\nmkdir \/mnt\/mounts # could be needed if booted with rescue openSUSE 13.1\r\nmount --rbind \/mounts \/mnt\/mounts # could be needed if booted with rescue openSUSE 13.1\r\n<\/pre>\n<p>If this preparation went well, perform the actual change:<\/p>\n<pre>chroot \/mnt\r\ngrub2-install \/dev\/sda\r\nexit\r\n<\/pre>\n<p>And if that succeeded,<\/p>\n<pre>reboot\r\n<\/pre>\n<h3><span id=\"If_using_legacy_grub\" class=\"mw-headline\">If using legacy grub<\/span><\/h3>\n<p>Open a terminal and type (no &#8217;sudo&#8216; is required in Rescue System mode):<\/p>\n<pre> sudo \/usr\/sbin\/grub\r\n<\/pre>\n<p>Then execute the following commands:<\/p>\n<pre> grub&gt; find \/boot\/grub\/stage2 (will show the path of actual grub installation, you will need on the next step)\r\n grub&gt; root (hdx,y)\r\n grub&gt; setup (hdx)\r\n grub&gt; quit\r\n<\/pre>\n<p>Caution: x represents the disk number and y represents the partition number where GRUB stage2 is installed. The numbering starts at 0. For example, if the first command outputs <i>(hd0,5)<\/i> you should do <i>root (hd0,5)<\/i> followed by <i>setup (hd0)<\/i>. After rebooting, the GRUB menu should reappear.<\/p>\n<p>This solution was sourced from <i>please_try_again<\/i> on the forums.<\/p>\n<h3><span id=\"If_a_neutral_MBR_was_employed\" class=\"mw-headline\">If a neutral MBR was employed<\/span><\/h3>\n<p>All that is necessary is to use any available partitioning tool to move the boot flag from the Windows partition to the partition to which Grub is installed. This is easily done with FDISK (which calls the boot flag the active flag) from a DOS boot or from DISKPART or Disk Management from a Windows boot, or using one of the partitioning tools from a generic bootable media such as the <a class=\"external text\" href=\"http:\/\/www.ultimatebootcd.com\/\" rel=\"nofollow\">Ultimate Boot CD<\/a> or <a class=\"external text\" href=\"http:\/\/www.hirensbootcd.org\/\" rel=\"nofollow\">Hiren&#8217;s BootCD<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Situation After installing Windows alongside Linux, GRUB has been replaced by the Windows bootloader. How do you get GRUB back into the MBR? Note &#8222;has been&#8220;. When openSUSE is installed according to recommendation to keep a neutral MBR that Grub &hellip; <a href=\"https:\/\/kerms.hobby-site.org\/?p=29\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/29"}],"collection":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":1,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}