this post was submitted on 05 Sep 2023
43 points (95.7% liked)

Linux

48031 readers
994 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
 

Hi, I'm an old windows user who have played with linux* a few times, but never commited to it.

I want to dive deeper and I though about installing linux in a VM. Some basic questions:

  • Is that a good idea? / Anything I should take into account?
  • Is there any preferred VM manager for this? Windows comes with Hyper-V, but I remember reading about how Hyper-V is not ideal (I could be wrong).
  • Do different distributions work better or worse on VMs?
  • Are there any major differences when using linux in a VM compared to a bare metal installation?

And some not-so-basic ones:

  • Is there any [dis]advantage to "Linux VM on Windows" VS "Windows VM on Linux"?
  • If I start with "Linux VM on Windows", would it be possible to swap them in the future? What I mean is:
    • Virtualize the Windows installation so it can be run as a VM.
    • Un-virtualize the Linux VM (with all its contents and configuration) and move it to bare metal.
    • Run Windows VM on linux.

Notes:

  • I did a quick search and, although I found multiple articles about the topic, the ones I've read just show one way to do it without comparing it to the alternatives.
  • I'm aware of WSL(2), but I would like to be able to decouple from Windows in the future.
  • EIDT: I tried dual booting in the past. The main problem is that I'm too lazy to reboot every time I want to try something in linux and I end up not using it.

Thanks!

* Mandatory linux = GNU/Linux

top 21 comments
sorted by: hot top controversial new old
[–] qwesx@kbin.social 18 points 1 year ago (1 children)

I'll answer what I can in good conscience.

Is that a good idea?

If you keep in mind that it won't 100 % behave like a "proper" installation when things go weird it's fine.

Do different distributions work better or worse on VMs?

VirtualBox comes with some pre-made profile for some distributions but I've never been able to tell what those actually do, other than by default selecting virtual hardware that is supported.

Are there any major differences when using linux in a VM compared to a bare metal installation?

VM "hardware" is well supported, but anything requiring proper hardware acceleration (of any kind) will either perform terribly or fall back to a software-based backend. I.e. desktop compositing or hardware video decoding may or may not work as well as a native installation. Video games likely won't work in a usable way at all, unless it's Solitaire. Also the hard disks are decoupled from the VM to the host system and you need to manually forward USB devices to the VM or the system might not be able to detect them.

Is there any [dis]advantage to “Linux VM on Windows” VS “Windows VM on Linux”?

That entirely depends on what you want to use both systems for. If you already have Windows installed then I'd like to suggest the following path:

  • run some live USB to figure out whether your hardware is supported (graphics, sound, network, printers - especially the latter two)
  • if so, install Linux in a VM first (install multiple desktops and try them out, because why not)
  • figure out what programs are available that do the things that you usually do on Windows - keep in mind that just because $PROGRAM is written by GNOME/KDE/LXQT/... people that doesn't mean that it won't run perfectly fine on other desktops. Also: distributions may not ship all software, don't forget to check Flatpak/Flathub if your distribution is missing some software.
  • try them out in the VM to see if they meet your basic requirements
  • install the Windows version of those programs on Windows
  • over time, replace the Windows programs that you used to use for the ones that are also available on Linux
  • if after a few months there are no non-Linux programs left: Congrats, back up your data and just use Linux
  • otherwise: figure out whether the programs that you need will run well enough with Wine or in a Windows-VM

If it turns out that there's just too much Windows-only software that you can't part with then you can just delete the VM and that's it. On the flip side you can find software that may just happen to be better than what you used previously. Also trying out various distributions is much, much easier this way - installing the tenth distribution on bare metal because you weren't happy with the previous nine isn't particularly fun.

[–] Crul@lemm.ee 3 points 1 year ago (1 children)

Thank you very much for the in-depth answers. It makes a lot of sense

I'm happy to say that most of the problems won't probably apply to me. I have a laptop with no dedicated GPU and I don't play high end games, so I think there will be no problem with that.

Is that a good idea?

If you keep in mind that it won't 100 % behave like a "proper" installation when things go weird it's fine.

It's probably impossible to list all the possible differences, but do you know what are the most common ones?

Thanks again!

