Friday, January 11, 2013

VirtualBox: Make your dualboot virtual

This is the first time I make a blogpost like this, but I just managed to pull off exactly what I wanted and because some guessing (both educated guessing and random guessing) was involved I decided to make a post so my experiences could help others in the future.

After I bought my computer, I partitioned off some space on my main disk (the SSD) and installed Ubuntu on it, making my computer a dual boot. However, I continued the tradition that had been standing for years by barely ever booting into it. Now that I wanted to finally start using linux more at home, one of the things I wanted to do was to virtualize both operating systems from the other. Virtualizing Ubuntu from Windows was up first.

Goal: Set up VirtualBox to let me boot the Ubuntu installation on my physical hard disk.
Host System: Windows 7
Client System: Ubuntu 12.04
Processor Manufacturer: AMD (yes, this sort of plays a role)
Special Info: The windows and linux partitions are on the same disk.

Of course, this may be helpful when using different systems, but you may encounter other problems as well as not encounter some of the problems I came across.

Credit where it's due: I scoured the internet for helpful information, but this was the most helpful resource by far: http://cargowire.net/articles/seamlessubuntuwindows

Note up front: sometimes you need to use sudo or su to get administrator access in Ubuntu. I'll leave this for yourself and not mention it in my guide.

Solution:

Done in the past: install Windows and Ubuntu as a dual boot system.

Step 1
We'll start of doing our linux work. In linux, we'll create a VMDK file that specifies the your HD to be used. As such, we install VirtualBox under linux and use the information from the manual to make an image that points to your physical partition with something like this:
-rawdisk /dev/sda -partitions 3 
Problem avoided: Windows doesn't give enough permissions for this command on any disk that is being accessed and you can't do anything about that if your OS is on the same disk.

Step 2.
We'll also need to make a boot disk image from linux. We're not going to need it till later, but to avoid unnecessary rebooting we'll do it already. For now we'll just copy the grub list from your Ubuntu installation. This goes like this:
mkdir iso
mkdir -p iso/boot/grub
cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
grub-mkrescue -o grub.iso iso
(note: grub-mkrescue complained about missing something. The key was just to take that name and install it with apt-get as it turned out that one of its dependencies was simply not marked as such by the installation package.)

Problem avoided: The virtual system as we're creating it will not be bootable, so we have created an external way to boot into it.

Next we're going to move to Windows (after a short stop in the bios) so the three created files (<name>.vdmk, <name>-pt.vdmk and grub.iso) need to be made available in Windows. I'll leave it up to you decide to do this.

Step 3.
We reboot into the bios. In the bios we turn on AMD Virtualization (AMD-V). This is an extension to the processor instruction set which allows moving the virtualization closer to the hardware.

Problem avoided: We're going to turn on an option that requires AMD-V later. To prevent rebooting all the time this was the best moment to do this.

Step 4.
We continue in windows. Here we place the files we made in linux in a place we like them to do (like %UserProfile%\VirtualBox VMs\ which is the folder VirtualBox will create/use for the VM). Note that we'll keep both VDMKs while the iso is just temporary, so if you want you keep can keep it in a less permanent location.
Next, we need to edit <name>.vdmk. Open it in your favorite text editor and find the line with something like this:
RW 39999488 FLAT "/dev/sda" 168148992
In Windows we refer to disks with a different vocabulary, so we need to change this to something like:
RW 39999488 FLAT "\\.\PhysicalDrive0" 168148992
Problem avoided: We created a linux compatible file for use in Windows, so we needed to turn it into a Windows compatible file. Luckily for us, all we need is such a trivial change.

Step 5.
It's time to make the VM. First we need to install VirtualBox. This needs to be done in Administrator mode, or else we might get denied access later on. So, run the installer as administrator. Don't ask me why they made it so that this was necessary, all I know is that it is. Secondly, we also need to run virtualbox as administrator. Once we're running, we can simply follow the wizard and create our VM and choose to use an existing HD, and then select <name>.vdmk.

Problem avoided: We avoided permission problems here. They show up rather randomly when not installing it as administrator. Running as an administrator usually isn't necessary, but it is here as otherwise Windows won't allow us to access the raw disk.

