Grub2 error:unknown filesystem after reinstalling Windows

Hi, i run Arch(antergos) alongside Windows 7 on my lenovo Y580, both systems are encrypted and i don't have os prober so grub shouldn't see windows instalation.
Last night i tried to wipe mounted veracrypt volume and accidently wiped my windows partition. Not a big problem, just reinstalled but now i can't boot into arch.
Windows boots up fine but when i try to boot from arch efi entery it throws up this error:
error: unknown filesystem.
Entering rescue mode...
grub rescue> _
i have 3 linux partitions on this system, /boot/efi, /boot and encrypted / and windows is encrypted with veracrypt, i have gpt and efi on this laptop. both systems are installed on the same drive.
I can boot up my windows fine and linux if i use:
set prefix=(hd0,gpt2)/grub
insmod normal
normal
but i don't know how to fix grub.

EDIT: windows likes to touch all the drives connected to the system, when it is being installed.

If you didn't physically disconnect your drive(s) with linux on them, they're now toast (maybe).

That's what its been from my experience, but you can try just redoing the grub config.

grub-mkconifg -o /boot/grub/grub.cfg

Both systems are installed on the same SSD and they worked fine before, the problem started after i accidently wiped my windows partition and reparted that drvie area, i think that it messed up grub and now it doesn't know what partitions to use to boot up but still can work if i use

i don't know how to fix it permanently tho,

doesn't work.

see edit

i know

It's not possible to disconect linux drive, i have linux and windows on the same ssd.
It's also not toast, i'm booted up to my linux install right now, i can turn it on by using commands

in grub rescue, it boots up but i have to type that in each time i want to boot up to linux, windows works fine too.

command works with no errors and i used it before but system still doesn't boot up.

When i first installed linux i made room for it by shrinking encrypted windows volume and moving it, so i had a wierd partitioning scheme:
sda3 - /boot/efi
sda4 - /boot
sda5 - encrypted /
sda1 - windows recovery
sda2 - windows encrypted partition
But now when i reformated the drivei have it looks like this:
sda1 - /boot/efi
sda2 - /boot
sda3 - encrypted /
sda4 - windows recovery
sda5 - windows encrypted partition
so i think that i need to update grub so it looks for normal.mod on sda2, not 4, i don't know how to doo that and

doesn't work.

anyone?
please help

You know what? Fuck this!
I tried tyo fix this instalation for 5 days now, consulting with 3 diferent forums, it’s just fucked. I copied my /home and I’m reinstalling as i write this with systemd instead of grub and with one /boot partition, if after i’m done something doesn’t work then fuck this, i wipe linux becouse i don’t have time for fucking around with a unbootable system for a week with little to no help.

Wiping the installation is probably the more hassle free option. Windows boot-loader does not play well with grub and re-installation of windows always screws up the whole thing. That is why many prefer to keep the OS on different drives.

If you had an ubuntu-based distro i would suggest you try boot-repair. Maybe you can still try it with an ubuntu live usb. Otherwise i cannot be sure.

If you have any files you absolutely require you can use sth like testdisk on windows to recover them. Then wipe the linux installation.

I suggest recovery and backup software for the future as well. I also dual boot and things like these can happen often. People had bootloaders wiped out by windows updates for example. So backups and software selection stuff always saves a lot of time.

The problem was you reinstalled windows and it destroyed your bootloader.

The grub command doesn't work because /boot/grub is for bios grubs but your using efi.

The right location is probably (but you need to look yourself) /boot/efi/efi/osname/grub.cfg or something similar to that effect. I'm not sure why you have a separate boot and boot/efi partition but the issue your having on this forum is probably the same issue your having on other forums. Your not providing enough info and no one is asking you the right troubleshooting questions and just throwing half baked answers at you. Hense why none of it works.

I'll post some things to do in a minute. At the very least it'll give you an idea of the kind of ways to get info

Probably because every installer ever makes /boot ext fs, and /boot/efi must be fat.

Usually you get either two options one you described or just /boot as vfat.

@azor7878 if you still want to troubleshoot (or for the future) first thing to do is run lsblk -f to get the partition/mount layout

Assuming you have a /boot and /boot/efi properly mounted get the file layout for /boot, (as root) tree /boot

upload them to a pastebin (ix.io, fpaste, hastebin) and link here.

You then may need to remake your grub config

grub2-mkconfig -o /boot/efi/loc/of/grub.cfg

You then may need to re-install grub

grub2-install /dev/sda

(grub2-command maybe grub-command depending on your system)

Depending also on how you had your system setup you may need to make sure it has an entry for windows in grub. You didn't mention how it was doing that before.

now i just want to fucking die, copying /home did nothing, i have to reconfigure entire linux instalation and entire windows instalation
i have two blank OSes and i basicly dbaned my SSD 10 times with all the reinstalling end reencrypting
i think i'm done for now, i will just leave this pc not workjing and go cry in the corner

Re-install as you had it before?

