Grub dead after a schedualed shutdown

Last time my laptop had weird problem (couldn’t boot to GUI until I reinstalled new kernel) after I used Ktorrent’s scheduled shutdown.

Yesterday I scheduled a shutdown in console with “shutdown 40” and went to bed. This morning my laptop can’t boot at all

error: file ‘/grub/x64-pc/normal.mod’ not found.
This is a tri-boot system as listed in my signature. Opensuse takes control of the grub2, which supports both UEFI and secure boot. But I have secure boot option disabled in BIOS as manjaro does not support it.

The first thing I did is to boot it with my portable opensuse and did a fsck to the 1TB drive which has 3 os installed. Here’s the message:

# fsck /dev/sda                                                                                                                                                                                                             
fsck from util-linux 2.23.2                                                                                                                                                                                                          
e2fsck 1.42.8 (20-Jun-2013)                                                                                                                                                                                                          
ext2fs_open2: Bad magic number in super-block                                                                                                                                                                                        
fsck.ext2: Superblock invalid, trying backup blocks...                                                                                                                                                                               
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda                                                                                                                                                             
                                                                                                                                                                                                                                     
The superblock could not be read or does not describe a correct ext2                                                                                                                                                                 
filesystem.  If the device is valid and it really contains an ext2                                                                                                                                                                   
filesystem (and not swap or ufs or something else), then the superblock                                                                                                                                                              
is corrupt, and you might try running e2fsck with an alternate superblock:                                                                                                                                                           
    e2fsck -b 8193 <device> 

I wonder if I should do as suggested “e2fsck -b 8193 /dev/sda”?

Also, can I do a regular grub rescure as instructed here by caf?

Thanks. Friday evening, grub is broken…:frowning:

It is very unlikely that you have filesystem on /dev/sda. You probably have several partitions and filesystem is on them. Please post output of “fdisk -l; blkid”.

Well, that I can confirm you that my laptop OS is on /dev/sda. /dev/sdb is my portable drive. And blkid just shows those two disk, a and b, nothing unusual.

The thing I don’t understand is why it says ext2, I don’t have ext2 partition, all is fat, ntfs, ext4, swap. So I don’t know if running “e2fsck - 8193 <device>” is safe.

Other question is , can I just repair the grub according to the instruction.

