Hi there!
After I installed several updates, and after I rebooted the system, Grub no longer shows OpenSuse boot option. (Grub only shows Windows boot option in a black screen. Grub version 2.0.4)
Now I cannot boot openSuse.
How can I get Grub to show back openSuse boot option?
You basically need to start from grub command line and explore
ls (
then use “tab” twice to see what options you have and look for something like
(hd0,1)/boot/grub
If you can’t find anything, you may have accidentally deleted at least the default kernel. If that’s the case, you need a USB stick with LEAP/TW installed.
If you do find something and boot from it, Yast Bootloader should be able to fix this for you.
If you mean by: kernels not deleted = It’s easier to just configure your grub and boot from existing ones and use the Yast Bootloader, this is the cleanest and easiest way.
You can also use the rescue media to explore the existing kernels, and mount, bind and chroot the existing / then re-compile the kernel or reconfigure grub by:
mkinitrd
or
grub2-mkconfig -o /boot/grub2/grub.cfg
in either of the case, you want to make sure that you can see the linux entries in your /boot/grub2/grub.cfg
If you mean by: kernels deleted = You need to use a rescue media to mount, bind and chroot your existing / and download and install a kernel. This is not very trivial because you need to set up your rescue environment. Personally, I have a shared NTFS partition between linux and W10 and I downloaded kernel from W10, placed it in the shared partition and installed downloaded kernel. I’ve done exactly this in the same link above (https://forums.opensuse.org/showthread.php/535481-Kernel-disaster-recovery).
Both opensuse and Windows, when installed on the same computer, have a tendency to delete boot options of the other OS. Usually happens after updates, 1-4 times per year.
If opensuse has deleted Windows’s boot option, then the solution is easy: boot into opensuse, and reinstall the boot loader. If this is done in Yast, don’t forget to enforce “Probe Foreign OS”.
If Windows has deleted the opensuse’s boot option, then the story is longer. Boot from a Live or rescue Linux USB flash drive or CD, and do these steps. They are described in more details elsewhere; here is an approximate sequence of steps:
Identify the root partition (/, not /root) and mount. (The root partition contains /etc and /home):
mount -t ext4 /dev/sda2 /mnt
If UEFI boot is used, identify and mount the the FAT partition used for booting:
mount -t vfat /dev/sda1 /mnt/bootefi
Mount (bind) three filesystems:
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
Optionally, one more mount:
mount -t devpts pts /mnt/dev/pts
Change root (chroot):
chroot /mnt
Optionally, mount all filesystems:
mount -a
Reinstall grub with one of these methods, or with some other command:
grub2-install --target=x86_64-efi /dev/sda
grub2-install --target=x86_64-efi --efi-directory=/bootefi /dev/sda
Start yast, go to System -> Boot Loader
Start yast2, go to System -> Boot Loader
You may want to specify what your /dev/sda1 and /dev/sda2 are. Your instructions seem sound for your specific setup but may not be applicable to the OP.
I think the OP has encountered exactly the “Boot option of an OS disappeared!” problem that I face regularly on several computers. Here is what he says:
*“After I installed several updates, and after I rebooted the system, Grub no longer shows OpenSuse boot option. (Grub only shows Windows boot option in a black screen. Grub version 2.0.4)
Now I cannot boot openSuse.”
*
It is quite frightening for an inexperienced soul (“To the hell with these irresponsible programmers and their defective OSes, but are my files gone?”).
/dev/sda1 is the partition on which the root of Linux filesystem (/) exists. The size of this partition might be from 1 to 40 GB, often close to 8 GB. The filesystem type usually is ext4, btrfs, XFS, reiserfs. It is very unlikely to be vfat, NTFS, exFAT. Cannot be swap.
/dev/sda2 is the vfat- or FAT32-formatted partition on which UEFI boot partition exists. It is a small partition normally, between 0.05 and 1 GB. This partition exists only if UEFI boot is used in the computer. Most modern computers use UEFI and most old computers (before 2010) don’t.
The exact names of disks and partitions (/dev/sda, /dev/sdb, /dev/sda1, … ) can be found out by mounting all partitions in the computer one-by-one (in Live Linux), and analyzing their filesystem type, size and content. I suggest don’t use
-t auto
option for mounting. Also don’t forget to unmount after analysis.
In simple scenarios (one or two disks, Linux+Windows, no traces of previous OSes), identifying the needed partitions is easy, especially with help from Internet.
It appears to me that having Windows in multiboot with TW isn’t necessary to lose a TW boot option. I just filed https://bugzilla.opensuse.org/show_bug.cgi?id=1175271 where the update in addition to building a bad initrd managed to switch the firmware priorities so that the UEFI fallback had precedence over the TW entry. After zypper dup:
# efibootmgr
...
BootOrder: 0001,0000,0003,0002
Boot0000* opensusetw
Boot0001* UEFI OS
Boot0002* Hard Drive
Boot0003* CD/DVD Drive
Corrected/restored::
# efibootmgr
...
BootOrder: 0000,0001,0003,0002
Boot0000* opensusetw
Boot0001* UEFI OS
Boot0002* Hard Drive
Boot0003* CD/DVD Drive
I know this is different from a missing TW menu option in Grub, but the packaging processes involved in updating Grub and UEFI entries would seem to be related at the least.
A bit off an off-topic question. Did you use the Window’s 100MB EFI to install your OpenSUSE EFI? I typically create one for Linux and one for W10 to avoid such problems and I’ve had 0 issues related to one OS crippling another after an update.
I am really curious how we can reproduce such effect. Do you know exactly how to reproduce these?
On 5/6 of my machines have Linux+W10 with 2 distinct EFI partitions and I’ve had them for several years now. They all have 100MB W10 default EFI partition and 300MB Linux dedicated EFI partition and I have never an into forementioned problem ever.
I’ve only ran into such problems when I was just starting to use linux and only when I either used MBR for linux+W10 boot, or when I used 100MB W10 default EFI for both W10 and linux to share.
You cannot intentionally reproduce. You can wait until it happens. For that:
Install Windows 10.
Install opensuse, either on the same disk by squeezing the Windows’s main partition, or on another disk.
Use UEFI boot.
Go on with opensuse’s installer’s default settings in terms of booting.
After boot, verify that “Probe Foreign OS” is selected. If you want, you can reinstall the boot loader. Verify that both OSes boot normally.
Wait until Windows has a major (feature) update. There is 30% chance that the update will overwrite the boot sector, leaving no Linux boot options. Or it will change the boot options in some other way. Or the update will fail, because Windows will be confused by unusually-sounding boot sector.
Or wait until there is a big update of opensuse. Usually, after a normal installation, there are three boot options offered in Grub. After this unhappy update, two are left: opensuse 15.2 and opensuse 15.2 with safe settings. Booting into Windows is gone.
Wait until Windows has a major (feature) update. There is 30% chance that the update will overwrite the boot sector, leaving no Linux boot options. Or it will change the boot options in some other way. Or the update will fail, because Windows will be confused by unusually-sounding boot sector.
This does not actually make sense.
UEFI booting does not use a boot sector.
Perhaps your UEFI Firmware (or BIOS) dropped the openSUSE boot entry. Or perhaps it dropped the Windows boot entry, and then Windows put it back and made it first in boot order. Either way, your thread title is misleading, because it wasn’t “grub” that failed to provide the boot entry.
Or wait until there is a big update of opensuse. Usually, after a normal installation, there are three boot options offered in Grub. After this unhappy update, two are left: opensuse 15.2 and opensuse 15.2 with safe settings. Booting into Windows is gone.
That sounds like a different problem. You have both 15.2 and Tumbleweed installed. A recent “grub2” update in Leap 15.2 gave its bootloader the priority. I am guessing that you installed that grub update with the desktop update applet. There’s a bug reported for that problem.
Recovering from a mishap requires checking each of these items and restoring them if damaged or missing. Boot into a rescue system and run grub2-install, grub2-mkconfig and efibootmgr as needed.
Examples:
mount /dev/sdb5 /mnt # System Partition
mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
chroot /mnt
mount /dev/sdb1 /boot/efi # EFI System Partition
**grub2-install**
**grub2-mkconfig -o /boot/grub2/grub.cfg**
exit