copying home likely wont just work as you'll need to install all the stuff you had. No big deal as it never takes long really.

Good tip for SSDs, ATA secure erase is pretty much the only way to actually erase an SSD.

https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase

don't want to since everybody tells me separate /boot/efi and /boot partition is a bad idea and antergos installer requires me to do so with grub, and encrypted /, i'm reinstalling with systemd and /boot only

i know i have to reinstall aplications but i assumed that my configs will be saved in /home and work after reformating and copying it, they don't, my kde config should be in /home right? my kde after reinstalling and copying /home is in it's default state, dosbox too and i asuume all the other aplications i didn't test yet

yeah, i know, i was not talking about data loss, more about wasting wtrite cycles by formating and encrypting entire harddrive.

i don't know if i want to put any more work into linux, i spent like 2-3 weeks setting it up on one, then when that failed on another laptop, i reformated multiple times, tried diferent distros, reconfigured encryption, deskto envirements and aplications only to end up with a clear harddrive and having to do it all over again

@UPDATE:
First good news in days, i managed to get Antergos booting up from just /boot using systemd instalation, i even figured out how to recover parts of my /home config. I copied it with cp -rf and took ownership over /home with chown -R. It's not all there but i think i can work with what i have.
Now i will be installing windows on the second partitions, wish me luck!

@UPDATE 2:
Fuck my life...
Windows boot manager replaced systemd, i can't boot into antergos anymore...
What do?

@UPDATE 3:
I have fresh installs of Anteros and Windows 7 on the same harddrive.
Anteros is located on two partitions, unencrypted /boot and encrypted /.
Windows 7 is encrypted with VeraCrypt.
I don't need EFI Windows Boot Manager, i have VeraCrypt Boot Manager so SysteMD can replace WBM.
Please help.

You're doing it backwards.

Install Windows then Linux. Installing Windows causes the Windows boot loader to be installed. Installing Linux causes the Linux boot loader to be installed.

Linux is smart enough to work around Windows. Windows doesn't care and will delete Linux's boot loader every time.

If you install Windows then Linux, at least with Grub, the boot loader will overwrite the Windows boot loader, but it will create a boot entry for Windows with the default being Linux. I don't know about systemd.

If you keep doing Linux -> Windows as the install order, Windows will just keep deleting Linux's boot loader, no matter which one it is (systemd, Grub, wtv).

/home only contains your user files. If you wanted to preserve your applications, then you'd probably just want to get a list of what was all installed and reinstall it later. Easiest way to do that is the following:

pacman -Q >> Application_List.txt Then keep that .txt for later when installing everything over again.

Once you've got things how you want them, make a backup of your system with the following:

dd if=/dev/sdX conv=sync,noerror bs=64K | gzip -c > /path/to/backup.img.gz

Which I pulled from here: https://wiki.archlinux.org/index.php/disk_cloning

This will create a compressed byte-by-byte image of your entire OS disk (both Linux and Windows).

Then never install Arch/Windows again. Just reimage the drive if you ever need to redo something and start again from a working installation.

Going back to that (I know your setup is different now after multiple reinstallations), you should probably install os-prober, then remake grub's config file allowing it to see the Windows installation. You want it to see the Windows installation.

I don't use grub/systemd to boot into windows, i have VeraCrypt BL selected as my default in uefi, if i want to boot into linux i press escape and it goes to linux bootloader.

Both systems are encrypted with prng data in free space, that would create a 128GB file to copy, store and recover later. I don't even have a pendrive this big to save this image to and recover recover it later so i will have to stick to manually installing linux each time, sadly.

yeah i've successfully dual booted Linux several times by doing Windows first. it's extremely easy with Ubuntu and such.

1 Like

So to clarify what you are currently doing:

  1. Installed Antegeros with GRUB or systemd.
  2. Installed Windows.
  3. Encrypted Windows with VeraCrypt.

And the issue you are having is after doing this, GRUB (and now systemd) cannot boot into Linux?

If that's the case, VeraCrypt installs to the disk's MBR (Master Boot Record). GRUB installs to the gap between the MBR and the rest of the disk. I don't know how systemd does it. But GRUB and VeraCrypt shoudn't conflict.

What I'm thinking is happening is this (it's a guess):

VeraCrypt causes the drive designations in GRUB to change. Meaning that hd0,gpt2 isn't hd0,gpt2 according to GRUB when it was originally installed. And if you boot directly into the Linux OS with those commands, suddenly everything is right again, so when you run grub-mkconfig -o /boot/grub/grub.cfg or whatever, it isn't changing anything so the problem persists.

What I would do (If you chose to use GRUB):

Boot into an Arch or Antegeros Live CD/ISO and install grub, then run grub-mkconfig -o /boot/grub/grub.cfg or whatever from there. The "or whatever" means "if you aren't putting grub's config in /boot/grub".

The reason why is simply that this live CD/ISO isn't the Linux OS you installed. It might see the Windows partition along with VeraCrypt the way GRUB sees it on boot, and not the way GRUB sees it after you have gotten into the Linux OS you installed or after GRUB rescue has initiated.