[–] qwesx@kbin.social 4 points 1 year ago (1 children)

It’s probably impossible to list all the possible differences, but do you know what are the most common ones?

The ones that I mentioned regarding direct hardware access of any sort.

[–] Crul@lemm.ee 2 points 1 year ago

Oh, sorry, I didn't link the 2 parts of your comment.

[–] nosnahc@jlai.lu 13 points 1 year ago

I don't know a distribution which work better on VM but for an old Windows user, I recommand Linux Mint. Close to windows GUI and really easy to use!

[–] Moobythegoldensock@lemm.ee 8 points 1 year ago (3 children)

Is this a good idea?

Sure!

any preferred VM manager

I like Virtualbox.

  • Do different distributions work better or worse?

Depending on your specs, you may want to go lighter than you would on bare metal. For example, if you have 16 GB of RAM, you might want to only give your VM 4 GB of RAM so Windows can run on 12 GB, and then pick a lighter distro so it won’t be slow on 4 GB.

Any major differences?

Snapshots are way easier in a VM.

Advantage/disadvantage

Windows VM on linux is painfully slow and doesn’t have a license, so it’s much less good than linux VM on Windows IMO.

Would it be possible to swap?

Not as far as I’m aware, but smarter people than me have probably done it.

[–] isVeryLoud@lemmy.ca 9 points 1 year ago

You can license Windows in a VM, you can grab your Windows license from the UEFI system using a command:

sudo strings /sys/firmware/acpi/tables/MSDM

[–] westyvw@lemm.ee 4 points 1 year ago

Windows vm on a Linux box is not painfully slow. It's about the same as native, where did you get this idea?

[–] Crul@lemm.ee 1 points 1 year ago

Depending on your specs, you may want to go lighter (...)

Good point regarding balancing hardware resources.

Windows VM on linux is painfully slow and doesn’t have a license, so it’s much less good than linux VM on Windows IMO.

Good to know.

Thanks!

[–] Eldritch@lemmy.world 6 points 1 year ago (1 children)

While there's nothing wrong with VMs or USB live systems. I'd like to put forward the suggestion of hopping on eBay and picking up a piece of old business e-waste. If you really want to dive in with security and safety. It's about the best way. A 4th generation i7 Business Systems has been going on there for anywhere from 50 to $80.

Especially since if you are techie enough to have the itch to actually dive in on your own. Should you decide to keep exploring with it. You will eventually want a small Homeland set up of some sort most likely. At which point you can convert that system into your server for your main system.

I have a number of systems amassed over the last 30 40 years. And ironically despite having much newer rizen systems that I use for a bit of gaming here and there. One of the systems that I use the most is an old 4th generation i7. I have it near the bed so I can sit on it at night puttering around reading, light gaming or a little coding if the mood hits. Loaded up with endeavor os. I have a few other systems around with debian and fedora. One of them being a server. With home shares on NFS. Which makes things really nice because if anything happens to my user systems I just wiped reinstall toss on a couple configs and I'm back to where I was

[–] Crul@lemm.ee 2 points 1 year ago (1 children)

Interesting suggestion, I'll think about it.

[–] Eldritch@lemmy.world 2 points 1 year ago (2 children)

Pre pandemic I would have recommended people get something like a Raspberry Pi to explore learn and experiment on. Even if you aren't into all the electronics possibilities the gpio on them allows. They are awesome compact little systems. But right now they're so costly and hard to find. These ancient x86 Business Systems are a more cost-effective platform for just having a learning system. Which is fairly nice. That way you're not tying up one or the other. But can use both at once.

Though I actually am trying to hold off at the moment from getting one of those new Lichee pi 4a systems to toy around with riscv. They seem pretty polished already. But I'm not quite that technical and would rather wait around for a bit more polish on the software side lol. That and a host board with m.2 nvme support.

[–] cmnybo@discuss.tchncs.de 2 points 1 year ago

The Orange Pi boards are readily available at a decent price if you want an ARM SBC with some GPIO pins.

[–] Crul@lemm.ee 1 points 1 year ago

Yeah, RaspberryPi-alike stuff if also something I want to look into in the future. But it is probably best to take it one step at a time.

Thanks for the ideas!

