miscellaneous - GreenAsh Poignant wit and hippie ramblings that are pertinent to miscellaneous https://greenash.net.au/thoughts/topics/miscellaneous/ 2016-02-01T00:00:00Z Running a real Windows install in VirtualBox on Linux 2016-02-01T00:00:00Z 2016-02-01T00:00:00Z Jaza https://greenash.net.au/thoughts/2016/02/running-a-real-windows-install-in-virtualbox-on-linux/ Having a complete Windows (or Mac) desktop running within Linux has been possible for some time now, thanks to the wonders of Virtual Machine (VM) technology. However, the typical approach is to mount and boot a VM image, where the guest OS and hard disk are just files on the host filesystem. In this case, the guest OS can't be natively booted and run, because it doesn't occupy its own disk or partition on the physical hardware, and therefore it can't be picked up by the BIOS / boot manager.

I've been installing Windows and Linux on the same machine, in a dual-boot setup, for many years now. In this case, I boot natively into either one or the other of the installed OSes. However, I haven't run one "real" OS (i.e. an OS that's installed on a physical disk or partition) inside the other via a VM. At least, not until now.

At my new job this year, I discovered that it's possible to do such a thing, using a feature of VirtualBox called "Raw Disk Access". With surprisingly few hiccups, I got this running with Linux Mint 17.3 as the host, and with Windows 8.1 as the guest. Each OS is installed on a separate physical hard disk. I run Windows inside the VM most of the time, but I can still boot natively into the very same install of Windows at any time, if necessary.

Instructions

  1. This should go without saying, but please back up all your data before proceeding. What I'm explaining here is dangerous, and if anything goes wrong, you are likely to lose data on your PC.
  2. If installing the two OSes on the same physical disk, then wipe the disk and create partitions for each OS as necessary (as is standard for dual-boot installs). (You can also shrink an existing Windows partition and then create the Linux partitions with the resulting free space, but this is more dangerous). If installing on different physical disks, then just keep reading.
  3. Install Windows on its respective disk or partition (if it's not installed already, e.g. included with a home PC, SOE configured copy on a corporate PC). Windows should boot by default.
  4. Go into your PC's BIOS setup (e.g. by pressing F12 when booting up), and ensure that "Secure Boot" and "Fast Boot" are disabled (if present), and ensure that "Launch CSM" / "Launch PXE OpROM" (or similar) are enabled (if present).
  5. Install your preferred flavour of Linux on the other disk or partition. After doing this, GRUB should boot on startup, and it should let you choose to load Windows or Linux.
  6. Install VirtualBox on Debian-based systems (e.g. Mint, Ubuntu) with:
    sudo apt-get install virtualbox
    sudo apt-get install virtualbox-dkms
    
  7. Use a tool such as fdisk or parted to determine the partitions that the VM will need to access. In my case, for my Windows disk, it was partitions 1 (boot / EFI), 4 (recovery), and 5 (OS / "C drive").
    1. Partition table of my Windows disk as shown in GParted.
      Partition table of my Windows disk as shown in GParted.

      1. Use this command (with your own filename / disk / partitions specified) to create the "raw disk", which is effectively a file that acts as a pointer to a disk / partition on which an OS is installed:
        sudo VBoxManage internalcommands createrawvmdk \
        -filename "/path/to/win8.vmdk" -rawdisk /dev/sda \
        -partitions 1,4,5
        
      2. Create a new VM in the VirtualBox GUI, with the OS and version that correspond to your install of Windows. In the "Storage" settings for the VM, add a hard disk (when prompted, click "Choose existing disk"), and point it to the .vmdk file that you created.
        1. VirtualBox treats the
          VirtualBox treats the "raw" .vmdk file as if it were a virtual disk contained in a file.

          1. Start up your VM. You should see the same desktop that you have when you boot Windows natively!
          2. Install VirtualBox Guest Additions as you would for a normal Windows VM, in order to get the usual VM bells and whistles (i.e. resizable window, mouse / clipboard integration, etc).
          3. After you've been running your "real" Windows in the VM for a while, it will ask you to "Activate Windows". It will do this even if your Windows install is already activated when running natively. This is because Windows sees itself running within the VM, and sees "different hardware" (i.e. it thinks it's been installed on a second physical machine). You will have to activate Windows a second time within the VM (e.g. using a corporate bulk license key, by calling Microsoft, etc).

          Done

          That's all there is to it. I should acknowledge that this guide is based on various other guides with similar instructions. Most online sources seem to very strongly warn that running Windows in this way is dangerous and can corrupt your system. Personally, I've now been running "raw" Windows in a VM like this every day for several weeks, with no major issues. The VM does crash sometimes (once every few days for me), as VMs do, and as Windows does. But nothing more serious than that.

          I guess I should also warn readers of the potential dangers of this setup. It worked for me, but YMMV. I've also heard rumour that on Windows 8 and higher, the problems of Windows not being able to adapt itself to boot on "different hardware" each startup (the real physical hardware, vs the hardware presented by VirtualBox) are much less than they used to be. Certainly doesn't seem to be an issue for me.

          At any rate, I'm now happy; at least, as happy as someone who runs Windows in a VM all day can physically be. Hey, at least it's Linux outside that box on my screen. Good luck in having your cake and eating it, too.

]]>
Why junk collecting is good 2005-01-21T00:00:00Z 2005-01-21T00:00:00Z Jaza https://greenash.net.au/thoughts/2005/01/why-junk-collecting-is-good/ Everyone collects something that's a little weird. Sport fanatics collect footy jerseys and signed cricket bats. Internet junkies collect MP3s and ripped DVDs. Nature lovers collect pets and plants. People with too much money collect Ferraris and yachts and tropical islands. People who can't think of anything else to collect go for stamps.

