After installing Ubuntu 20.14 Windows 10 disappeared from Grub

Hello there, I recently installed Ubuntu 20.04 LTS from DVD on my PC met Windows 10 and Xubuntu 18.04 LTS. Upgrade from 18.04 naar 20.04 did not work via Update manager, hence the choice to install 20.04 from DVD. The installation was successful, but the Windows 10 option had disappeared from Grub. The Windows 10 System partiton /dev/sda2 is still available, in Grub menu there are only Ubuntu (20.04) en Ubuntu 18.04 as options.
How can I get Windows 10 (together with 18.04 en 20.04) back again? Kind regards and thanks for your help, HHarry18

Hi @HHarry18 ,
That is a common problem.
The issue is, Ubuntu controls grub. So when you install a new Ubuntu, you get a new grub, which does not know about Windows.
So you have to teach it…

Log into Ubuntu
Then as root do
update-grub
it should search your disks and find Windows
reboot
and you should get a grub menu with Win and Ubuntu

If it still does not work, log into Ubuntu again
go to /etc/default
edit the file grub adding the line
GRUB_DISABLE_OS_PROBER=false
then redo update-grub
reboot
and it should be ok

The os-prober program is required for update-grub to search for other operating systems. Sometimes it is disabled, and you have to ensble it as above. Note the terrible double negative… disable=false means yes enable it!

Regards
Neville

4 Likes

Hi @HHarry18,

It’s been awhile, but I believe this worked for me once when I had a problem with grub finding Windows.

"Sometimes os-prober is wrong.
Look at the UUID of your Windows 10 partition, for exemple:
sudo blkid /dev/sda2

Then edit /etc/grub.d/40_custom, and at the end of the file add:
menuentry “Windows 10” --class windows --class os {
insmod ntfs
search --no-floppy --set=root --fs-uuid “$your_uuid_here$”
ntldr /bootmgr
}

Don’t forget to change the UUID.
And finally update your grub config file:

sudo update-grub"

What @nevj suggested is way easier, but this might give you another option.

2 Likes

This is going to be THE solution. Recently Ubuntu disabled OS prober by default.

2 Likes

Hi Neville (and others), thank you very much for your help! I tried the first part but it did not find Windows:
edschijf@edschijf-ESPRIMO-E920:~$ sudo update-grub
[sudo] wachtwoord voor edschijf:
Sourcing file /etc/default/grub' Sourcing file /etc/default/grub.d/init-select.cfg’
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.15.0-48-generic
Found initrd image: /boot/initrd.img-5.15.0-48-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Ubuntu 18.04.6 LTS (18.04) on /dev/sda5
Adding boot menu entry for UEFI Firmware Settings …
done
Then I tried the second part and after adding the line and wanting to save it, it said it was read only. What can I do next?
Regards, HHarry18

Hi @HHarry18 ,
That is an easy one.
You have to either use sudo, or su to root, to edit any file in /etc.
Also you must use a text editor (like vi or nano)., not Office.

Regards
Neville

1 Like

Hello Neville,
Sorry to bother you again, I followed your last advice, added the line, saved and updated grub and rebooted.
This was the result:
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
GRUB_CMDLINE_LINUX=“”
GRUB_DISABLE_OS_PROBER=false

Unfortunately it did not bring back the Windows 10 entry. Now I have no idea again what to do next. Regards, HHarry18

@HHarry18 ,
could you please post the output of
sudo fdisk -l
I think your system should have os-prober installed, but make sure:
dpkg -l os-prober
does return something like
ii os-prober 1.79 amd64 utility to detect other OSes on a set of drives
?

1 Like

Did you do update-grub again after you edited the grub.cfg file?
If not , do it and reboot.

Otherwise,
After you do the tests recommended by @kovacslt ,
If it finds os-prober is present, could you run it ( just type os-prober at the CLI) , and show us the result

Also , can you confirm, there is no Windows 10 entry on your grub screen?

Hello kovacsit, thanks for your extra help! Here are the results, I did not send all data of the two HDDs and others because it is very much. If you need the rest I will of course send it.

Sudo fdisk -l (sorry, text is in Dutch):

Schijf /dev/sda: 465,76 GiB, 500107862016 bytes, 976773168 sectoren
Disk model: TOSHIBA DT01ACA0
Eenheid: sectoren van 1 * 512 = 512 bytes
Sectorgrootte (logisch/fysiek): 512 bytes / 4096 bytes
In-/uitvoergrootte (minimaal/optimaal): 4096 bytes / 4096 bytes
Schijflabeltype: dos
Schijf-ID: 0x805e5fde

