1

Problem. I'm trying to setup a dual-boot Ubuntu/Windows installation. This has so far only succeeded partially: grub seems to detect my Windows installation, but cannot boot into it. When I select it, it provides a message saying 'error: not a valid root device."

Disks. I've constructed the dual-boot installation on two disks:

  • /dev/sda contains Windows 10, UEFI. This OS was installed first, on one of the two drives. To prevent contamination, I had the other drive removed during installation. The drive contains four partitions:
    1. /dev/sda1, EFI system partition, FAT32, 100MB
    2. /dev/sda2, Microsoft reserved partition, unknown, 16MB
    3. /dev/sda3, Basic data partition, NTFS, 237+GB
    4. /dev/sda4, >>unnamed partition<<, NTFS, 530MB
  • /dev/nvme0n1, the second drive, contains Ubuntu 22.04.1, UEFI. This OS was installed second. During installation, I opted for the "install along-side Windows" option. The drive contains two partitions:
    1. /dev/nvme0n1p1, EFI System partition, FAT32, 512 MB
    2. /dev/nvme0n1p2, >>unnamed partition<<, EXT4, 890+ GB

After installation. Following the installation, grub immediately recognized the Windows install, however, it returns "error: not a valid root device" each time I attempt to select it. I have executed sudo os-prober and sudo update-grub, both to no avail. The grub boot sequence is as follows:

insmod fat
set root='hd0,gpt1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  64DE-E837
else
  search --no-floppy --fs-uuid --set=root 64DE-E837
fi
chainloader /efi/Microsoft/Boot/bootmgfw.efi

Peculiarity. There is one thing that happens that I think is rather odd. Let's discuss three situations:

  • When I turn my pc on, wait for grub to appear and select Windows, the error occurs.
  • When I turn my pc on, enter the boot menu and select 'UEFI - Windows Boot Manager', I do boot into Windows.
  • When I turn my pc on, enter the boot menu, select 'UEFI - Ubuntu' and then select Windows in grub, it also boots to Windows.

I'm baffled by the whole situation. Any input is much appreciated!

Erik
  • 13
  • Please clarify the version of Ubuntu you are using. There is no 22.04.5 – David Oct 21 '22 at 13:56
  • 1
    Try with bitlocker off. Or with UEFI Secure Boot off. And make sure Windows fast start up is off. – oldfred Oct 21 '22 at 15:01
  • @David my apologies! It's a typo. It should be 22.04.1. I've updated this in the question. – Erik Oct 21 '22 at 15:37
  • @oldfred turning fast boot off did the trick!... do you have a clue why fast boot makes this happen? – Erik Oct 21 '22 at 15:49
  • Windows fast startup sets hibernation flag. Then Linux NTFS driver will not default mount read/write. It can be manually force mounted read only. And then grub cannot fully see NTFS partitions. https://askubuntu.com/questions/843153/unable-to-mount-windows-10-partition-it-is-in-an-unsafe-state & https://askubuntu.com/questions/145902/unable-to-mount-windows-ntfs-filesystem-due-to-hibernation – oldfred Oct 21 '22 at 18:23
  • Thanks for the explanation! Can I somehow mark your comment as the solution? @oldfred – Erik Oct 22 '22 at 05:33

2 Answers2

1

Most common issue is Windows fast start up.

You may also need Windows bit locker or UEFI Secure boot off. Although Ubuntu works with Secure Boot on, grub may not boot Windows. Newest version I have actually had booted Windows with Secure boot on.

More info on Windows fast start up and hibernation flags.

Unable to mount Windows 10 partition; it "is in an unsafe state"

Unable to mount Windows (NTFS) filesystem due to hibernation

oldfred
  • 12,100
0

Had the same issue using an HP elitedesk PC and a Debian 12 - including the "peculiarity" Erik described.

I followed the oldfred's suggestion to disable the fast start up in Windows, but no success yet. Checking the BIOS for updates and other options I found that the BIOS in my case has also a "fast start" option. Strange enough, but turning that off too solved my problem.

joe
  • 1