[–] aberrate_junior_beatnik@midwest.social 4 points 1 year ago (1 children)

Short answer: go ahead and install whichever Linux distro you like on Hyper-V and go from there.

Longer answers:

Linux works fine on VMs. There aren't really any caveats. Hyper-V should be fine. It's been a while since I used it but I remember thinking it was OK. I preferred it to Virtualbox; I think the Virtualbox drivers made some stuff flaky on my machine, but YMMV. I ended up shelling out for VMWare which I'd used at work. Some distros offer cloud images that are tailored for running as VMs, but unless you're running a cluster with a lot of VMs I don't think there's any advantage, any distro will work. There aren't any significant differences running Linux on a VM from running it on a physical machine.

As to which OS to use for a host, the commonly understood strengths & weaknesses of each OS apply the same as they do in other domains. Windows has better desktop hardware support, Linux tends to be more power-user friendly, etc. It depends on your priorities which you choose. Maybe the biggest factor is that Windows has Hyper-V, whereas Linux has Xen, KVM, and qemu. Either platform can use Virtualbox or VMWare.

P2V and V2P are definitely things. Searching for them online will return tools that will do this. Linux should be rather straightforward to transfer even without a specialized tool, assuming you aren't using a distro (or distro variant) that is specially built for VMs. dd should work like a charm. It should be possible to do invert the host and guest.

If that sounds like a whole lot of nothing it's because that's kind of the way it is with VMs. They just work.

[–] Crul@lemm.ee 3 points 1 year ago

Thank you very much, it seems I'm on ~~the~~ a right path.

[–] GoumLeChat@jlai.lu 2 points 1 year ago* (last edited 1 year ago) (1 children)

I tried dual booting, and I found it to be annoying as well. I always had to reboot because something I needed was on the other OS. Over a few weeks Linux was just taking space on the drive.

More recently what I've been doing was to run Linux in a VM that starts automatically on full screen when opening my Windows session (easy to set up). So now I can work with both in parallel, transfer data, synchronise clipboard with Ditto, have my Windows-specific software while still using Linux as my daily OS. Even better now since I have a NAS which I didn't have during the dual boot period, so I can mount drives for both. For that you can either use VMWare Workstation Player or Oracle VirtualBox, they're both free.

When it comes to swap, of course you will be able to run Windows in a VM on Linux. But transfering your current data ? I'm not sure at all. It might be doable, but I think you should save your data externally for both machines and do a proper reinstall. It will save you some time and hassle.

[–] Crul@lemm.ee 2 points 1 year ago (1 children)

Thanks for the answer!

May I ask you how do you balance resources (mainly RAM) between Windows and Linux?

[–] GoumLeChat@jlai.lu 2 points 1 year ago* (last edited 1 year ago)

Well that's my main issue, my rig runs an i5-6900 and I have 16GB RAM. I gave 6 to the Linux VM, and try to maintain the usage on Windows as low as possible : not having the browser running on both, a plug-in to put to sleep tabs not used, stopping processes I'm not using. KDE is a bit too much in my case, but Cinnamon, or XFCE are working fine. I've found a new love with i3wm but it needs some time to tinker it to your taste.

But if you have a more recent computer, you should be fine. Upgrade the RAM maybe, if you find it to slow.

[–] eddanja@lemmy.world 2 points 1 year ago

It depends on what you are trying to accomplish.

If you want a pretty desktop environment or you need all the bells and whistles of a specific Linux distribution (Debian, Fedora, Ubuntu, CentOS, etc.) then a virtualize environment is probably the way to go.

If you just want to get used to playing with Linux commands using bash and you only need about 80% of the full functionality of a pure Linux environment, then Windows offers the Subsystem for Linux which installs like an app you can run at anytime.

I personally use the subsystem for Linux on my Windows work laptop so I can quickly write Python scripts and test application configs for production servers. It's quick and dirty and I can easily share files between Windows and Linux. It also has a small footprint on the computer as oppose to a VM.

Whatever you decide, have fun! Linux is awesome.

[–] ashaman2007@lemm.ee 1 points 1 year ago

Vmware workstation player is extremely good. Setup is simple and as far as I know it is faster than VirtualBox. I use it with Windows 10/11 and RHEL Linux for developers.