2

I have now three hard disks in my desktop. A Samsung SSD that boots Win7, a Toshiba HDD which is not bootable, and yesterday I added a Crucial SSD which boots Ubuntu 21.04.

If I now simply start my computer, Linux on the Crucial will boot..

If at startup I press F11 this allows to choose between these three and surprisingly, a non-existing fourth named "Ubuntu"(?). If I click on the Samsung then Windows will boot, if I click on the Crucial (or Ubuntu) Ubuntu will boot. As you can see on the left of the two pictures:

https://ibb.co/ctB75g0

The right picture shows what I get when press F2, the boot order setting at the ASRock Motherboard, while booting, I only get to "choose" between the identical Crucial and Ubuntu...

I want the Samsung to boot Win7 as default. From what I have heard, I have to do this in Ubuntu, and I know absolutely nothing about it. How do I make this change?

It was suggested to use grub-customizer for this, but as the picture shows, it does not even see the Samsung disk with the Windows.

https://ibb.co/fq1bKZC

My Win7 is not an UEFI, it is a legacy installation. Could that be the reason?

cocomac
  • 3,394

2 Answers2

0

You can convert an existing installation of Ubuntu from legacy to UEFI and vice versa. You need to reinstall GRUB to the device hosting grub, in my case this is /dev/nvme0n1

Legacy to UEFI

sudo grub-install --boot-directory=/boot --bootloader-id=ubuntu  --target=x86_64-efi --efi-directory=/boot/efi  /dev/nvme0n1

UEFI to Legacy

sudo grub-install --boot-directory=/boot --bootloader-id=ubuntu /dev/nvme0n1

Then update grub sudo update-grub

Now you can list grub entries by using this command:

grep -E "^(menuentry|submenu)" /boot/grub/grub.cfg | cut -d"'" -f2 | nl -v0

In my case it will show the following

     0  Ubuntu
     1  Advanced Options for Ubuntu
     2  Windows Boot Manager (sur /dev/nvme1n1p2)
     3  UEFI Firmware Settings

After you have to edit /etc/default/grub and set the corresponding number to GRUB_DEFAULT=0.

In my case Windows is entry n°2 so it will be GRUB_DEFAULT=2

Then you have to use sudo update-grub to update your grub, and now your computer will always boot windows by default.

Cheers

  • Thank You... As far as I have understood PonJar's comment, I need to change the ubuntu installation from UEFI to legacy ??? You mention the other way around.... ? – rossdorn May 29 '21 at 12:12
  • I've edited my comment, you can change from legacy to uefi and vice versa. – Fractalyse May 29 '21 at 13:09
  • UEFI drive should be partitioned as gpt, not older MBR. And with gpt you need a bios_grub partition 1MB unformatted with bios_grub flag for correct BIOS/CSM/Legacy install of grub (grub-pc). Or you need an ESP - efi system partition as FAT32 300 to 500MB with esp/boot flags for UEFI install of grub (grub-efi-amd64). When I was first converting drives to new UEFI install I added both bios_grub & ESP as first two partitions. I already had started using gpt with all BIOS installs on old system several years before. – oldfred May 29 '21 at 14:33
  • Fractalyse.... What does: "^(menuentry|submenu)" mean in this line:grep -E "^(menuentry|submenu)" /boot/grub/grub.cfg | cut -d"'" -f2 | nl -v0 As I wrote, I am new to Linux and I did not know that installing ubuntu would upset the other half of my computer and not mention windows in its boot options... – rossdorn May 30 '21 at 09:00
  • It's a bash command, that shows you the entries of grub menu. If you are not familiar with Linux and terminal commands, the simplest way for you is to reinstall Ubuntu in legacy mode by disabling UEFI in your BIOS. – Fractalyse May 30 '21 at 14:09
  • I went through the uefi setup of my ASRock B85m motherboard and found many settings but none that would allow to change it to legacy for an installation on a second SSD....? – rossdorn May 31 '21 at 02:31
  • I guess this is called "CSM" for "Compatibility Support Module", Here is the manual : https://download.asrock.com/Manual/B85M.pdf search for "CSM" in manual there is the procedure – Fractalyse May 31 '21 at 15:52
  • Fractalyse.... All I did was getting a second SSD to install ubuntu next to Win in my computer, to see how it works for me. And as in all the numerous previous attempts in the past 18 years, Linux makes a mess of things, by doing things no one asked it to do. This time, grub simply imposes itself over all booting, and as many times before I wasted many hours trying to stop Linux from messing with the rest my system. I do not have time for this kind of effort. – rossdorn May 31 '21 at 22:32
  • So thank you very much for trying, but I am sick and tired of spending hours on fixing things, that used to work just fine. I will simply unplug the power supply for that SSD, until I want to actually use ubuntu, or until I decide to simply wipe it and use it as another storage for windows. Thank you, I apologize for having wasted your time... – rossdorn May 31 '21 at 22:32
0

I've searched similar solution recently and this is the best I've found

boot loader configure last saved in ubuntu terminal

So according to this answer you can change the boot loader to load the last os you opened! also if you're not comfortable with gedit you can select for nano editor. This video shows to do with nano editor in very precise explaination.