Note: I'm saying do this after arch-chrooting into your actual installed OS and not just from the Live CD directly.

I doubt that specifically would work, but you could try it. I think the more possible solution is to just manually edit /boot/grub/grub.cfg and change hd0,gpt2 into hd0,gpt3 and hope that works. If it doesn't, you could try various combinations (like hd1,gpt1, hd0,gpt1, etc) until it does work.

I'm imagining VeraCrypt shows up as it's own partition somehow and that's throwing off the numbering. But it's temporary, so when GRUB looks for hd0,gpt2/grub it's not finding it. But once you're in the rescue menu, VeraCrypt is done doing whatever it does during boot and so hd0,gpt2 is now what it's supposed to be.

I wouldn't know how to see which device GRUB is being labeled as during boot another way, but it's a good guess that it'd be hd0,gpt3 if VeraCrypt is showing up temporarily then going away.

I have similar software on my flash drive that lets me boot directly to multiple ISOs using a menu, and that software rewrites the partitions on the fly to make it work without ever deleting or overwriting files. Maybe VeraCrypt does something similar during boot.

I figure the same problem is happening to systemd. But I have no experience with it, so I can't tell you how to get systemd to update the drive lettering. I'd presume it's the same process:

  1. Boot into some Live CD.
  2. Chroot into current OS installation.
  3. Install Systemd's packages if there are any.
  4. Run it's configuration setup.

I mean... It's going to compress the data on the byte-level as much as it can. I'd try it to see how big the image would ultimately be if you have an external HDD available. I doubt it would really be a complete 128GB. Probably wouldn't compress nearly as much as if it were all really free space, but I wouldn't expect 100% the size. I'd guess 70-80%.

Also: https://www.amazon.com/Samsung-128GB-METAL-MUF-128BA-AM/dp/B017DH3NOW

Those are fantastic USB Drives. Made of metal so robust, and I regularly get over 70 MB/s transfer speeds out of them (so at least HDD speeds).

Found this while researching:

Found this as well (see second comment):

Yup. If you try to do it during the Veracrypt system encryption process by selecting the appropriate options, it will tell you that this is not supported, but you can still make it work, even with a single drive.

Here is how. Make sure the Linux boot partition is right after the Veracrypt Windows partition to be encrypted, and then force the GRUB boot loader to install to the Linux boot partition instead of the MBR. Then, if you press esc when asked to enter the password for Veracrypt to boot Windows, it will proceed to boot the next partition (the Linux one) instead.

I myself do this, and the Linux install is encrypted with Luks. If you want to share data between the Linux side and the Windows side in an encrypted manor, Veracrypt runs on Linux, or you can also use tcplay and then use Veracrypt's Truecrypt compatibility mode. I made it so that there is a common data partition which gets mounted when either

Windows or Linux is started.

I reinstalled antergos as @Vitalius and @Goblin sugested so my instalation now was windows first, then linux and systemd removed both windows boot manager beracrypt bootloader, now i have only systemd in efi.

Thanks @Vitalius for your guide but i tried most of what you sugested, live antergos chrooted to my install throws up errors on grub-install and bootctl --path=esp install when grub and systemd are istalled respectivly. Changing gpt2 to gpt3 didn't work either, i tried that on my own.
As to veracrypt showing up and messing up drive order, maybe but it used to work and i'm pretty sure last time i was installing i did it in this order: install windows, encrypt it, install linux with grub2.
I would use grub since it worked last time but then i'd have to use two boot partitions again becouse antergos installer can't progress the instalation unless i make /boot/efi partition and since my / is encrypted when i try to make only /boot/efi with grub system doesn't boot after instalation, becouse /boot is encrypted with no means to decrypt the system, so basicly i have to either have to:
1. install antergos
2. install windows, it will replace systemd efi
3. encrypt windows, veracrypt will create new efi entry
4. fix systemd efi, hopefuly without touching veracrypt bootloader
or:
1. install and encrypt windows
2. install antergos with grub2
which creates new efi entry leaving wbm and vcbl untouched but creates two efi partitions and will break if i need to reinstall windows for some reason and i won't know how to fix it again

1 Like

I would do that and do the following:

Except put the letter where the X is and change the number to whatever partition your boot partitions are.

Essentially make a backup of the two boot partitions and after reinstalling windows, image over the /boot/efi partition and see if that works. It might. Note that you should create these backups right before you reinstall Windows. The reason why is simply because the grub config is updated every time you get a kernel update. So if you keep an old copy and reimage it over a newer grub /boot/efi directory, you'll be booting off the old kernel. Though I guess that's as simple to fix as grub-mkconfig -o /boot/efi/grub.cfg. Not sure how it'd affect systemd.

If I were you, I'd be worried that this process could repeat itself though. Since Windows 10 updates are major OS changes (like Anniversary Update, and Creator's Update), I figure your system might break itself every so often without you prompting it to.