0

So 8 months ago I got a new laptop with Windows 10 and I spent a couple of days setting up an encrypted Ubuntu 18.04 system on it. Now Windows 10 doesn't boot and I need to reinstall it. I am afraid that reinstalling will erase the GRUB bootloader and mess up my encrypted (LVM under LUKS) system set up through /etc/fstab and /etc/cryptstab. How to avoid these problems? Here's my setup:

sda                     8:0    0 931.5G  0 disk  
├─sda1                  8:1    0    16M  0 part  
├─sda2                  8:2    0 736.2G  0 part  /media/win
└─sda3                  8:3    0 195.3G  0 part  
  └─lxfiles           253:3    0 195.3G  0 crypt 
    └─vgfiles-lvfiles 253:4    0 195.3G  0 lvm   /media/data
nvme0n1               259:0    0   477G  0 disk  
├─nvme0n1p1           259:1    0   260M  0 part  /boot/efi
├─nvme0n1p2           259:2    0    16M  0 part  
├─nvme0n1p3           259:3    0 237.9G  0 part  
├─nvme0n1p4           259:4    0  1000M  0 part  
├─nvme0n1p5           259:5    0   500M  0 part  /boot
├─nvme0n1p6           259:6    0   3.8G  0 part  
│ └─swap              253:2    0   3.8G  0 crypt [SWAP]
└─nvme0n1p7           259:7    0 233.6G  0 part  
  └─rootfs            253:0    0 233.6G  0 crypt 
    └─vgroot-lvroot   253:1    0 233.6G  0 lvm   /

Basically I want to re-install Windows on nvme0n1p3 and its EFI bootloader but avoid it touching anything else.

teagut
  • 23

1 Answers1

1

Well, first, if you ain't sure about what you are doing, make sure that your important data is backed up.

Second, installing windows after ubuntu will overwrite GRUB with windows boot loader. I don't think that there is a way to avoid it.

So, I found two ways to deal with that:

1- Set the windows entry inactive

Like Kana mentioned here, is possible to set the Windows boot manager entry to inactive, as Windows overwrites the entry to 0000 and changes the boot order.

As Karlovsky120 also reminded it may only work if Ubuntu has been installed in UEFI mode. You can check it using the command: if test -d /sys/firmware/efi;then echo efi;else echo bios;fi.

2 - Reinstall GRUB after the windows installation

There are many ways to repair GRUB, as recommended on the official ubuntu help page Specifically about encrypted volumes, there are many other posts about it:

  • Thanks, I did the first option of setting the Windows bootloader as inactive and got GRUB back! all in all, a relatively painless experience reinstalling Windows on a dual-boot system. – teagut Sep 01 '20 at 02:04