Can you just provide the requested output. Enclose it in a code block (the “#” icon).

The thing I don’t understand is why it says ext2, I don’t have ext2 partition, all is fat, ntfs, ext4, swap. So I don’t know if running “e2fsck - 8193 <device>” is safe.

So now we learn that you actually have such things as partitions. They probably are something like “/dev/sda1”, “/dev/sda2”, etc.

You should be running “fsck” on partitions, not on the entire disk. The output that was requested should have shown partitions, and not just disks.

We cannot help you without some useful information about your system. Thus far, the information that you have provided is wrong – it is obviously wrong.

If you cannot boot from the hard drive, then boot from a live linux CD to get the requested information.

OK. Now I understand the fsck error. I checked partition by partition, no error was found.

Only now I notice that grub is looking in the wrong directory for normal.mod

Correct dir is (hd0,gpt9)/boot/grub2/x86_64-efi/normal.mod
but it is searching in …/grub/x86… I tried in the grub_rescue with “insmod (hd0,gpt9)/boot/grub2/x86_64-efi/normal.mod”
It reported a new error “grub_isprint” not found…

I’m not at all clear on what you are doing. My guess is that you are trying to boot manjaro rather than opensuse.

If this is your Lenovo, try hitting F12 during boot. The BIOS should give a boot menu. See if “opensuse” is listed on that menu.

It listed “manjaro and windows” but no opensuse. However, Opensuse used to control the whole grub thing as manjaro doesn’t support secure boot. So the grub installed by suse support secure boot I have it disabled in BIOS for manjaro though.

Now opensuse is not listed in the boot menu, manjaro is listed but will prompt the same grub error. The only bootable is windows 8.1 now.

Conclusion should be: grub is corrupted and not looking for the right directory, which is caused by my last scheduled shutdown. I am not sure but I think my laptop went to sleep mode or sth but then might have been forced shutdown when it was in sleep mode.

BTW, the 1TB HHD has 8 GB of SSHD which really accelerate the booting and shutdown process. I don’t know if all these are related.

However, maybe I just need to fix the broken grub, as fsck checking every partition reports clean.

I tried to fix grub with this live opensuse but I can’t mount /proc and /sys as instructed on the caf blog.

Is there a directory “\EFI\opensuse” in your EFI partition?

If there is, can you list the content (file names in that directory)?

Yes.

/mnt/EFI/opensuse # ls
MokManager.efi  grub.cfg  grub.efi  grubx64.efi  shim.efi

(I had to mount the partition to list its content.)
And the content of grub.cfg here

search --fs-uuid --set=root 097a00d1-9205-4d1a-8d5f-e530f3ab555c
set prefix=(${root})/boot/grub2
configfile $prefix/grub.cfg

It looks ok here as well. It directs to my opensuse root folder.

Please allow me to precise the exact error:

It says
file ‘/boot/grub/x86_64-efi/normal.mod’ not found.
However the normal.mod is at this dir: /boot/grub2/x86_64-efi/normal.mod

Some progress here.

I used my portable suse to make a new grub for itself whie enabled “probe other os”.

Then I boot with the new portable suse grub and choose to boot to my laptop’s suse.

Now I can get in the laptop suse. However, when I unplugged the portable drive and tried to rebuilt grub with YAST-bootloader, I have this error:

Fatal: Couldn’t open either sysfs or procfs directories for accessing EFI variables.
Try ‘modprobe efivars’ as root.

I did modprobe efivars as root but when I rebuild the bootlader with yast it still pops up this error.

That’s probably what boot with the manjaro installed grub would look for.

However the normal.mod is at this dir: /boot/grub2/x86_64-efi/normal.mod

And that’s what the opensuse installed grub should look for.

Here’s what might work:

1: Backup the manjaro directory (not sure if it is called that) in the EFI partition. I’m guessing that it is ‘\EFI\manjaro’. To backup, you can just create a new directory and move all of the files there (from that manjaro directory).

2: Copy everything from the opensuse directory to the manjaro directory.

You should be able to do the above while booted to a live CD.

When done, umount the EFI partition (so that it is properly synchronized).
Reboot. Use F12 if needed, and boot to the manjaro system. That should actually boot to opensuse because of the copying of files in step 2 above.

We can sort things out and fix booting the right way later. The first step is to get your system booted.

There are other ways of doing it, but what I suggested is easier and less confusing.

What’s happening there, is that your BIOS has a compatibility mode to boot the old fashioned non-EFI way. And you booted that way. But you don’t have access to the efi variables if you boot that way. That’s why I suggested a different method in my previous post.

Thank you. I understand now that this error is due to that I boot as in BIOS mode rather than UEFI so I can’t make a UEFI supported grub as in BIOS boot mode.

I tried your above suggestion

  1. mount EFI partition at /mnt
  2. backup /mnt/EFI/manjaro folder content (only one file named grubx64.efi)
  3. copy /mnt/EFI/opensuse/ folder content to /mnt/EFI/manjaro
  4. unmount EFI partition.
  5. Here I tried both BIOS booting mode and UEFI mode to boot manjaro, I however get the same error message:

“/boot/grub2/x86_64-efi/normal.mod” not found, only different from previous “error /boot/grub/x86_64-efi/normal.mod”

ls /boot/grub2/x86_64-efi | grep normal                                                                                                                  
normal.mod

I don’t know why I have this complain in the first place.

I guess the question gets down to

How do I fix a broken EFI supported grub with a live session.

At the moment I am using my portable opensuse whose grub is BIOS only. I can’t seem to change it to UEFI support mode.
I am not sure if a live opensuse DVD can be boot on UEFI mode. I saw ubuntu has a pure EFI image media.

I boot with a live session of opensuse in UEFI mode and tried the regular grub rescue method (chroot…)

In the last command “**grub2-install /dev/sda” **to whichit replied “efi distributor id not specified.

Please describe step by step what you did starting with rescue boot.

OK. This efi-grub error is finally solved after many google.

What I did:

  1. In BIOS setting choose UEFI boot mode, then boot a live opensuse 13.1 (which supports UEFI booting)

  2. Do the regular grub rescue instruction and you may encounter the error “can’t find /proc”. So following this thread, instead of mount /proc,
    use suggested by wolfi:
    mount -t proc proc /proc
    mount -t sysfs sysfs /sys

  3. Then what’s important when you rescue a efi-grub is that you need an extra step of mount during chroot session, which is

mount /sd**(your EFI partition) /boot/efi

if you don’t do this step it will complain “efi distributor id not specified”

  1. Finish the following rescue step in the instruction and no error was reported this time.

  2. When I boot grub is back, but Windows menu is absent. So after I boot to suse I use Yast-bootloader to generate another grub. Reboot again window is back as well.

I’m lucky to try the mounting EFI partition. In fact I still don’t quite understand how this complicated efi works.

Still some questions though:

What exactly was broken? My efi partition or my grub under suse root folder? Maybe I should back up my efi partition or grub folder?

Okay. I’m glad you found that. Otherwise I would have had to describe the whole procedure.

What exactly was broken? My efi partition or my grub under suse root folder? Maybe I should back up my efi partition or grub folder?

I can only guess. At one time, you posted the content of “grub.cfg” in the opensuse directory within the EFI partition:


search --fs-uuid --set=root 097a00d1-9205-4d1a-8d5f-e530f3ab555c
set prefix=(${root})/boot/grub2
configfile $prefix/grub.cfg

My best guess is that somehow that string “097a00d1-9205-4d1a-8d5f-e530f3ab555c” did not match the UUID of your root file system. I could not check, because you never posted the output of “blkid” in spite of requests.

As to how that would change – that I don’t know either. If you ever backed up the partition, reformatted and restored from backup, that would do it.