1

i'm new and not very expert to coding but i'll try to explain me the best way. I have a pc with windows installed by default, but to work at the university i had to install a linux distribution and i chose ubuntu. In order not to mix two things on the same ssd I decided to do a dual boot but keep windows on the internal ssd and ubuntu on an external ssd. i followed several guidelines and followed all the steps on the ubuntu installer and always selected the external ssd for both swap space and ext4 / as well as the "device for boot loader installation" to be able to be independent from the pc to which the ssd is connected (compatibly with the ram and the processor) to be able to use windows normally without the external ssd and instead when i connect the ssd to my pc or to any other pc being able to use my ubuntu. Now I have a problem: both ubuntu and windows work normally and I have all my windows data if I turn on the pc with my external ssd (thatone with ubuntu) plugged in, but if I turn on the pc without it it tells me:

                                  GNU GRUB version 2.06

Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible devices or file completions

Please help me to solve this big problem, if necessary i can delate ubuntu, there are no files in it or important things and i can install it without failing like now later, the important thing is that i need to boot windows normally without an external ssd connected and to return to normal situation.

note: i've already read on stack or on other communities a lot but i could not find an answer with the steps to follow, and: bootrec.exe /fixboot bootrec.exe /fixmbr doesn't work because bootrec.exe /fixboot give me "access denied" and i don't know to install grub on ubuntu and if it can be useful.

Thanks in advance

1
  • i found this link link that seems to describe in section F my problem, but i dont understaand 2 things: i didn't all the steps for installing grub on ubuntu in section B,C,D,E, i had installed ubuntu like described in question so: if i do steps in F part i resolve my problem or i'll mess up things?. Second question: if i resolve my problem how can i recognize the EFI/ESP partition and :"Exit DiskPart and change to the Z: drive Change into the EFI directory"?? thanks in adv.
    – stefano99
    Dec 28, 2022 at 22:23

4 Answers 4

0

both ubuntu and windows work normally and I have all my windows data if I turn on the pc with my external ssd

When installing OSes, any OS, and especially when doing a dual- or multi-boot setup, users must be familiar with the boot process and how to solve trivial issues like the one presented in this question. And for any computer from a decade ago user must understand the UEFI boot process and recognize the importance of the ESP (EFI System Partition) where the multiple bootloders reside.

NB - When dual-booting with Ubuntu or derivatives and installing Ubuntu in a removable drive, users should also know that the Ubuntu installer always installs the bootloader (Grub) in the ESP in use. It doesn't allow the creation of an additional ESP in the removable drive.

This means, in a very typical case such as yours, Grub was installed in the ESP of the internal drive alongside Windows bootloader manager. Many consider this "bug" but it can also be argued that's a feature. It isn't a problem unless you want that Ubuntu installation to be portable, i.e., bootable in other computers. That NOT being the case everything is fine as it is now.

You need to access the UEFI settings - UEFI is the firmware that replaced BIOS and is still wrongly named as such by many people and manufacturers - and change the boot order back to Windows:

UEFI ("BIOS") settings > Boot menu. Find the "OS selection" item or equivalent where you should see "Ubuntu" and open that sub-menu and select "Windows bootloader manager" instead.

This will result in Windows booting directly. Whenever you want to use Ubuntu, (1) connect the external drive and (2) either do the reverse or use the much easier on-time boot menu / boot override menu if available. For this please consult your user's manual or your manufacturer's online resources. Although the vast majority of computers follow the aforementioned logic and workflow there can be exceptions and/or different terminology. You need to familiarize yourself with your own firmware (UEFI) specifics. Otherwise this is really as trivial as described, no need for chroot (nonsensical in this context) or even efibootmgr (makes some sense to edit EFI entries and managing the boot order but really not necessary in this context).

PS - Next time you "need Ubuntu" consider using a virtual machine.

0

You may be able to use the chroot command to install grub if it becomes damaged. This may require a Linux installation environment (probably Ubuntu in your case) to open a terminal and run:

lsblk                             This allows you to see what drives you have connected to your computer. Find a partition that matches the capacity of your Ubuntu drive. That will be your /mnt.
                                  The first partition on that drive should be around half a gibibyte in size (512MiB or so), which will be your /mnt/boot directory.

mount /dev/sdXY /mnt              This mounts your main partition for chroot to be invoked into.
(e.g. /dev/sdb2)

mount /dev/sdXZ /mnt/boot         This mounts your boot partition for GRUB to be reinstalled to.
(e.g. /dev/sdb1)

