Well, I just made a pretty big milestone, so I thought I would put it
down here in case anyone else needs to follow this procedure to get
things working again.
Also, please comment and correct me on anything I could have done better!
In the past I have had just enough knowledge to be dangerous. Now I am
actually getting to where I can do something significant, although I am
still by all means an amateur.
Ok, here is the situation. I have installed opensuse 13.2 dual boot in
UEFI mode (not secure mode) with Windows 8.1, which came installed on my
system. I had been running opensuse pretty smoothly for about 3 days,
and had booted up a few times in Windows just to check things, but never
spending more than about 5 minutes there before going back into linux.
This time, I needed to finish up some things on Windows 8.1 with virus
protection and all that, even though I am probably not ever going to use
it again, so I booted into Windows and set that up. In order to finish
what I was doing I had to leave Windows running for a couple of hours. I
think that is what did it - Windows had enough time to go in and find
that it didn’t like the bootloader that was there, and so it changed the
bootloader back to Windows only mode.
When I went to reboot again after having the laptop running Windows for
a couple of hours, my pc would only go into Windows. It would not bring
up grub2, and was only going for windows. I tried to go into Windows, go
into a command prompt as administrator, and run the command:
bcdedit /set {bootmgr} path \EFI\Boot\bootx64.efi
I had predetermined that path from when I was previously running in
linux and saw the path as the mounted drive in my OS.
Then also to see if I could get it to boot in secure mode (I got the
path from someone’s blog):
bcdedit /set {bootmgr} path \EFI\opensuse\shim.efi
This also didn’t bring grub back, so I left it at that. I searched and
found some other posts here on the forums that said they had rescued
their system using the SuperGrub cd, and this gave me an idea to use the
rescue installation dvd, the same dvd that I installed 13.2 with.
Here is the procedure that I came up with that worked, and I had to do
these in order.
First, booted into the rescue installation, and logged in by typing
“root” as the login id. No password is required.
Then I ran fdisk to verify my GPT partitions:
# fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 20EA9E38-5E0A-4565-8CD0-655FE85074D5
Device Start End Sectors Size Type
/dev/sda1 2048 206847 204800 100M EFI System
/dev/sda2 206848 2050047 1843200 900M Windows recovery
environment
/dev/sda3 2050048 2312191 262144 128M Microsoft reserved
/dev/sda4 2312192 201336831 199024640 94.9G Microsoft basic data
/dev/sda5 201336832 232615935 31279104 14.9G Linux swap
/dev/sda6 232615936 291209215 58593280 28G Linux filesystem
/dev/sda7 291209216 349802495 58593280 28G Linux filesystem
/dev/sda8 349802496 1619333119 1269530624 605.4G Linux filesystem
/dev/sda9 1619333120 1814644735 195311616 93.1G Linux filesystem
So after this I had to set things up. So I ran the following commands to
mount the systems and change the root:
# mount /dev/sda6 /mnt
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc
# mount --bind /sys /mnt/system
# chroot /mnt
I found that when I did everything correctly, then the prompt changed to
the color red.
When I first tried that series of commands, I tried to change the root
after mounting /dev, and then afterwards mounting proc and sys by just
typing “mount /proc”, but it didn’t work. The prompt never changed to
red, and I couldn’t restore grub.
Apparently you could do that (mount proc and sys after changing root) in
an older version of suse, but in this version I kept getting an error
that said something like “directory does not exist” and they wouldn’t
mount. So the order in which I wrote them above is the way in which they
needed to be mounted.
Again, when this was done correctly, the prompt changed to red color
after changing the root.
At this point I tried to run the grub rescue commands without mounting
the EFI partition, but it didn’t work.
So instead I mounted the EFI partition, like this:
# mount /dev/sda1 /boot/efi/
This mounted ok, but it also gave an error that said “Volume was not
properly unmounted. Some data may be corrupt. Please run fsck.”
I decided to proceed ahead, hoping it would work, and I ran the
following grub commands:
# grub2-mkconfig -o /boot/grub2/grub.cfg
# grub2-install /dev/sda1
As you can see, my setup has /dev/sda1 as the EFI partition, so that is
what I used.
After that I rebooted, and grub came came back, and I was back up and
running in opensuse!
So I hope that I don’t have to do this too often, but it worked. Hope
this is helpful for other folks that might have had to do the same
thing. For me, since I don’t plan on booting into Windows very often, I
don’t think it is going to be something that I have to do regularly.
However, if someone is regularly booting into windows, then it would be
a pain in the neck to have to do this all the time.
As a side note, for my windows needs that I have to work on from time to
time, I run oracle’s version of VirtualBox, which runs very well. That
way I don’t normally have to boot into Windows, but I just use VirtualBox.
–
G.O.
Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB