Android development on Ubuntu 12.10 64-bit

Yes, like many people I have a 64 bit Ubuntu 12.10 and I wanted to get my Android eclipse development environment running. Everything I read (mostly the android developers guide) said install ia32-libs. Well I didn’t want to install all that baggage.

So… the minimum i’ve needed to install so far is :

sudo apt-get install eclipse libgl1-mesa-dev:i386 libsdl1.2debian:i386 libncurses5:i386

and the associate dependencies they drag on – it’s a bit, but nowhere near as much as ia32-libs.

It’s working so far, only time will tell what else I need to install.

Let me know if you’ve tried similar and i’m doomed to install ia32-libs anyway 😉

It’s also very nice to note that Ubuntu 12.10 comes with a suitable eclipse in the standard repositories so there’s no need to download from eclipse and install manually.

Removing non-present devices from Windows 2008

I had a W2K8 vm where I was adding / removing NICs like they were going out of fashion. As a result by the end of it I had a mess of non-present devices.

So how do you fix that mess?

I found (or more accurately was advised) that I can start a command prompt and

SET DEVMGR_SHOW_NONPRESENT_DEVICES=1
devmgmt.msc

Click on the ‘view’ / ‘Show Hidden devices’

Hey presto, there the were.

Then it’s just a case of right-click on the devices you no longer want and select uninstall.

End result is nice and neat.

Minimal Centos 6 build

I was in need of creating a minimal Centos6 system, here’s how I did it in case anyone else is interested.

kickstart for minimal Centos 6 install.   Hit tab at the boot screen

In this case as my environment doesn’t have a dhcp server I pass the ip of the new machine as a kernel option such that the request for the kickstart file will work,

Here is the kickstart file that I used.

install

text

lang en_US

keyboard us

bootloader –location=mbr –append=”crashkernel=auto rhgb vga=791 quiet”

zerombr yes

clearpart –all –initlabel –drives=vda

ignoredisk –only-use=vda

part /boot –fstype ext3 –size=512 –ondisk=vda

part pv.6 –size=8000 –grow –ondisk=vda

volgroup vgsys0 –pesize=32768 pv.6

logvol / –fstype ext3 –name=root –vgname=vgsys0 –size=1000

logvol /usr –fstype ext4 –name=lvusr –vgname=vgsys0 –size=2000

logvol /var –fstype ext4 –name=lvvar –vgname=vgsys0 –size=1000

logvol /opt –fstype ext4 –name=lvopt –vgname=vgsys0 –size=500

logvol /home –fstype ext4 –name=lvhome –vgname=vgsys0 –size=100

logvol /srv –fstype ext4 –name=lvsrv –vgname=vgsys0 –size=1000

logvol swap –fstype swap –name=lvswap –vgname=vgsys0 –size=1000

timezone Australia/Melbourne

authconfig –enableshadow –passalgo=sha512

selinux –permissive

firewall –service=ssh –service=smtp –port=143:tcp,80:tcp,443:tcp

rootpw  –iscrypted $1$ZV4gC5MB@IvTI#j5jK2BFt/j1cnZiP0

network –bootproto static –ip 10.100.0.252 –netmask 255.255.255.0 –gateway 10.100.0.1 –nameserver 10.100.0.1 –hostname pxe.example.com

reboot –eject

%packages –nobase

@core

@server-policy

wget

%end

 %post –log=/root/ks.log

cd /root

wget http://10.100.0.01/postks.sh

bash postks.sh

Only 204 packages installed 🙂

vCenter Server on your AD Domain Controller?

Ok, so it’s not the most clever thing you can do, but in a lab situation you may not simply have the machines or licences to go around.

vmware tends to agree – the vCenter server itself wont normally install on a system where AD is running.

This product can only be installed on the following 64-bit operating systems:
Windows XP SP2 or above
Windows 2003
Windows 2008

The secret is to get vCenter to use different ports for its ADAM instance.

As I prefer scripting to clickity-click you can put in a default vCenter server build (with different LDAP ports) using