Step 6.
Open the VM's settings and go to Storage. Here we add a new disk. We create a new vdi of a static size of 10 MB. Make sure everything is connected on the IDE controller. The 10 MB disk should be the primary master, the vdmk we created the primary slave and the optical drive the secundary master.

Problem avoided: We ought to be able to install a bootloader on the disk we made (<name>.vdmk sets you up with <name>-pt.vdmk as the MBR, and all the partitions on the rest of the disk, only allowing access to the ones we specified in step 1)but for some reason grub2 doesn't play nice with this setup, so we created the other disk to install our bootloader on.

Problem avoided: I found that the vdmk we created only worked on an IDE controller, so we had to make sure it wasn't on a SATA-controller.

Problem avoided: We need to make sure that the disk we wanted to boot from is in the correct place in the boot order, and by making it the master and the raw disk the slave we did this. (We could have done this in other ways, but this is the way I chose.)

Step 7.
Still in the settings, go to System and then to Motherboard. There, make sure that IO APIC is used. This is what we needed AMD-V for (with this setting on, the VM can't start unless AMD-V is on).

Problem avoided: The fact that the setting mentions we can't turn it off after installing the OS is a good hint as to why we need it. Apparently this functionality is used during normal installation of OS. (Yes, I sort of randomly stumbled upon this solution myself...)

Step 8
Still in the settings go back to Storage and mount grub.iso. Now we can close settings and start the VM. It should start the bootloader from the cd. Then, it should start Ubuntu without any further problems. In Ubuntu we can now install grub to the 10 MB disk with something like this:
grub-install /dev/sda
You can now eject the cd and reboot the VM and start it autonomously. Then you might want to do some customizing to remove the Windows installation from the grub list.

Final note: I do believe that due to the way this works when you install something like a new kernel image which should run grub-install anew, this will only happen for the current way you are booted into the OS. I don't believe this could have been avoided by not making the boot hard disk and using the cd permanently, because then it would just mean that if booted into it through the VM it wouldn't update anything (that is used) at all. In the end, you will just have to update grub manually...

Saturday, December 15, 2012

Tv Series: The Game

Over a year ago, I wrote about the gamechanger. It was the first part of a series of posts of me explaining my views on tv series theory, which I came up with without any prior knowledge of existing theory. Today, I'm finally writing the second part of that series. To recap the previous installment, a gamechanger is when something happens in a tv series that changes it entirely. A good example would be how in the beginning of Voyager's season 4, Kes left and was replaced by Seven of Nine. Today, I am going to discuss another piece of theory I came up with.

The very existence of a gamechanger suggests that there is a game. The game is what I am going to talk about today. I should add that I don't completely know what the game looks like. However, I would like to share my current view of things.

Basically, the game is a collection of properties that hold for the entire series (or at least part of it, as we know that gamechangers may change the game). It is, in a way, the context in which episodes are written. It's the things we know about a series.

I don't exactly know what the game consists of just yet, but there will be a number of things. Examples of things that will likely be part of the game are the goal or drive and the obstacle. The goal of a show is what the characters are trying to achieve and thus what keeps the show moving. The obstacle is the thing that makes sure the characters don't simply achieve their goal and end the series.

One thing I am pretty sure of is part of the game is the group of characters, from recurring upwards. I'll call them the "Family" and I'll leave the discussion of the family for my next topic on tv series theory.

It is an important thing to be noted that the game can change without a gamechanger. As mentioned in the gamechanger piece, there are also gradual changes. However, a change that is in fact minor, isn't a gamechanger either, even when it is sudden. An example would be when a recurring is introduced, which changes the family and thus the game, but may have so little influence on the show that it can't be called a gamechanger.

That's it for today. See you around!

Tuesday, November 27, 2012

The Copyright Debate

Today, I read up for a bit on how the case of MegaUpload was going. As it turns out, they are working on a new service to be released a year after MegaUpload being taken offline. The few details disclosed about the new service are a good example of one of the points in the copyright debate. It inspired me to do a piece on the whole debate.

Basically, the copyright debate takes place in two areas. There's the practical area and the ideological one. I'll start with the practical part because, well, it's more practical.

The whole piracy play is a cat and mouse game. Once a certain way of piracy gets closed down, piracy evolves to its next form that isn't blocked. This effect can be seen when looking at the history of file sharing, like when you look at the stories of Napster and Kazaa.
However, it can also be seen in more recent developments. When The Pirate Bay was facing legal consequences in a number of countries, it started adopting a new technique (magnet links) through which the legal processes against them would become invalid. When you release a new sophisticated form of DRM, it may take a couple of days longer before it has been cracked. And now there's the new mega site is planning to use a technique that makes them unaware of the content of what is uploaded to them, making sure they can't be held responsible for ignoring illegal content on their network. Basically, the copyright industry will never be able to catch up with the pirates.

The proponents of the copyright system as it is right now are eager to come up with a way to more fundamentally tackle the problem. That's basically what the proposals like SOPA and PIPA were all about. They were meant to give more powerful tools to the copyright owners to shut down piracy and also defined piracy in terms very loose as to also encapsulate future forms.
However, there are some serious problems with it. The problems specific to systems mentioned above is that they put amazing amounts of power into the hands of the copyright owners, had systems in which the mere allegation of copyright infringement would be punished very harshly without substantial evidence or the possibility of a defense and finally that it held websites fully responsible for anything posted by users, meaning that it would have become impossible to have user contributions that aren't all moderated by hand before publicizing them.

However, there is a more substantial problem with the whole idea of tackling the copyright defense in any fundamental way that circumvents the whole cat and mouse game. Basically, it's about how bits and bytes don't have a meaning all by them selves. This is what the new mega site is such a good example of. Basically, what it does is that you will create a key and encrypt the data you upload to them with it. As such, the data stored by Mega does not have a meaning without the key. Neither does the key have a meaning without the data. However, a user receiving the key and the data through separate channels will be able to decrypt the data and assign a meaning to it again. In this example, never did any one service ever share copyrighted data and yet the data came from one person and ended up at another person.

This is basically the big problem. The lesser version of this problem is that you would have to inspect everything a user does - like reading personal mails - in order to make sure he doesn't send copyrighted materials. And the bigger version is that even then you can never reliably check what is copyrighted material and what is not as shown with the Mega system. The only thing one could do is put systems in place that invade our privacy by checking everything we do and at the same time taking down any websites that might facilitate piracy, which is nothing short of a full-fledged censorship system.

If there are so many practical problems with copyright then you might wonder why it is defended so doggedly. And that's when you come to the ideological part of the debate. Often copyright is taken for granted, but in fact it's very much a artificial construct. Something made by man that should not be taken at face value but instead carefully inspected for its advantages and disadvantages.

Looking at the history of copyright we'll actually see that it is an ancient system created in England centuries ago and having undergone many revisions since. What also springs out is that from the very start it was mostly used to the profit of not those who made the copyrighted material but those who distributed it. That's also who currently profit from it right now, the big music and video companies. The fact that those companies have insane amounts of money is not only a testimony to the unnatural distribution of money the copyright laws cause, but also something that greatly eschews the entire debate, as much of it is fought in courtrooms and through lobbying.


When we look at the arguments against the current copyright system you'll quickly stumble upon the one about shoulders of giants. We stand on those shoulders when doing just about anything. When the field of physics is advanced through new theories, for example, we build upon what previous physicists have done, perhaps most notably Newton and Einstein. This goes for the creation of culture as well. For example, story telling is just about never done without drawing inspiration from other works. Oftentimes, authors state their sources of inspiration or their "influences". Other times, trhe story is even stated to be a retelling of another story. Notable examples include the way the Grimm brothers became the authority on folk tales by publishing them and the Walt Disney becoming big by making films out of fairy tales. Copyright is a construct that limits us in basing our work off of other works and thus can be said to have a negative effect on the development of our cultural heritage.

We have to look a little harder to find the arguments defending the copyright system. This is because it is so often taken for granted and the battle is often fought through implications rather than arguments. There's always the ads we have been given over the past decade or so that say piracy is equal to stealing, but there isn't any argument to be found in that. This is because these ads do not try to substantiate that claim in any way and instead work by trying to instill a sense of right and wrong in people based on emotional value. On top of that, this argument usually completely skips the distinction between software and a car, which is the same as the reason why one is shared through piracy and the other isn't: software can be copied with barely any cost to it, while a car can't be.

The one argument that does sometimes come up is what we stand to lose by abolishing copyright. And there is most definitely some truth to this. There is little doubt about it that some artists would disappear in a world without copyright. However, this can be countered by the sentiment that music or art or writing as a whole won't and other artists that won't show up on people's radars in the current system would be able to flourish in a copyrightless system. In fact, the way some artists are already coping with the fact that piracy is so common these days proves that there are profitable models for - for example - making music in a world without copyright.
Once again, there is no doubt that the current situation would change radically. One example I think it often left out of this debate is the one of single player computer games. It's pretty clear that the landscape of single player games would radically change if there wasn't copyright to protect it. Big companies making lots of money off games created by large teams define what is possible in those realms and those seem likely to be hurt the worst by such a change. The argument goes, though, that we shouldn't judge the current system to be better than the one that we would end up with if copyright is abolished.
The things that we know up front are that the fields where copyright currently exists wouldn't disappear if there no longer were such a thing as copyright and that it is quite probable that distributors won't be making quite as much money. Unless you are in the distribution business, neither of those sounds like a bad thing.

That's the copyright discussion as far as I know it. I have tried to give a good and objective perspective on this all, but I have probably failed considerable since I am a human and I do have an opinion on the matter. I also might be unaware of some of the arguments in this discussion. However, I do think it's a decent overview, even if a bit tainted by my personal view of the matter.

Tuesday, August 21, 2012

The Internet Generation

Every title has its stories. The most important story is often the one that follows it, but for this one I also want to give the hi-story. (Sorry for the bad pun.)

This title started off as a comment on facebook. It was formatted for that medium (it had only a single capital letter, and it had a smiley trailing it). I meant it as a funny comment relating to the fact that someone had made a note about having (better) internet access, but it also got me thinking. And that thinking is what this blogpost stems from. As such, it's going to be the more serious discussion of the title.

So.. the internet generation. It's the generation I believe I am a part of. It's the generation that grew up with the internet. Well, that's not entirely true. There may be many more generations (it depends a bit on how long the internet is going to live (which is looking like a very long time right now) and what direction the internet is going to take from where it is now), but I still believe that we are the internet generation. That's because we are the first generation that grew up with the internet.

Defining a generation is never an exact science and even the question "how old can you be while still having grown up with the internet" can lead to many different answers. Nevertheless, there is clearly one thing that defines a generation: the differences between it and the generation that went before it. That's why I say the first generation that grew up with the internet is the internet generation.
(And perhaps it should be interpreted as "the people who grew up with the internet while their parents did not".)

Of course there is more to it than just that. We are also the first to massively adopt things like wikipedia, despite the early claims of it not being very factual. We are also a generation of which the larger part is on facebook. (Well, in the West anyway, but I suppose we were talking about the West anyway.) We are also the first generation to have gotten used to having the internet in our pocket through our smartphones. And we are also the generation that hates not to have the internet at our finger tops (or even just a little less at our fingertops than usual).

There is a number of properties we can ascribe to our generation (again, compared to the previous generations, future generations may well follow in our footsteps in a number of those). One of the most interesting of those properties - in my eyes anyway - would be how we handle information. We are very good scanning and picking out the useful bits of information, as we do whenever we arrive on a website. We are also very good at separating what we are looking for from distractions (well, some anyway) as we read completely around advertisement (the ones that aren't annoying anyway) and barely even notice they are there. And like no other, we can look at a summary like the ones on Google and decide if this is what we are looking for or not.

Another property would be how we handle multitasking. I don't exactly know how much better humans are at "actual multitasking" (doing different things at exactly the same time), but wouldn't be surprised if we aren't able to do that or do it much. However, there is still the fact where fact that we can do different things at the same time by actually just switching between them quickly, which I think we as a generation are pretty good at (and which computers are way better at, even). However, I that's not where we make the big difference in my opinion. The real difference is how we can switch between things consciously almost effortlessly. Tabbed browsing is a good example of this, and not being able to do multiple things at the same thing easily makes us feel restricted.
(And to make a circle out of my whole story again, that's also one of the things the post I responded to on Facebook was about).

If you got this far, I hope you enjoyed my rambling!