chroot /mnt                       You are now in your unbootable drive's shell. From here you can reinstall grub with the following steps.

sudo apt install grub-efi-amd64   This command installs the bootloader. This is assuming you are using an Intel or AMD processor and are booting through UEFI.

exit                              Exits the chroot shell.

reboot                            Self-explanatory.

Note: The commands are making a lot of assumptions, such as that /mnt is an empty folder (which it should be in an installer) and that your computer is an Intel/AMD system with UEFI capability that is being used to boot Linux. And that isn't all of them! Be sure to do your own research on this as well.

5
  • Sorry for the following question, but this will make my windows booting without the ubuntu ssd? because the problem is not ubuntu-boot is that it's like my windows boot is on the ubuntu ssd or permanently linked to ubuntu ssd. i want to remove grub from my windows11 and return with the possibility to boot windows normally without the external ssd attached. i searched about my specs and thoose are the same, i've read your comments in code and i think your process is for reinstalling grub on ubuntu, but i need to make my windows indipendent from ubuntu or delate dual boot having only W11
    – stefano99
    Dec 28, 2022 at 20:26
  • This is not necessary at all. Dec 29, 2022 at 7:39
  • Ah, then Windows should be fine since Windows has its own bootloader. Dec 30, 2022 at 8:38
  • ...never mind wtf why doesn't windows boot when you get rid of the Ubuntu drive Dec 30, 2022 at 8:46
  • This has been explained comprehensively in my answer. Jan 1 at 2:47
0

Boot your computer into the Ubuntu on the SSD. Install the program: efibootmgr.

Efibootmgr will allow you to change the boot order of your UEFI computer. While in the Ubuntu system, run efibootmgr. That command will show you the boot order currently in place (probably with grub going first). But it will also show you the Windows Boot Manager boot entry. You can change the boot order with the efibootmgr -o command, placing Windows first. Then when you boot (without the SSD attached) you should just boot into Windows (because your system will look for that first).

Please try to read about efibootmgr. If you're unsure, ask here before trying anything with it. Consider posting the results of the efibootmgr command (without any options), so that the current order and the entries can be seen.

6
  • efibootmgr is already installed and yes, it can be used but all it needs is simply change the boot order in UEFI > Boot. Dec 29, 2022 at 7:21
  • No doubt changing the boot order in the UEFI would work as well (not better) than using efibootmgr. I have found that UEFI screens vary considerably and that many users find them difficult to sort out. So I find efibootmgr to be considerably more straightforward (a single command changes the boot order). In addition, lots of people buy computers today that don't come with manuals or even the most rudimentary of instructions about how to access the UEFI screen. But booting into Ubuntu and using efibootmgr makes such knowledge unnecessary.
    – dojero
    Dec 30, 2022 at 4:05
  • You aren't considering the odd models where efibootmgr doesn't work and the same for the installer itself that can't change the UEFI boot order in a few more models. In those cases not accessing the firmware settings is not an option. And for all other cases I must insist: If you're installing an OS, any OS, standalone or multi-boot, being familiar with the firmware is a must. If you think otherwise than you shouldn't be doing it or giving advice, period. Consumer grade computers don't come with proper manuals since 15 or 20 years ago, that doesn't mean the manuals aren't available online... Dec 30, 2022 at 4:26
  • ... and once you boot the Ubuntu installation media the Grub menu has an entry for UEFI settings, you don't even have to know how to access it the normal way although you should and you MUST. This are, simply put, best practices that aren't up for discussion. And not even mentioning how easy it is to screw it up using efibootmgr. Dec 30, 2022 at 4:32
  • Your fury and condescension notwithstanding, I would urge you to consider that other people with expertise might be allowed to disagree with you. That said, I do agree that accessing the firmware by using the Grub menu or a command from within an Ubuntu boot is a fine way to change the boot order and get into Windows. My suggestion that there is an alternative (which I prefer) to using the firmware was both accurate and reasonable. As for your insistence that all computer owners must know how to access the firmware, I'm able to agree to disagree (without impugning your expertise or wisdom).
    – dojero
    Dec 31, 2022 at 14:40
0

If you still have access to the second drive, these steps worked for me:

  1. Boot to Windows and open Disk Manager. Mark drive C: on the SSD as "active". You do it with a right-click on the partition.

  2. To copy the boot files to the original drive. Go to the command prompt (or recovery command prompt), and run:

bcdboot C:\Windows /s C: /f BIOS
bcdboot C:\Windows /s C: /f UEFI

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .