You are not logged in.

#1 2015-08-22 04:26:38

GreenRaccoon23
Member
Registered: 2014-09-27
Posts: 33

Reinstalling Grub

This MIGHT be a simple fix, but I'm hoping to get someone else's opinion before I unleash any more demons on my computer. I'm trying to fix GRUB. I'll post some background info to explain exactly what has gone wrong:

I decided to do the "update" to Windows 10 on my laptop. After it downloaded about 2%, I got the blue screen of death. It rebooted and thankfully Windows still booted up perfectly fine. Still, I decided that I'd had enough of Windows for the time being, so I chose to forget about the Windows 10 update and to go back to trusty Arch instead. But after I tried booting up Arch, I got some nasty error messages. I didn't write them down (and kicking myself for that), but it was something terrible like "/dev/sda does not exist." And then I got the infamous:

Bailing out, you are on your own. Good luck.

followed by the BusyBox shell prompt.

"/dev/sda" is an ssd with Arch on "/dev/sda1" (ext4) and Windows 7 on "/dev/sda2" (ntfs). I haven't done any major updates on Arch in the past couple of days, no kernel updates or anything. Before trying to run the Windows 10 update, I double checked that everything on my Arch partition was working and I backed up my most important files to another drive (thankfully).

I had a flash drive of Fedora 22, so I booted that up and ran "fdisk -l" to make sure that my ssd hadn't quit working. The output looked exactly as it should, so I'm guessing that the drive itself still works fine. I thought maybe there was a problem with GRUB, so I tried reinstalling it through the flash drive:

sudo mount /dev/sda1 /mnt
sudo grub2-install --root-directory=/mnt /dev/sda

^ This command reported

Installation finished. No errors detected.

This method has worked for me before (on Ubuntu, at least), but after booting up, I just get a GRUB prompt. I had the idea that maybe the "grub2-install" command in Fedora is different than the "grub-install" command that Arch uses. Is that possible? If so, I have an Xubuntu iso on another computer and can make a bootable flash drive from it right now. Would it be worth a try to run the above commands through an Xubuntu flash drive (replacing "grub2-install" with "grub-install")? Would it be better to download an iso of Arch and run some chroot commands to reinstall GRUB? Or is there a better option I'm not thinking of?

I haven't booted up Windows in months and have had 0 problems with my computer. But as soon as I do, Windows kills it. Unbelievable.

Last edited by GreenRaccoon23 (2015-08-22 06:07:24)

Offline

#2 2015-08-22 04:37:07

nikolakn
Member
Registered: 2015-08-18
Posts: 5

Re: Reinstalling Grub

try
grub-install --recheck --root-directory=/mnt /dev/sda
grub-mkconfig -o /mnt/boot/grub/grub.cfg

Offline

#3 2015-08-22 06:06:57

GreenRaccoon23
Member
Registered: 2014-09-27
Posts: 33

Re: Reinstalling Grub

nikolakn wrote:

try
grub-install --recheck --root-directory=/mnt /dev/sda
grub-mkconfig -o /mnt/boot/grub/grub.cfg

Thanks! I forgot to run grub-mkconfig. Unfortunately, I still get the GRUB prompt after booting up like before.

When I ran "grub-mkconfig...", it did find all my partitions correctly, which is a really good sign because it means that the problem is less likely that my ssd is dead. I'll try running it on the Xubuntu flash drive just for kicks and see if that makes a difference. I'll update with the results.

UPDATE

I tried running the commands on the Xubuntu flash drive and got an error with the "grub-mkconfig..." one:

$ sudo fdisk -l
#Everything good
$ sudo grub-install --recheck --root-directory=/mnt /dev/sda
...
Installation finished. No error reported.
$ sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg
/usr/sbin/grub-probe: error: failed to get canonical path of '/cow'.

That's something at least. I'll Google whatever that means and see if I come up with something.

UPDATE2

I tried chrooting:

$ sudo chroot /mnt
# update-grub
/usr/bin/grub-probe: error: cannot find a device for / (is /dev mounted?).
# fdisk -l
fdisk: cannot open /proc/partitions: No such file or directory

