Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How to reinstall bootloader without reinstalling the entire system

  1. #1

    Question How to reinstall bootloader without reinstalling the entire system

    Hello - i don't know what really went wrong with a system I run but after a recent batch of upgrades/security fixes I was told that I needed to reboot my system, which I tried doing, and my poor system didn't come back up. It appears that something has gone wrong early on in the reboot/system startup phase and I kinda suspect the boot loader or early start of the system got corrupted somehow. So I am attempting to start at the beginning and want to reinstall the Grub2 bootloader to see if that will fix things. I do NOT want to do a re-installation of the entire system, since I am running a lot of services and it would take me days if not weeks to reconfigure everything from scratch.

    I have tried to use the installation DVD to simply do a systems upgrade but that did not provide me with any joy. Google searches led me to a number of variations on the following theme which I have been attempting to follow, but again so far no joy in being able to follow these steps. First I downloaded and set up a Live DVD with an x64 bit system (Fyrelinux) and booted it up, brought up a console and did an su - to become the root user. Then tried the following -

    Code:
    mkdir /tmp/mydir
    mount /dev/sdd2 /tmp/mydir
    mount --bind /dev /tmp/mydir/dev
    mount --bind /proc /tmp/mydir/proc
    mount --bind /sys /tmp/mydir/sys
    chroot /tmp/mydir
    grub2-install /dev/sdd
    The root partition of the system I want to boot up (Leap 42.3 x64) is located at /dev/sdd2 and the BIOS is set up to boot the system in legacy mode, not in EFI mode. From all appearances, after I mount /dev/sdd2 the contents look like what I would expect. I have ran fsck on it also and no errors were reported. When I reach the chroot step things go sideways. Commands like grub2-install and even the ls (and similar /bin /sbin etc) commands are no longer available. Even the keyboard, like the backspace key gets weird and does not work as expected. So I am not sure what I am doing wrong, but I will say that I found a lot of Google hits all leading me to instructions that are very similar to what I have shown. This kinda makes me believe that something within the chroot command has either changed or is broken? Or something else is now needed, that wasn't when all the advice I found with Google was written?

    Thanks in advance for any advice and/or help offers, and please keep it simple with easy to following instructions. I won't claim to be a Linux guru myself, I know just enough to be considered dangerous! Marc...

  2. #2
    Join Date
    Sep 2012
    Posts
    5,135

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Show output of "btrfs su li /tmp/mydir" and "btrfs su get-default /tmp/mydir".

  3. #3

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Quote Originally Posted by arvidjaar View Post
    Show output of "btrfs su li /tmp/mydir" and "btrfs su get-default /tmp/mydir".
    Hi avidjarr - I am not using a btrfs filesystem (Ext4) so the output simply is reporting this as an error. (I tend to be a skittish slow adopter of new fangle things, and I experienced some difficulties with btrfs when I tried it so when back to Ext4. ) Marc.

  4. #4
    Join Date
    Sep 2012
    Posts
    5,135

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Can you still access /etc on your root? What is the content of /etc/fstab?

  5. #5

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Quote Originally Posted by arvidjaar View Post
    Can you still access /etc on your root? What is the content of /etc/fstab?
    I can, bit tricky how to copy it across to my laptop (no network) but I figured out a way to "sneaker net" it using a USB stick.... This is it, and yes there is a lot of history behind it, stuff from way back that I preserve. One thing I will mention is that while there is a /boot/efi partition I do not believe I am using efi. I believe I have disabled it in the BIOS and am using the legacy bootloader... I think that when I first installed Leap42.? that it was assumed that I would be using EFI but I had troubles with it so I disabled it and that is just a leftover ruminant that I have not bothered to get rid of. (I may try EFI again someday.)


    Code:
    UUID=25cb1647-baef-4e16-8472-d029cfad9fa6 swap                 swap       defaults              0 0
    UUID=ebf32d3d-bbdd-4d70-99e5-c15735bcd81d /                    ext4       acl,user_xattr        1 1
    UUID=F549-5098       /boot/efi            vfat       umask=0002,utf8=true  0 0
    UUID=bb3a7d35-cdfb-464b-9c4f-2b562e13d7d7 /home                ext3       defaults              1 2
    UUID=9241a80a-1670-4f08-b475-c0c7a769095d /SuSE12.3            ext4       defaults              1 2
    UUID=277b7114-e703-4ac6-a621-c076305b151e /SuSE42.1            ext4       defaults              1 2
    UUID=c8c10691-6447-4bfc-a3cf-2a91a2490129 /data1               ext4       defaults              1 2
    UUID=8db6a5e9-592e-45a2-a5e5-55f30914cb69 /var                   ext4       defaults              1 2
    UUID=9ea1620f-7c9b-4159-835b-133ce0f7cadd /srv                 xfs        defaults              1 2
    UUID=585ba71e-3f31-4b07-9100-c3997311738e /data                xfs        defaults              1 2
    UUID=d0947373-48e3-4ede-bc5f-8d210bb525d5 /mail                xfs        defaults              1 2
    
    / /slash none  bind
    UUID=10dec5c6-981f-488e-87dc-27368b8f233b /tmp                 ext4       acl,user_xattr        1 2
    
    # UUID=3ec87644-3595-4ab6-9379-546e311b5ae2 /websites            ext4       acl,user_xattr        1 2
    UUID=3ec87644-3595-4ab6-9379-546e311b5ae2 /websites            ext4       loop,nodev,nosuid,acl,user_xattr        1 2
    UUID=7f1befa9-b317-4849-a870-6e04c9268f3a /usr                   ext4       acl,user_xattr        1 2
    UUID=c35dc661-eedb-454d-a895-401eca223be0 /sdb1                xfs        defaults              1 2
    UUID=4819e0f7-7085-45ce-bb2b-15e3cf7b1d20 /sdb2                xfs        defaults              1 2

  6. #6
    Join Date
    Sep 2012
    Posts
    5,135

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Quote Originally Posted by MarcChamberlin View Post
    Code:
    UUID=7f1befa9-b317-4849-a870-6e04c9268f3a /usr                   ext4       acl,user_xattr        1 2
    When you make most critical part of your root separate filesystem, you obviously need to mount this filesystem to get working root.

  7. #7
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,450

    Default Re: How to reinstall bootloader without reinstalling the entire system


  8. #8

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Quote Originally Posted by arvidjaar View Post
    When you make most critical part of your root separate filesystem, you obviously need to mount this filesystem to get working root.
    Thanks avidjaar! That makes sense now that you pointed it out to me! I just couldn't see it so it is good to have more experienced eyes looking over my shoulders! So mounting /usr got me past the chroot hurdle and on to the next one... I am doing some Google research to see if I can figure this next problem out but will post it here in case you or someone else has a quick answer to speed me along the way....

    When I tried the command to install grub2 -
    Code:
    grub2-install /dev/sdd
    this is what happened -

    Code:
    localhost:/ # grub2-install /dev/sdd
    Installing for i386-pc platform.
    grub2-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
    grub2-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
    grub2-install: error: will not proceed with blocklists.
    Do you know what this means? Thanks again, Marc...

  9. #9

    Default Re: How to reinstall bootloader without reinstalling the entire system

    I goofed up a bit when I earlier posted my fstab file. I had picked up the wrong one from an earlier installation of openSuSE Leap 42.2. instead of the one I am using for Leap 42.3.
    I can repost the correct version if that will be useful but at least I am past the earlier hurdle where I could not do anything after the chroot command was given.

    Anywise, my Google research about why the grub2-install command is failing shows that a lot of helpers assisting others with this same problem often ask for the output from doing a gdisk -l be shown. So I will go ahead and post it here in the hope that it will be useful....


    Code:
    localhost:/ # gdisk -l /dev/sdd
    GPT fdisk (gdisk) version 0.8.8
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sdd: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): CE411C8A-1FF7-4104-AE2B-081DFB7D7DAB
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 104859629 sectors (50.0 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048          321535   156.0 MiB   EF00  primary
       2          321536        21301247   10.0 GiB    0700  primary
       3       251979776       293941247   20.0 GiB    0700  primary
       4       126158848       231014399   50.0 GiB    0700  primary
       5       231014400       251979775   10.0 GiB    0700  primary
       6       293941248       557342719   125.6 GiB   0700  primary
       7       557342720       976773119   200.0 GiB   0700  primary
    Thanks as always for your patience and assistance! Marc...

  10. #10

    Default Re: How to reinstall bootloader without reinstalling the entire system

    Quote Originally Posted by john_hudson View Post
    Thanks John for the pointer, I will take a look see!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •