Thursday, July 30, 2009

Fedora on MS Virtual PC 2007

Finally got a good load of Fedora running in MS Virtual PC 2007, on my Vista laptop. ended up with Fedora 9, simply because it was the most recent 32 bit version on had on my server. I load 32 rather than 64 bit, because HP was so rude as put 32 bit Vista on a 64 bit laptop. Theoretically, the AMD Turion64 X2 should be able to run a 64 bit guest in a 32 bit host OS, but we'll try that later.

A good reference for loading Fedora in VPC2007 can be found on Sean Earp's Blog. He suggested using a Grub option of noreplace-paravirt, which I didn't need. The options that I needed for Fedora 9 were:
clocksource=pit noapic vga=0x700
The vga= directive was a fun one. A value of 0x700 doesn't actually work. Instead, it kicks you to a text based menu that lets you select the mode at boot time. This will let me experiment, until I find the one I like. So far, I'm favoring 0x303.

Next step is to move the image to a USB key.

Wednesday, July 29, 2009

rPath Cloud Computing Video

I've been spending allot of time lately telling people at work not to talk about cloud computing while all the time focusing on it myself. (Don't tell them.) I found this video by rPath. Very informative and well done.

Newservers.com, Pt 3

The Windows guy is going to be jealous. Yesterday, I saved an image on the "small" server I set up at Newservers.com, then canceled the server. Today, I allocated an different model server, and applied the image. It worked. He suspected it would fail due to drivers. Ha!

An important detail I had misunderstood about their billing: You are billed while the server is allocated, not powered on. To check this, last evening, I issued a poweroff command just before starting the hour long walk, subway, bus, and car ride home. When I got home, I checked the invoice, and, just as expected, it had incremented another $.11. Once I did a Canceled Server, the billing stopped.

And that makes sense: If you have data on the drive, but power off the server, you are still costing them money. Once you de-allocate, they can hand it off to someone else.

As a side note, I found a couple other services to disable: lvm-monitor (they build everything in root) and hidd.

Tuesday, July 28, 2009

Newservers.com, Pt 2

In response to a comment, I wanted to take a moment to wax philosophic on the concept of the Infrastructure as a Service (IaaS) business model.

I have a silly little website, dougbunger.com, that is hosted on a virtual machine... Xen, of course. The VM does a few other small functions, but represents Platform as a Service (PaaS). To me, the physical machine is irrelevant, as long as I get a Linux platform.

From a business standpoint, the provider (VPSlink.com) is paying for the hardware, rack space, power, and telecom. These are fixed costs for a system with fixed resources. As long as his pricing is such that at 30% resource utilization, he is covering his fixed costs, then any VMs over 30% are profit. The main thing to remember is that after a stable customer base of >30% is achieved, when an "extra" VM disappears, it costs nothing. Effectively, the top 50% of the server is free.

