Any reason NOT to run Linux in a VM all the time?

138,507

Solution 1

Assuming you can get everything working, and you don't want to do resource intensive tasks such as playing games or doing large compiles, then I think you'll be fine.

There's some basic issues you will probably encounter:

  • guest time incorrect
  • guest screen size or color depth incorrect
  • can't access USB devices (printers, phones, etc.)

To fix this, you should install VirtualBox guest additions. See the VirtualBox Arch Linux guests guide for details.

To get some extra features, such as USB 2.0 and Intel PXE support, you can also install the VirtualBox extension pack.

After that, there's a few issues you should know about:

Obviously your Linux VM will be affected if your Windows system crashes too. Issues I've had happen recently:

  • Windows host crashes due to driver bug (blue screen)
  • Windows host reboots due to security update

When running a virtual machine the biggest performance hit will be to your disk I/O. If at all possible, put your VM on a separate disk and/or use a solid-state drive. Using a virtual SATA drive instead of a virtual IDE drive can help too.

Solution 2

I teach a hands-on class on Linux, and unfortunately, by company policy I'm not allowed to reformat the class-provided laptops, so we're going by the VirtualBox guest approach.

Ignoring all performance concerns, here are some notes / problems I noticed:

1) Bridged mode and Wireless

Some wireless cards apparently have difficulty having "dual identities", which means that our routing / firewall / networking lessons go to hell. It's a known issue - most wireless drivers do not support bridging.

bridge | The Linux Foundation - It doesn't work with my Wireless card!

This means that if you're using a wireless interface, you have to do some extra work for the guest to have a "public" IP.

2) Desktop Integration

Save for a few wallbangers in design, the modern desktop environments are pretty well thought-out, and offer some conveniences that are lost when they don't have full access to the input/output, or to the device attach/disattach tool. For instance, the Vbox menu at the bottom gets really annoying if you have a window chooser or notifications there. And some machines use the Ctrl+Alt+cursor_key shortcut (switching workspaces) as to flip the display.

I mean, compare how easy it is to disattach a USB device in GNOME, vs the equivalent number of submenus / clicks in Windows, and I know which one I'd prefer any day.

3) USB "stealing"

Sometimes, windows just doesn't want to let go of a USB drive - telling virtualbox to attach it doesn't always work - most likely when windows is reading the contents for some reason or other. And then there are some USB drives that aren't straight-up storage devices, but do a mode switch-like action to make your drives accessible - those are annoying to attach to the Linux machine.

4) Stability

It's typically easier to "break" Windows than Linux, which is why you typically want to have Linux "protect" Windows instances, rather than vice versa. I already lost a couple of work days with the staff overwriting the wrong files and ending up breaking both our installation of Virtualbox and our Linux images.

5) Command Line Tools

On Linux at least, you have the option of mucking around with Vbox disk images using qemu-nbd and the network block device.

QEMU/Images - Wikibooks, open books for an open world - Mounting an image on the host

This lets you look at and modify the contents of the guest OS disk without having to boot it, for example, if you rendered it unbootable.

You could also do things like scripting backups of VDIs - or just their contents, or changing VirtualBox "profiles" via symlinks - a lot easier on bash.

Solution 3

Don't forget that a VM is an emulation. Your Unix system will never be as powerful in a VM than installed. Archlinux is made to fit your tastes, it is a distribution you can customize to it's maximum.
I used to make it run on a VM, though I thought about installing it definitely on my computer. Now my system boots in about 15 seconds, my builds are a looooot faster and everything is working better.
Archlinux is not that big, you can install it on a small partition (just make sure you have enough space for your programs on your root partition (I had to reformat my root partition because it was too small)). If you use Windows only for playing, you should consider that option =)

PS: Yes installing straight on your computer will make your life amazing. :P

Solution 4

There are three ways you could set up the two OSs:

  1. Windows host, Linux VM (as you have it).

  2. Linux host, Windows VM.

  3. Dual boot.

If you want to run Windows games I would not recommend option 2.