It is possible normally to run 'update-grub' ('grub-mkconfig -o /boot/grub/grub.cfg') under chroot, right?

UPDATE3

I got a tip from http://askubuntu.com/questions/88384/ho … ng-windows. BEFORE running "chroot", I needed to run this:

$ sudo mount /dev/sda1 /mnt
$ for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
$ sudo chroot /mnt
# update-grub

Perfect! But...then I tried rebooting, and when the GRUB screen should have popped up:

error: symbol 'grub_real_boot_time' not found.
Entering rescue mode...
grub rescue>

Last edited by GreenRaccoon23 (2015-08-22 06:43:47)

Offline

#4 2015-08-22 07:00:35

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Reinstalling Grub

I'll recommend using an Arch live media and then use arch-chroot to reinstall grub. Make sure to run grub-mkconfig too.

Offline

#5 2015-08-22 07:39:26

GreenRaccoon23
Member
Registered: 2014-09-27
Posts: 33

Re: Reinstalling Grub

Alright I got GRUB to work again. I booted up the Xubuntu flash drive and ran this:

$ sudo mount /dev/sda1 /mnt
$ for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
$ sudo chroot /mnt

Then I edited my '/etc/fstab' file and commented out all the lines except my Arch partition and its swapfile. Then I ran (still under chroot):

# grub-install --recheck /dev/sda
# update-grub

I rebooted and GRUB works! Arch still doesn't, but I got the error message that I should have written down earlier:

starting version 224
arch: clean, 1213454/11468800 files, 33088983/45875200 blocks
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
:: btrfs_advanced [FATAL]: Unable to mount root subvolume
ERROR: Failed to mount the real root device.
Bailing out, you are on your own. Good luck.

sh: can't access tty; job control turned off
[rootfs /]#

Here's the output of 'fdisk -l' for '/dev/sda':

Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 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
Disklabel type: dos
Disk identifer: ...

Device     Boot      Start        End    Sectors   Size  Id  Type
/dev/sda1             2048  367003647  367001600   175G  83  Linux
/dev/sda2  *     367003648  488396799  121393152  57.9G   7  HPFS/NTFS/exFAT

Here's the uncommented lines in my "/etc/fstab" file. These options have always worked right:

UUID=...    /      ext4   rw,discard,noatime,data=ordered   0 1
/swapfile   none   swap   defaults                          0 0
x33a wrote:

I'll recommend using an Arch live media and then use arch-chroot to reinstall grub. Make sure to run grub-mkconfig too.

Ok I'll try that.

Last edited by GreenRaccoon23 (2015-08-22 08:05:47)

Offline

#6 2015-08-22 14:00:26

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Reinstalling Grub

Btrfs came out of nowhere in this thread - can you describe the steps you took to get your btrfs partition going? Maybe something went wrong there.

Offline

#7 2015-08-22 15:55:25

nikolakn
Member
Registered: 2015-08-18
Posts: 5

Re: Reinstalling Grub

wiki

If you accidentally install a bootloader like GRUB to the Windows partition or damage the boot record in some other way, you will need to use a utility to repair it. Microsoft includes a boot sector fix utility FIXBOOT and an MBR fix utility called FIXMBR on their recovery discs, or sometimes on their install discs. Using this method, you can fix the reference on the boot sector of the first partition to the bootloader file and fix the reference on the MBR to the first partition, respectively. After doing this you will have to reinstall GRUB to the MBR as was originally intended (that is, the GRUB bootloader can be assigned to chainload the Windows bootloader).

Last edited by nikolakn (2015-08-22 15:59:46)

Offline

#8 2015-08-26 11:59:09

GreenRaccoon23
Member
Registered: 2014-09-27
Posts: 33

Re: Reinstalling Grub

twelveeighty wrote:

Btrfs came out of nowhere in this thread - can you describe the steps you took to get your btrfs partition going? Maybe something went wrong there.

I had a distro running btrfs on a separate disk. I commented it out in my "/etc/fstab" file (and run `update-grub`) and the problem still occurred. I could access all my files through a bootable flash drive, so I decided to just copy all my important files to another drive and reinstall arch.

Offline

Board footer

Powered by FluxBB