Apparaat Op. Begin Einde Sectoren Grootte ID Type
/dev/sda1 * 2048 1026047 1024000 500M 7 HPFS/NTFS/exFAT
/dev/sda2 1026048 507766281 506740234 241,6G 7 HPFS/NTFS/exFAT
/dev/sda3 507766784 508829695 1062912 519M 27 verborgen NTFS WinRE
/dev/sda4 508831742 976771071 467939330 223,1G 5 uitgebreid
/dev/sda5 508831744 976771071 467939328 223,1G 83 Linux

Partitie 4 begint niet op een fysieke sectorgrens.

dpkg -l os-prober:

ii os-prober 1.79ubuntu2 amd64 utility to detect other OSes on a set of drives

I hope this is going to help. Regards, HHarry18

Hello Neville, I sent data to Kovacsit as requested. My answers to your questions:

  • Yes, I did the update-grub and reboot after editing grub.cfg.
  • I did the tests recommended and as far as I could see os-prober is present, so I typed os-prober and the result is:

~$ sudo os-prober
[sudo] wachtwoord voor edschijf:
/dev/sda5:Ubuntu 18.04.6 LTS (18.04):Ubuntu:linux
~$
I do not see any sign of Windows 10 which happened to be on /dev/sda2

Maybe you and Kovacsit have some more tricks in your sleeves? Thanks so far, regards, HHarry18

1 Like

Hmmm…

And before you posted:

That suggests me, you installed Ubuntu in UEFI mode, but probably your Windows was installed in legacy (BIOS) mode.
That can be the problem.
Either reinstall Windows in UEFI mode, or reinstall Linux in Legacy mode.
I think, to reinstall Linux is easier and faster…

Update - even better check this:

1 Like

Yes, that must be the reason, Kovacsit! I bought the refurbished Fujitsu computer with Windows 10 preinstalled a couple of years ago . Thanks again for your efforts and have a nice day. Regards, HHarry18

1 Like

Hi Neville, I got a suggestion from Kovacsit that maybe Windows had been installed in BIOS mode and Ubuntu in UEFI. I bought the refurbished Fujitsu computer with Windows 10 preinstalled a couple of years ago and installed Ubuntu 18.04 on it without any problem, it ran smoothly for years. Last week I installed Ubuntu 20.04, also no problems. Then I upgraded to 22.04 and Windows had disappeared from grub. As I am not a Windows fan (but there are some apps that won’t work with Linux) I think I will skip Windows completely. Thank you very much for your efforts!!! Regards, HHarry18

2 Likes

This is offtopic here, but you could look for a viable alternative. Most efficient way :slight_smile:
If there isn’t any, you could look for a way to run it using WINE. Still an efficient way :wink:
As a last chance you could set up a VM (for example using Virtualbox) with a real Windows on it - least efficient way, but still viable, if your app. is not too much ardware demanding.

1 Like

Before you throw windows out, what happens if you set your BIOS back to legacy mode? Does it boot windows?
If so, you could just use the Bios to choose which to boot.

No Neville, I am not going to throw Windows out, but I will not use it for a while. And I will follow your advice to set BIOS back to legacy mode later, am very busy at the moment. Regards, HHarry18

Thanks kovacsit, I already use Wine for some Windows apps, most of them work, though not all. That’s why I wrote to skip Windows completely, but I meant to not use it for some time. Thanks for your help and tips! Regards, HHarry18

1 Like

Hello Neville, first of all I forgot to say that I mostly find your messages very interesting and you write a lot of them! Secondly I could not skip using Windows altogether and wanted to understand what had really happened when I updated from 18.04 to 20.04 and from there to 22.04. My wife has the same Fujitsu computer with Ubuntu 22.04 and Windows 10. So I looked at boot/grub/grub.cfg on both machines and compared the texts. On my machine it said: set root=‘hd1,msdos5’ , on my wife’s computer this was: set root=‘hd0,msdos6’ , and a number of other differences in the 7 pages long documents. I did not change anything in this file, thought it too dangerous.
Then I followed your advice to set BIOS back to legacy mode:
I changed “Boot option filter UEFI + Legacy” to Legacy only and started again. This time Windows 10 was back again and ran well, but there was only 1 Ubuntu option in the Grub menu and that was Ubuntu 18.04. Now 22.04 (that ran perfectly) has disappeared, a lot of work had been in vain. Putting UEFI + Legacy mode back did not give 22.04 back as expected, because the .cfg file above had been overwritten. Does this mean that I’ll have to re-update 18.04, 20.04 and 22.04 again? Regards, HHarry18

Hi Neville, sorry for the last and long reply. I just discovered that Ubuntu 22.04 was restored in the grub menu and is working. So forget about my last question, Linux has healed itself so it seems. Keep up the good work and I keep you posted! Regards, HHarry18 (Ed).

1 Like