If you regularly want to use a Windows only program (that doesn't run well under Wine) during your Linux session then option 3 won't work well for you.

If you use non-game Windows stuff so rarely that rebooting isn't much of a chore then option 3 is the most efficient.

So, the question is: does your current set up annoy you? Or, is it good enough? The old real downside I can think of is the extended boot time and lower memory availability.

BTW, it is possible to set up a dual boot system where you can also boot the same Linux install inside a VM in Windows, but not the other way around (Linux detects hardware at boot time, but Windows has it's drivers hardcoded, once installed).

If you want a try-before-you-buy dual-boot set up then try out the Ubuntu "wubi" installer. (Yes, I know you're an Arch guy, but you're just trying it, right?) Wubi installs the disks as an image file within Windows, just like a VM, but it boots it as a host OS. There's no partition meddling, and you can uninstall it right from the Windows Control Panel, when you're done. The only down-side is that disk I/O performance is slightly reduced.

Solution 5

If you use this box mainly via SSH, there's a good chance that you're in the butter zone where it really doesn't matter much whether it's a VM or on real hardware. Many of the problems mentioned in other answers come up when you're trying to use the guest OS as a GUI desktop. Linux servers are very happy inside VMs; a huge chunk of the web hosting market is Linux in VMs.

I've run into just a few cases where I was forced to run a Linux server on real hardware, instead of in a VM:

Real Hardware Access

Sometimes you need to use some PCI card that the VM system can't virtualize. Say, a 4-channel MPEG-2 decoder. Some VM systems can give exclusive ownership of the card to the VM, such as via Intel's VT-d technology, but that's not without its problems:

  • There's a speed hit. It might matter.

  • Not all VM systems can do this, and you might not have the freedom to switch to one that can.

  • There may be inessential consequences, as with VMware ESXi 5, where giving a VM ownership of a card requires rebooting the host, and then prevents it from doing snapshots of that VM. (By inessential I mean that these problems could be solved, it just takes development time.)

Big Storage

Your VM system may not be able to create a virtual disk as large as the bare hardware allows for real disks. VMware ESXi 5, for instance, has a 2 TB virtual volume size limit. If you need a larger single volume inside the VM, you have to jump through hoops to work around the limitation:

  • You can push a RAID controller through to the VM with VT-d, but again, it has problems.

  • You can push a passel of 2 TB virtual volumes through to the VM and string them together with LVM, but you've bought yourself a passel of problems, too.

    For one thing, when (!) one of the physical disks dies, if you were using the guest OS on bare hardware, you could diagnose and fix it by using the provided management software, such as 3Ware's 3DM or tw_cli software. But try finding versions that will run on a VMware ESXi 5.0 host! Now you're forced to reboot so you can use the BIOS management interface.

    For another, the abstraction layer has disconnected the virtual volumes from the physical volumes, so the software RAID/LVM layer in the guest OS can't manage the disks efficiently. That layer may think it's being clever writing to disks in a round-robin fashion, but because they probably share some of the same physical disks, performance will take a hit because some disks are getting back-to-back writes.

  • You can create the volume on a real hardware system and export it to the VM via NFS, but there's a speed hit when you do that, too.

You may be able to counterbalance some of the above with virtualization advantages, such as the ability to pause a VM, move it to another host, and start it back up again seamlessly.

Share:
138,507

Related videos on Youtube

Alexandr Kurilin
Author by

Alexandr Kurilin

Updated on September 18, 2022

Comments

  • Alexandr Kurilin
    Alexandr Kurilin over 1 year

    I've switched to using Arch Linux for most of my day to day work and don't need Windows for anything but gaming and the couple of apps that aren't ported to Linux like OneNote. My Linux distribution is hosted in VirtualBox with Windows as host, and I quite like it that way, snapshots are incredibly useful.

    Let's say I were to pretty much never care about the Windows host and spend 95% of the time in the guest, what would I be missing out on?

    Are there serious downsides?

    Is performance severely affected and will installing straight onto the machine make my life much more amazing?

    • Admin
      Admin about 12 years
      ...and there's an argument for using Free Software. Note that you could also turn things upside down and emulate Windows under Linux (or some other FOSS OS, say, OpenIndiana). Also, OneNote seems to be partly working under Wine.
    • Admin
      Admin over 11 years
      In addition to all of the excellent answers already provided, I would just say that with the current environment you could lose your Linux setup if your Windows ever becomes corrupted due to a virus or other Windows security hole. Just something to be aware of.
    • Admin
      Admin over 7 years
      You mean aside from your Linux being systematically rebooted by Windows Update? And those restarts will take twice the time because you have two systems to boot.
    • Admin
      Admin about 5 years
      I dual boot, however I am considering tu run Linux as guest because Windows drivers are much better for my machine. Under Linux, Wifi and SD are crippled, and USB is buggy. My main gripe with Windows is that it is resource intensive by default.
  • Osama khodroj
    Osama khodroj about 12 years
    There's usually no need to reformat. I've used GParted (also available as a live CD) to resize existing partitions (FAT,NTFS,EXT2/3/4), with no ill effects.
  • Alexandr Kurilin
    Alexandr Kurilin about 12 years
    I'm currently running GNOME in 2d mode in fallback mode, which works fine for me. I also tried turning on 3d acceleration on the VM and had GNOME successfully work as well without much trouble. Arch has a pretty decent guide for how to support most VirtualBox features that seems to have done the trick.
  • slim
    slim about 12 years
    Emulation is a bit of an overloaded word. In one widely used sense, virtualisation is not emulation. Modern CPUs are designed for virtualisation -- code running in your VM is being handled natively by the CPU. The VM bridges IO efficiently -- because there's really not that much to do - read from here, write to there. You wanna experience emulation -- try running Linux in DOSBox or QEMU and see how much slower it is!
  • MikeyB
    MikeyB about 12 years
    Virtual machines on modern systems is not emulation. If anything the IO is emulated, but usually the drivers themselves are aware they are in a VM and there is little overhead.
  • calum_b
    calum_b about 12 years
    Actually, the advent of llvmpipe means you won't necessarily need 3D hardware acceleration for much longer -- the GNOME 3.4 live CD (based on Fedora 17) runs gnome-shell just fine in VirtualBox with no guest additions. Performance suffers a little of course, as the rendering is done in software instead, but the results are still better than I ever managed trying to run gnome-shell with VirtualBox's accelerated OpenGL support.
  • Mikel
    Mikel about 12 years
    OP wants to use Windows for gaming. Running Windows inside a VM may make it too slow.
  • Warren Young
    Warren Young about 12 years
    +1 because of VMware, which is an absolute pig on Windows. It has to install a whole lot of stuff that exists out of the box on Linux, just to get its job done. I've had it make a hash of my networking a few times, for instance, whereas that's never happened to me with any VM system on Linux. VirtualBox is closers to a 1:1 match between platforms, but due to the superior command line environment, I still prefer running it on Linux, since VBox is such a verbose command system.
  • Sinan Ünür
    Sinan Ünür about 12 years
    s/whit/with/g. whit means something else entirely.
  • Depado
    Depado about 12 years
    Just made a mistake, thanks for the knowledge you give me ^^ I really thought it was like an emulation. (Thanks again) @Piskvor: Yeah that's what I meant, resize it. (not native english, I missunderstood reformat and resize)
  • FooF
    FooF almost 12 years
    I had this issue too until I switched the kernel. Ubuntu at least comes with special kernel for running in virtual machine. The high resolution timer is the culprit for the CPU hogging, I believe, which is disabled in the special kernel versions. Now the CPU usage as reported by the host OS (Windows 7 at the moment) is comfortably low when idle.
  • Cetin Sert
    Cetin Sert over 11 years
    While disk I/O may be an issue for large files, I do remember consistently experiencing incredibly faster many number of small files type of IO operations in guest OSes. I thought this could be because these file IO operations perhaps never really touch the real hard drive (cached by VirtualBox/VMWare etc. in RAM temporarily and written asynchronously to the VMs harddrive image file causing no delays inside the VM) or touch only a single file / location of the hard drive (namely, the VM harddrive image file) instead of many small real files.
  • rubenvb
    rubenvb over 11 years
    "large compiles" actually still work faster in a VM than in Windows. This even for GCC on Linux vs MSVC on Windows.
  • Mikel
    Mikel over 11 years
    @rubenvb The comparison is bare metal Linux versus Linux in a VM.
  • Noah
    Noah over 9 years
    What do I need to google to figure out how to dual boot AND use the same ubuntu inside a VM in windows? If that is not too hard to do that would be PERFECT for my work situation.
  • ams
    ams over 9 years
    It's possible, but not straight-forward. The main problem is that all your device drivers and settings would be different in each case, so you'd probably need two sets of config files. In short, it'd be a real pain to maintain. I don't know what keywords to Google.
  • arleslie
    arleslie over 8 years
    Not much of an issue at all. Ubuntu has a very simple way of doing it called Wubi. If you don't want to repartition your hard drive, you can install a new hard drive and install Ubuntu on it. Normally GRUB (the bootloader) will have options for Windows also, but in some cases you may need to add it after installing Ubuntu.
  • ams
    ams over 8 years
    In any case, the answer already mentions Wubi, so what's your point?
  • arleslie
    arleslie over 8 years
    @ams Sorry, I must have been extremely tired when I originally read your answer. I missed the last two parts.... I need more sleep.
  • Kenneth K.
    Kenneth K. over 8 years
    This doesn't answer the question that was asked.
  • aeroNotAuto
    aeroNotAuto over 7 years
    @Noah are you looking for something like this? It's old (2009) but describes steps for a Windows/Linux dual-boot that starts a Linux virtual machine from inside Windows, and this virtual machine uses the 'same Linux' as the dual-boot. It directs to page 134 of the Virtual Box user manual and section 9.10 calls this raw hard disk access.
  • Muhammet Şancı
    Muhammet Şancı over 7 years
    I disagree on Stability. I always end up breaking my Linux, because I changed some configuration files, so I use Linux only in a VM. :-)
  • smci
    smci almost 7 years
    Well how often does it fail, if you're working in the Linux VM most of the time?
  • Ryu_hayabusa
    Ryu_hayabusa almost 7 years
    @Mikel "There should be almost zero performance hit for CPU intensive tasks"
  • Rolf
    Rolf about 5 years
    ^ This! People say "Windows can catch a virus" and "Linux is more stable" Truth is if you use Windows mainly as a host then you would not catch any viruses however with Linux there is a real chance of finding yourself in a world of pain due to driver shortcomings.