(Yes, I'm 10% short, but when that box is at 90%, its time to worry... You don't want to degrade the "good" customer's VMs.)

Now lets consider the Newservers.com model. In this case imagine ten machines all with the same fixed cost. When a physical server is allocated to a customer, you are offsetting the fixed cost of the server. When it is not allocated, you are "loosing money". Yet, we can never allow the server farm to reach even 80% capacity, since the core of our business model is spare capacity. No capacity, no elasticity, as Amazon might say. This means that we always need two machines empty, and as such "loosing money".

To further complicate things, with VMs, we can always cross that 90% mark. We can let some customers be degraded to get us over a surge. With physicals, however, there is no way to sell eleven boxes, if all we have is ten.

In the end, the whole thing boils down to good capacity planning and accounting. My hope is that as the pricing models mature, we'll see more of the IaaS clouds. As for Newservers.com, they've already saved me the cost of an HP DL380 G5 that I need for the next 60 days.

BTW: Thanks for the comment!

My $0.11 Computer: Newservers.com

Just for fun (and professional development) I leased a server from a company called Newservers.com that market themselves as a "bare metal cloud". Within 15 minutes, I had an account on a physical Dell 1955 machine running Linux. The funky part, is that they claim they only charge $0.11 per hour while the box is powered on. Oddly, this does not seem to be a VM. Here's what we got:
[root@server1868 ~]# cat /etc/redhat-release
CentOS release 5.3 (Final)
[root@server1868 ~]# head -1 /proc/meminfo
MemTotal: 1026612 kB
[root@server1868 ~]# grep "model name" /proc/cpuinfo
model name : Intel(R) Xeon(TM) CPU 2.80GHz
[root@server ~]# fdisk -l

Disk /dev/sda: 36.4 GB, 36420075008 bytes
255 heads, 63 sectors/track, 4427 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 3824 30716248+ 83 Linux
/dev/sda2 3825 4085 2096482+ 82 Linux swap / Solaris
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 1.7G 26G 7% /
tmpfs 502M 0 502M 0% /dev/shm

It's a little bloated. Let's lighten the load:
[root@server rc3.d]# for J in kudzu portmap nfslock mdmonitor rpcidmapd rpcgssd bluetooth netfs pcscd autofs yum-cron cups gpm anacron atd yum-updatesd ; do chkconfig $J off; done

And start to secure this puppy:
[root@server ~]# sed -i "s/=disabled/=permissive/" /etc/sysconfig/selinux
[root@server ~]# touch /.autorelabel
[root@server ~]# vi /etc/hosts.deny     # ALL : ALL
[root@server ~]# vi /etc/hosts.allow     # sshd : safe.location
[root@server ~]# vi /etc/ssh/sshd_config     # PermitRootLogin no
[root@server ~]# useradd blah blah blah -G wheel     # unpriv user in wheel group
[root@server ~]# passwd yada yada yada     # strong password
[root@server ~]# visudo     # enable wheel

Cool. Now lets see where this takes us.

Friday, July 24, 2009

Converting a Xen Paravirt VM to Fullvirt

We had a VM that would occasionally try to load the wrong kernel at boot time. The machine has to load the para-virt ELxen kernel to successfully start, but it might try to load a PAE instead. As a result the VM would fail to boot.

It might seem that the solution would be to fix why it was loading the wrong kernel, but, for reasons we will not discuss at the moment, we needed to accept that it would load the wrong kernel occasionally. So, our mission became to move the VM from para-virt to full-virt. As it turns out, it was just a case of modifying the VM config file.

Comparing the two configs, we see some differences:
diff vm-para vm-full
< bootloader='/usr/bin/pygrub'
< vfb=['type=vnc,vncunused=1,keymap=en-us']
---
> builder = "hvm"
> kernel = "/usr/lib/xen/boot/hvmloader"
> boot = "c"
> pae = 1
> acpi = 1
> apic = 1
> localtime = 0
> device_model = "/usr/lib64/xen/bin/qemu-dm"
> sdl = 0
> vnc = 1
> vncunused = 1
> keymap = "en-us"
This tells us that the para-virt VM uses a different Grub and that it needs a set of variables to describe its connections to the outside world. The full-virt VM, has a much wider set of variables, and uses a different boot mechanism.

So, how do we convert?
1. With VM running, install a standard kernel, using rpm -ivh
    or yum install kernel.
2. Power off VM.
3. Edit config file, removing the two line specified by "<" above.
4. Add the lines specified by ">" above. Make sure to remove the leading greater-than (>) symbols!
5. Start VM.

Sunday, July 19, 2009

RDP on Vista Premium

I used Fransblog's termserv patch to enable RDP on my Vista Home Premium VM. Worked perfectly the first time. Thanks Frans!

Saturday, July 18, 2009

Fedora On Virtual PC 2007

While trying to install Fedora on Virtual PC 2007 running on my Vista Home Premium laptop, I was plagued by boot hangs. Usually, the CD would fail to boot on:
running /sbin/loader
It seems the way around this was to add a directive to the installer:
clocksource=pit
I'm going to blame this on my AMD Turion64 CPU, as few others had come across the same problem.

The problem that had gotten everyone else was the graphics levels between Linux and VPC are not compatible. The solution to that was to add:
vesa
This forced Linux into a 16 bit color mode. Once the install was complete, both options needed to be added to GRUB.

The next problem was the network. I had to attach the VM's network to the physical interface on the laptop. I had expected to be able to use a NAT interface, but I suspect this was my own fault for using my network install server rather than an DVD image.

Alas, my first successful install was Fedora Core 4, but when it booted up, I could not login. The clocksource was running so fast, PAM timed out the username and password within a matter of seconds. In all fairness, FC4 is eons old. I found a 32 bit DVD ISO for FC6 and F9 on my install server, so I'll give them a shot and see if they run any better.

Windows Virtual PC 2007

After building a Vista VM today, I needed a downloadable copy of SP1. That's when I stumbled upon Windows Virtual PC 2007. I knew of its existence, but must admit, I didn't realize it was free. Another thing about it astonished me:
Virtual PC 2007 runs on: Windows Vista™ Business; Windows Vista™ Enterprise; Windows Vista™ Ultimate...
Oh there were others, but no Vista Home or Home Premium. I guess I need to fork out a couple hundred dollars to upgrade.

Or, I could fire it up and see what happens. I grabbed the installer, launched it on my Home Premium laptop, and sure enough, it complained that it was not supported. It seems however, that "unsupported" does not mean "not allowed" I chose to continue, and the install finished.

I launched the program, and it immediately complained again. Yet... There is a checkbox: "Don't show this message again" Next thing you know, I'm in an installation wizard.

Now we get to find out what this thing will do. I launched the wizard to install a Fedora instance. When presented with the Operating System choices, I found the following list:
Windows 98
Windows NT
Windows 2000
Windows XP
OS/2
Windows Vista
Windows NT Server
Windows 2000 Server
Windows Server 2004
What! OS/2? You're kidding, right? I think I threw those disks away about 10 years ago. And what about Linux, damn you.
Other
Okay.

In the short wizard, I allocated 312 meg of RAM and 8 gig of disk. The VM appeared in the Virtual PC Console window, and I selected Start. Once the VM launched, I was able to click the CD menu item and select "Use Physical Drive", but it was already too late in the POST. I clicked the Action menu item, and selected "Reset". This time it launched the installer from CD.

Now, we get to see if it will install.

Vista /etc/hosts File

As we all know, each iteration of Windows gets more like Linux, and Vista is the most Linux-like so far... Except for the fact that it sucks, but then Microsoft does have to differentiate their product somehow.

Take for instance the /etc/hosts file. In Vista, it is at:
Local Disk (C:)
  Windows
    System32 (Syswow64)
      Drivers
        etc
          hosts
Unfortunately, you can't edit the file. You're not allowed... its not your OS, so you can't edit it. Its Microsoft's OS.

But we got a hack for that.

Click Start (even though it doesn't say "Start" any more.) In the Start Search box, type "command". Right click the displayed icon and select Run as administrator. This will give you a command prompt. Yeah-- just like Linux. Execute:
cd c:\windows\system32\drivers\etc
notepad hosts
Add the needed entries, save, close, then exit to discard the command prompt.