this post was submitted on 05 Dec 2023
25 points (90.3% liked)

Linux

48179 readers
968 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hello everyone! I hope to be posting in the correct place, if not please tell me and I'll delete this. I have a W11 VM on my EndeavourOS KDE laptop that I use because of some software I need for university that does not run under wine (LabVIEW and Keil uVision). The VM is running on virt-manager (QEMU KVM) using the virtio drivers, and it works really well (I mean, to be windows). The only problem is that today I run a windows update and... sbem, BSOD after reboot. The automatic diagnostic fails to do anything, uninstalling updates fails, of all possible recovery options the only one that does "something" is the command prompt, that I have 0 experience using. This was the first time updating since I created the VM a few weeks ago. Now my question is: is this fixable? Is there at least a way to recover my files, perhaps using the cmd? Thanks in advance to everyone!

EDIT: I managed to get my files back by adding a new CDROM device in the VM with a live xubuntu iso. Then from Windows recovery shit reboot into BIOS and select that device to boot from (in my case CDROM 3), then navigate to the Users/thenameoftheuser folder and backup on a USB or something all the data you need. I'll try now to fix the windows installation without fearing the loss of my data... Lesson learned, never trust windows neither inside a VM, always better to keep important data in a separate disk (like shared memory) so that in case of VM failure they are safe in a different place
thanks to everyone!!! marking this as solved as my data are safe now, I'll update if I'll achieve to fix windows (perhaps by reinstalling)

all 23 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 11 months ago (2 children)

You can boot the VM from a liveCD ISO and then mount the drives to extract files (share a USB storage device to easily get them off). You could also add a second virtual disk, put an NTFS partition on it (within the VM) and copy to that if you plan to rebuild the OS drive.

If you need the offsets of the partitions you could also mount them from the disk image directly via a loopback device, but that's a bit more complicated.

When dealing with Windows either on bare metal or VMs, I've often found it useful to store my more important data on a second disk so that I can easily back it up and it will survive across a wipe+reinstall of the OS.

[–] [email protected] 2 points 11 months ago

This is a good life lesson I think XD i'm downloading a live iso as I don't have one and i'll boot the vm from there as soon as the download finishes
Thanks for the answer!

[–] [email protected] 2 points 11 months ago (1 children)

I achieved to retrieve my files!!! thank you very very very much! Now I can try more "dangerous" way to resurrect it because my data are now safe in my USB drive

[–] [email protected] 2 points 11 months ago

Glad it worked for you. Your could also try and of the recovery options after booting from a Windows ISO. I think there are a few things that can do there that aren't in the boot-failure recovery menus.

If not, then at least your data is safe for a reinstall

[–] Synthead 5 points 11 months ago (1 children)

My least favorite thing about Windows, above all things, is that it's extremely difficult to discover what's wrong with it. People just try random things until it works in most cases.

[–] [email protected] 3 points 11 months ago (2 children)

Yeah it's terrible, not a single error code to search for on the web...

[–] Synthead 4 points 11 months ago

Why search for error codes when your operating system has every opportunity to tell you what's wrong?

[–] [email protected] 3 points 11 months ago (1 children)

It may be just file corruption. Try running chdsk.exe /f C: in the command prompt. If that doesn't work, try dism.exe /online /cleanup-image /restorehealth. Keep your virtual NIC online for the second command, it may try to download updates from MS if local files are corrupt and the WinSxS backups are corrupt as well.

[–] [email protected] 1 points 11 months ago (1 children)

Thanks for the answer! The first command says chdks.exe is not recognized as an internal oe external command, and the second commands says Error: 87 cleanup-image option is unknown

[–] [email protected] 2 points 11 months ago (1 children)

Sorry, chkdsk.exe /f C:... it was late, I was tired 🤷.

Error: 87 cleanup-image option is unknown

Try it without the cleanup-image switch.

[–] [email protected] 1 points 11 months ago (1 children)

It says "cannot open volume for direct access" :(

Running the second command without cleanup-image flag says the same thing for restorehealth, and running without it too well, has no options after /online so fails

Thank you very much for your time!

[–] [email protected] 2 points 11 months ago* (last edited 11 months ago)

The prompt doesn't run as admin. Try this command, should open up a second command prompt as admin: runas /username:{AdminUsername} cmd.

[–] [email protected] 3 points 11 months ago (1 children)

Can you post a screenshot of the BSOD? This is really not much info to go on :)

But if you can access the command prompt, then your installation is still accessible, and so are your files. But its easier to diagnose if we know the actual error codes etc.

[–] [email protected] 2 points 11 months ago (1 children)

Thanks for the answer! There is no error code, the first thing showing up is a blue screen that makes me choose the keyboard layout, and after it the various recovery options (cmd, uninstall updates, etc)

[–] [email protected] 3 points 11 months ago* (last edited 11 months ago) (1 children)

So no BSOD then, you enter the preboot.environment :) does it also say "continue to boot to windows" or something?

I dont think you need to reinstall, theres several ways to fix it :) we just have to figure out how knowledge you have, and what options the preboot environment has ;-)

[–] [email protected] 2 points 11 months ago (1 children)

I... I... I don't know what happened, I was doing random stuff in the bios and... It booted up... Finished its upgrades.. And now it's working.... I have no idea what happened...

[–] [email protected] 2 points 11 months ago

Well that settled it then. You're an IT expert. 😂

[–] [email protected] 2 points 11 months ago* (last edited 11 months ago) (1 children)

Been a while since I had a VM but iirc it was pretty easy to have a shared directory to the VM, which is very useful to (obviously) share files but it also means that since the files aren't actually on the VM itself they'll still be there even if you remove the VM since they're not part of the image.

 

How I learned my lesson to have a shared directory was this: I had been having audio issues on the VM and at one point just decided to start over with a new VM, completely forgetting that the files I had been working on for a project were part of the VM and would be gone.

[–] [email protected] 1 points 11 months ago

XD I think I learned the lesson too

[–] [email protected] 1 points 11 months ago* (last edited 11 months ago)

Bob the Builder meme

But really, try booting a portable version of Windows like it's a CD or USB in the VM.

[–] rImITywR 1 points 11 months ago (1 children)

Do you have an earlier snapshot that you can roll back to? If not then this is a learning experience about how you should take a snapshot before doing any configuration changes/updates. And also maybe some automatic ones on a schedule (daily/weekly).

As far as recovering files, you could try the Windows recovery environment (or whatever they call it). Take a snapshot first, in case it makes things worse.

You could also try mounting the virtual disk to your host system. https://www.baeldung.com/linux/mount-qcow2-image

Or try booting the VM with a live boot environment of your favorite distro, similar to how you would do recovery from a dead physical machine.

[–] [email protected] 1 points 11 months ago

I don't have any, I didn't think it was necessary to just run 2 softwares.... But I was wrong :(

And also maybe some automatic ones on a schedule (daily/weekly)

Don't Windows do it automatically? I though it was more stable than this :/

Or try booting the VM with a live boot environment of your favorite distro, similar to how you would do recovery from a dead physical machine.

I'll try this as soon as I can, thanks for the help! I'll post here any news