start-process -wait -filepath z:\vpx\VMware-vcserver.exe -argumentlist '/q /s /w /L1033 /v" /qr DB_SERVER_TYPE=Bundled FORMAT_DB=1 VCS_ADAM_LDAP_PORT=3899 VCS_ADAM_SSL_PORT=6369"'

You should install vCenter Server before promoting to AD. Once it’s done you can run dcpromo.exe to set up the AD.

Note: You wont be able to re-install the vCenter server though so the usefulness to you may vary. That’s right, this is not a recommended production deployment 😉

If you know what everything above is doing – great. If you don’t, then assume it will eat your children.

Storage vMotion only one harddisk via powershell

This is more a reminder to me 🙂


Get-HardDisk -vm vm | Where {$_.Name -eq "Hard disk 1"} |
% {Set-HardDisk -HardDisk $_ -Datastore "" -Confirm:$false}

But the summary is that it svMotions 1 hard disk out of a VM onto a different datastore – useful is you have multiple tiers and want say OS disk on one tier and low access data volumes on other storage tiers.

SMEP and KVM – sounds interesting

Recently a patch was dropped into the KVM community – adding support for the Intel SMEP cpu feature (if available on the CPU). I thought to myself, what the hell is SMEP?

According to the Intel Software Developers Manual it is “Supervisor-Mode Execution Prevention” – this sounds like a great thing as the kernel is prevented from executing ‘user data’ in kernel mode – ie. If there is an exploit that delivers a page of data and asks the kernel to execute it then this wont happen and a fault will be triggered. This sounds like a neat piece of work and as it’s all h/w based then there should be little overhead.

Like me, i’m guessing you’re wondering if your system has the SMEP cpu feature then this code will show you. Don’t be disappointed if your cpu doesn’t have it – it’s a very new feature and I can’t even find what cpu’s implement it.

Anyway, it’s a step in the right direction and that future direction will hopefully allow hypervisors to be that little bit more secure from un-trusted VM’s and provide a VM ‘shell’ environment that’s a little more secure for the VM’s. Unfortunately the way things currently stand the usefulness for KVM is unlikely to be immediately realised as intel engineers suggest enabling SMEP without a guest vm’s knowledge is likely to be ‘problematic’.

Automated VCenter install (lab)

I’m trying to keep my home lab pretty automated. One of the things i’m always (well occasionally 🙂 )trying out is new vCenter installs. In order to speed things up I have the following little powershell script to remove the vCenter Server application and the vCenter Client prior to automatically re-installing them.

This script below uses defaults for the install. It’s possible to completely script the install which is useful if you have a corporate standard configuration. All the details can be found here.

Anyway, here is the script – i’ve called it the totally imaginative name of resetvc.ps1 – don’t run it in your production environment unless you know what you’re doing

(get-wmiobject -computername . -class Win32_Product -Filter "NAME='VMware vCenter Server'" ).Uninstall()
(get-wmiobject -computername . -class Win32_Product -Filter "NAME='VMware vSphere Client 4.1'" ).Uninstall()
start-process -wait -filepath z:\vpx\VMware-vcserver.exe -argumentlist '/q /s /w /L1033 /v" /qr DB_SERVER_TYPE=Bundled FORMAT_DB=1"'
start-process -wait -filepath z:\vpx\VMware-viclient.exe -argumentlist '/q /s /w /L1033 /v" /qr INSTALL_VIUPDATE=1"'

Notes: First 2 lines uninstall the vCenter Server and the vSphere Client – just ignore the error messages if this is the first time you’ve installed the vCenter Server etc. The third line installs the vcenter server from the iso which for me is my z:. Lucky last, the vSphere Client is installed – including in this case the Host Update utility.

Administering vSphere using Perl – Introducing VSPP

Yes, I know you can use the vSphere Perl SDK and it’s ‘OK’ , however, as I wanted to a) learn more perl and b) learn more about the vSphere SDK I started playing with the idea of creating an abstraction layer on top of the vSphere perl SDK that provided perl functions similar in operation to the PowerCLI cmdlets available.