Personally, I collect tickets. I absolutely love collecting every ticket that I (or my friends or family or acquaintances) can get my hands on. It started off as just train tickets, but over the years my collection has grown to include movie tickets, bus tickets, plane tickets, ski tickets, theme park tickets, concert tickets, and many more.

When I see my friends after not having seen them for a while, I am greeted not with a handshake or a hug, but with a formidable pile of tickets that they've saved up for me. When my wallet gets too full with them, I empty them out and add them to the ever-burgeoning box in my room. I even received several thousand train tickets for my birthday last year. Basically, I am a ticket whore. No matter how many of the ruddy things I get, my thirst for more can never be quenched.

The obvious question that has confronted me many times: why? Why oh why, of all things, do I collect tickets? I mean, it's not like I do anything with them - they just sit in my room in a big box, and collect dust! What's the point? Do I plan to ever use these tickets to contribute to the global good of humanity? Am I hoping that in 5000 year's time, they'll be vintage collector's items, and my great-x104-grandchildren will be able to sell them and become millionaires? Am I waiting until I have enough that if I chucked them in a big bucket of water and swirled them around, I'd have enough recycled paper to last me for the rest of my life? WHY?

The answer to this is the same as the answer to why most people collect weird junk: why not? No, at the moment I don't have any momentous plans for my beloved tickets. I just continue to mindlessly collect them, as I have done for so long already. But does there have to be a reason, a point, a great guiding light for everything we do in life? If you ask me, it's enough to just say: "I've done it for this long, a bit more couldn't hurt". Of course, this philosophy applies strictly to innocent things such as ticket-collecting: please do not take this to imply in any way that I condone serial killing / acts of terrorism / etc etc, under the same umbrella. But for many other weird junk-collecting hobbies (e.g. sand grain collecting, rusty ex-electronic-component collecting, leaf collecting - and no, I don't collect any of these! ... yet :-)), the same why not principle can and should be applied.

So yes, ticket collecting is pointless, and despite that - no, because of that - I will continue to engage in it for as long as I so fancy. No need to spurt out any philosophical mumbo-jumbo about how I'm making a comment on nihilism or chaos theory or the senselessness of life or any of that, because I'm not. I just like collecting tickets! Plans for the future? I will definitely count them one day... should be a riveting project. I may take up the suggestion I was given once, about stapling them all together to make the world's longest continuous string of tickets. Yeah, Guinness Book of Records would be good. But then again, I might do nothing with them. After all, there's just so many of them!

]]>