So the background to this one, recently I had the grand idea of updating my Win 11 install to Windows 22H2 via the ISO installation. This caused me a whole world of pain…. For those who’ve not tried, when you upgrade via downloading the latest ISO, mounting it and running the install. In this process, Windows will remove all existing applications, although the advice through the prompt is rather cryptic.
The problem with the WSL and Windows Upgrade process is that WSL Linux distributions save their vhdx files within %AppData%
of the runtime user. During the upgrade process, Windows will created a backup of:
C:\Windows
to
C:\Windows.old
As such when you new fresh version of Windows 10/11 boots up, then non of your existing global or userspace applications will currently be accessible through the Windows menu. If like me, you reinstall all the applications you need, turn back on the hyperv and Windows Subsystem for Linux features, reinstall the ubuntu distro you’ll notice that it’s for all intensive purposes a fresh install with all your original data absent. If you find yourself in this situation never fear, here’s what todo next:
To find this you’ll need to dig into:
C:\Windows.old\Users\<your_username>\AppData\Local\Packages\<distribution names>\LocalState\ext4.
sudo apt-get install libguestfs-tools
sudo mkdir /mnt/recovery
sudo guestmount --add /mnt/c/Windows.old/Users/<your_username>/AppData/Local/Packages/<distribution names>/LocalState/ext4.vhdx --inspector --ro /mnt/recovery
Personally do NOT to the below command as depending on your distrro and your previous distro this could cause mayhem. Personally I would just copy the files you need.
sudo cp -R /mnt/recovery/ /
instead, I’d just copy your profile:
sudo cp -R /mnt/recovery/home/<profile> /home/<profile>