How to get back Windows on the grub menu?

Bo Berglund bo.berglund at gmail.com
Wed Oct 27 14:48:05 UTC 2021


On Wed, 27 Oct 2021 14:26:19 +0100, Liam Proven <lproven at gmail.com> wrote:

>On Mon, 25 Oct 2021 at 11:02, Bo Berglund <bo.berglund at gmail.com> wrote:
>> So:
>> How can I get back the Windows 10 entry on the grub menu?
>> The efi partition is still intact on the disk
>
>Is there only 1 ESP?

I am not running the desktop version of ubuntu so I cannot use gparted to see
the disk. Instead I used fdisk:
----------------------------------
# fdisk -l
(removed all references to /dev/loopx)

Disk /dev/nvme0n1: 476.96 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZALQ512HALU-000L1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A4DBAC89-9420-4410-8278-EA159A472A94

Device             Start        End   Sectors  Size Type
/dev/nvme0n1p1      2048     534527    532480  260M EFI System
/dev/nvme0n1p2    534528     567295     32768   16M Microsoft reserved
/dev/nvme0n1p3    567296  126396415 125829120   60G Microsoft basic data
/dev/nvme0n1p4 998166528 1000214527   2048000 1000M Windows recovery environment
/dev/nvme0n1p5 126396416  189310975  62914560   30G Linux filesystem
/dev/nvme0n1p6 189310976  252225535  62914560   30G Linux filesystem
/dev/nvme0n1p7 252225536  419997695 167772160   80G Linux filesystem
/dev/nvme0n1p8 419997696  973668351 553670656  264G Linux filesystem
/dev/nvme0n1p9 973668352  977334271   3665920  1.8G Linux swap

Partition table entries are not in disk order.
----------------------------------
Usage:
nvme0n1p1 the single EFI partition at the start of the disk
nvme0n1p2 a Microsoft reserved partition
nvme0n1p3 the Basic data partition where Windows10 lives
nvme0n1p5 my Ubuntu 20.04.3 desktop
nvme0n1p6 my Ubuntu 20.04.3 server (now running)
nvme0n1p7 a future data storage partition, not used yet.
nvme0n1p8 my home partition kept separate due to size
nvme0n1p9 swap inside an extended partition container
nvme0n1p4 actually at the end of the drive says GParted.

>It is mounted under `/boot/efi`?

Not mounted as far as I can see:
# mount | grep "/boot"
returns nothing.


>Before you run `os-prober` I have found that it may help to ensure all
>OSes' partitions are mounted first. E.g. a test install of SUSE SLE
>wasn't detected until I manually mounted it first.

So should I just mount them like this temporarily:
/mnt/win (nvme0n1p3)
/mnt/desk (nvme0n1p5)

Is the idea to then issue:
# update-grub


>There's a quick HOWTO on reinstalling GRUB on UEFI here:
>https://itectec.com/ubuntu/ubuntu-how-to-reinstall-grub-to-the-efi-partition/
>
>You'll easily find many more. If you look at StackExchange or
>AskUbuntu, *do not* stop with the first answer. Read them all and look
>for the latest answer, not the top one.

I have searched a lot to get to the state I posted earlier where I now have a
really awkward method to switch between two different grub boot menus.

So in order to boot off USB attached media I have to go through a big loop to be
able to launch Windows and from there special key presses to get to a boot media
selection menu where I finally can boot to the live media...

Not ideal but it works, sort of...

The boot menu I reach then does not have the correct ubuntu names either, it
show a very early version before I had upgraded the server to 20.04.3

One thing that might decide what to do:
------------------------------------------
In addition to Windows10 shipped with the hardware, I have 2 ubuntu versions on
this PC, the desktop and the server versions.
The desktop was installed here from live media when I was able to do this
easily. So its installer should have seen the EFI/UEFI stuff.

The server is my migrated very old Ubuntu 18.04 from a different PC platform. It
was already release-upgraded to 18.04 from 16.04 a number of years ago.

Right now I have a situation where I can boot desktop or server from the boot
menu directly. Server is the default.

But if I want to run live media (for example to get to GParted so I can back up
the systems) I have to go through the hoops via Windows etc.

My fear now is that by doing anything to GRUB I might destroy the possibility to
actually do the workaround and am stuck with a system that cannot be backed up
fully...


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list