Why?  Well there is a) and b) above, but additionally there is c) because I can 🙂

I figured some of the code might be interesting to some so I created a project over at sourceforge.net and i’m making the code available for anyone who wants it –  if no one does then that is OK as well.

The project is called VSPP (vsphere power perl) , yes you can tell I don’t work in marketing!  You can find the code via subversion at sourceforge.   It’s still pretty crude, no installable packages yet (or maybe ever).

Here’s an example piece of code (also in the svn repos) that Displays all the Hosts in a Datacenter using the VSPP api.

#!/usr/bin/perl -w

# DisplayHostsDatacenter: Display all the hosts in a specific datacenter
#
use strict;
use warnings;

use vspp;

my %opts = (
Datacenter => {
type => "=s",
help => "Datacenter name to display hosts for",
required => 1}
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate();

my $dcname=Opts::get_option('Datacenter');

Util::connect();

my $dc = vspp::GetDatacenter( Name => $dcname ) ;
my $hosts = vspp::GetVMHost( Location => $dc );
print "Datacenter $dcname has " . scalar(@$hosts) . " hosts \nThey are :\n";
foreach (@$hosts) {
print $_->name . "\n";
}

Util::disconnect();

And the output looks like this :

> ./DisplayHostsDatacenter.pl --server  vc1.example.com --Datacenter HomeDC
Datacenter HomeDC has 5 hosts 
They are :
vesx3.example.com
vesx1.example.com
vesx2.example.com
pesx1.example.com
pesx2.example.com

This is ‘similar’ to what you would see in PowerCLI and considerably easier than using the vSphere SDK directly.

Anyway, enjoy.

Tidbit #2

  • Over at the Citrix Community Blog they continue their discussion about using powershell to mange XenDesktop.   To me, powershell is ok, and it’s really nice to see what is a dramatic improvement in windows scripting capability but when you’ve come from a Linux platform with the wealth of scripting languages available you struggle to be super impressed.  Don’t get me wrong powershell is a fantastic step forward for windows scripting.   That being said, a lot of virtualisation vendors are putting considerable effort into adding cmdlets for powershell to manage their hypervisors.  Those toolkits often aren’t available in equivalent form for Linux so even with the superior scripting possibilities you’re lacking the high level virtualisation constructs to wrap that wonderful scripting technology around.   There’s a definite trend to manage virtual infrastructure with powershell.  Personally, i’d prefer another option.
  • Oracle transforms SGE (Sun grid Engine) from free to 90 day evaluation.  It’s pretty sad, but Oracle is far better at making money than sun was so I can understand why they’re doing it.   I’m not sure the current user base is sufficiently cashed up to make the transition and I suspect most will look around for alternatives and only pay if they can’t find one.
  • Oracle released a white paper on Architectural Strategies for Cloud Computing
  • Citrix and HP produced an interesting whitepaper on Analyzing Citrix XenServer persistent performance metrics from Round Robin Database logs – it’s important to measure and monitor performance of your virtual infrastructure, you pay enough for it, make sure it’s performing properly 🙂
  • Something of interest to me is Google have finally released their chat client for Linux.  Am I still a second class google citizen because I run Linux?
  • Veeam released a lite (read as free) version of their reporter product
  • An excellent summary of The State of Open Source System Automation by Aleksey Tsalolikbin over at linux-mag is well worth a look if you want to understand the state of play for linux automation.
  • RHEV bug RHSA-2010:0627-01 DoS or possible privilege escalation on the host.  The geek in me wants to explore this a bit more – damn you free time, where are you.
  • Another excellent whitepaper on VMware vCenter Server Performance and Best Practices for vSphere 4.1 from vmware.
  • Great howto on Installing And Using OpenVZ On Ubuntu 10.04.   Openvz creates secure Linux containers.   If you’re only running a Linux workload and thinking about virtualising it then it’s worth a closer look.  Of course libvirt can manage openvz based linux virtualisation.

Tidbit#1 -Managing other peoples stuff with your tools.

Interesting things i’ve found this week and of course my comments.