Multi-Boot Vista + ArchLinux with GRUB

Posted by John
on Thursday, 20 March 2008

After setting up my new HP laptop with Vista and ArchLinux I thought I'd post how to replicate the same setup to help anyone else wanting to do the same, so here's a guide to do this with the latest Windows Vista and Arch Linux; enjoy!

Install Windows Vista

Vista

First off install Vista. Now when it gets to asking you about how much disk space to use, say half (250gb drive => 128gb approx), this will mean the other half will be unused space (perfect for your linux build).

Install Vista and set it up, when you're happy and it's running ok continue to the next step.

Get ArchLinux

By now you should have two hard-drive partitions, one with Vista (NTFS) and one blank; now we're going to sort that second one out.

First download the relevant ISO disc image,

Download it and burn it to CD, it's only 120mb so shouldn't take too long. Once done insert it into your laptop and re-boot with it so it starts up the installer on bootup.

Install ArchLinux

ArchLinux

When the installer boots up and shows the blue install screen you'll see 6 options, let's go thru each one...

1. Prepare Hard Drive

Don't choose Auto-Prepare, it'll wipe your hardrive and destroy Vista, select Partition Hard Drives which will put you in the disk partition tool.

You should see two entries, one will be...

1. [boot] [primary] [ntfs]
2. ...... [unknown] [unknown]

The first is setup as the boot partition (the one which will boot on startup) and you know it's Vista as the filesystem is marked as NTFS, the other is unknown; our target for the Linux install.

So select the unknown one and create, mark it as a primary partition, select write to write the change and then quit to continue. Note the name of the new partition (e.g. hd0/sda2) and goto step 2.

Note: SDA = SATA, the machine i'm using has SATA drives, if you've got older IDE drives it'll be HDA0.

2. Set Filesystem Mountpoints

With this we'll want to set which partition we want to use as a swap disc, but as we didn't create one, select none.

Next you'll be asked which partition will be used as the root one for this install, select hd0/sda2 (or whichever name you wrote down in step 1). Continue to step 3.

3. Select Packages

Here we select which packages we want to install, ArchLinux is broken up into 4 separate blocks; base being the core o/s. Select all four as we'll be wanting all the tools to practice (otherwise you can choose 'base' and customise later). Step 4...

4. Install Packages

This will install ArchLinux to your target FileSystem, shouldn't take long; once done goto 5...

5. Configure System

Now configure your system, with most options choose the defaulty chosen options; afterwards your configuration will be written to the new system. Now onto the important step 6.

6. Install Bootloader

Now we'll install the bootloader to allow you to select on-bootup which O/S to start. Choose GRUB as your bootloader, you'll then be taken to the bootloader's config file.

Scroll down to the bottom of the file and uncomment the bottom entry until it resembles...

# (2) Windows Vista
title Windows Vista
rootnoverify (hd0,0)
makeactive
chainloader +1

This will add to your selection list an entry pointing to your first partition so you can select to boot Vista. Scroll up to the top of the file and check these lines, adjust as appropriately...

  • timeout 5 ...this sets the seconds to wait until booting the default entry

  • default 1 ...once the timeout expires GRUB will boot the option 1, ArchLinux, if you want to boot Vista instead, change it to 2.

  • fallback 0 ...if the default can't be booted, the fallback will be started, in this case the ArchLinux FallBack system created when we just installed ArchLinux (think of it as it's Linux's safe-mode, only much more powerful).

If you're happy with the setup, press CTRL+X to save the file and continue.

You'll next be asked where to place the Bootloader, we want to place it inside the MBR of the Drive so it will be launched when the disc spins up. The MBR is the first sector of the Hard Drive and commonly called the Master Boot Record.

You'll be presented with probably 3 options...

/SDA
/SDA1
/SDA2

Choose the first, this will be where the MBR is located.

Now you're finished, exit the Installer by selecting Exit Install, then type REBOOT to reboot.

The computer should restart and present you with the GRUB bootloader menu, where you'll now be able to select which O/S to start; job done.

Setting ROOT Password

Please note that with this initial install your ROOT account won't have a password assigned to it, posing a poblem later on down the line.

So when you've booted into ArchLinux, and typed 'root' as the username and hit ENTER to login, type...

passwd

To set the 'root' account's password.

Changing The Config

To edit the GRUB config later on, do...

nano /boot/grub/menu.lst

Settings

So as you know, the system config files are located in...

  • /etc/rc.conf (main system config)
  • /boot/grub/menu.lst (grub boot menu)
  • /etc/lilo.conf (lilo boot menu)
  • /etc/mkinitrd.conf
  • /etc/hosts
  • /etc/fstab
  • /etc/modprobe.conf
  • /etc/modules.conf
  • /etc/resolv.conf
  • /etc/conf.d/*
  • /etc/profile

Tuning Windows Vista...

Posted by John
on Friday, 26 October 2007

Well at my new job and have to say I'm lovin it, can't believe how lucky I was to land this position; team excellent, so proud!

However my new machine's running Vista so it's a little awkward getting .NET development kicking on it smoothly from XP. So here's some pointers to get fellow ASP.NET developers up & running...

Setting up IIS

IIS comes with Vista Business edition, but to enable it, do...

  • Goto Control Panel then Programs & Features
  • Click Turn Windows Features on or off
  • Wait...
  • Tick Internet Information Services
  • Click *OK*... done.

Startup Items

To change what programs are launched at startup, do...

  • Click the Start button on the Vista Taskbar
  • In the Start Search box type System Configuration
  • Vista should do live search and have the System Configuration program at the top of the list
  • Click it.

Once it has opened up, click the Startup tab to configure what things run on machine start-up.

Things you don't need

  • Windows Defender that can be replaced by a lower memory-footprint app called Spybot Search & Destroy. So untick that to stop it hogging resources and install S&D (note: when installing S&D make sure you say yes about installing it's resident checkers, good tools).

  • MsnMsgr (aka. msn messenger) you can also untick, if you don't ever use it, Skype is so much better.

  • AcroTray (adobe acrobat distiller helper), untick if you hardly ever use it.

  • Office Startup Helper (not sure about the name of this one but know ms office comes with one), not needed if you hardly ever use office in your day-to-day life.

Disabling UAE

Although dangerous as it allows the usual user to run As Adminstrator (a thing which all this security was introduced to prevent as running as admin was allowed in xp, etc, and incurred user's installing bogus viral programs), you can disable it.

To disable this, if you really really want to,

  • Click the Vista Start button
  • Type Local Security Policy in the Search box and click when the app appears
  • When asked to allow it to open, say yes
  • Select Security Settings \ Local Policy \ Security Options
  • Scroll down the list until you get to the ones called User Account Control

From here you can set the kind of behaviour Vista will perform based on certain user actions (e.g. install software, browse network, etc.)

IronRuby (aka Ruby for .NET)

Posted by John
on Tuesday, 02 October 2007

With all the talk about this hot new language it seems only right that Microsoft has moved their focus over to the opensource arena with the impending release of IronRuby.

What this is in a nutshell is a plugin to Visual Studio 2005 that allows users to develop Ruby Apps within the VS.NET Dynamic Language Runtime.

They did this a while back with the release of IronPython (Python on .NET), but this is one developer who really hopes the impending Orcas release of Visual Studio has this beauty firmly tied in.

Fingers crossed,

C# Crib Sheet

Posted by John
on Sunday, 05 August 2007

string b = @"hello
p. stuff"

@ means string must be displayed like written, on two lines


Arithmetic Overflow

checked(b2)
p. unchecked(b2)

checked = means expression ‘b2’ value does not exceed type


b2?

+++b2 b2+++

>= <= == != ++

end lines with ;


if (b2 == b3)

{ code }

else if (b2 > b3)

{ code }


switch(x) {

case 1:

——;

break;

default:

——;

break;

}


while (b2 = 2) { b2++; }


do i++ while (i<5);


for (int i=0l i<0 i++) { }


foreach (Stick stick in dynamite) { stick++; }


return b2;

return = return value / object to calling code;


namespace mycompany.myproduct.drawing { }

namespace = enables you to group related types into a hierarchical categorization


inheritance

class URL : Location { // }

: <= allows URL to inherit the methods of the Location class


polymorphism = ability to perform same operation on many types

virtual function members = each type can implement a shared characteristic in it’s own way. implements shared characteristic / method in it’s own way


abstract class = shell of a class, no implementation, cannot use directly, have inherit / build upon

abstract class Location { public abstract void Launch(); }

class URL : Location { public override void Launch() {} }

override = override inherited classes methods, in this example i’m using an abstract class as a sort of template for something new


public new void Foo() {}

new = hides method from outside class


public = type / members fully accessible

internal = type / members accessible only from within

private = type / member accessible only from within

protected = cannot modify, class available within class


difference between classes & structs ?

class = fully supports inheritance, reference types, can have destructor, can have custom parameterless constructor

struct = simple, value types, can have constructor


instance = (default), associated with an instance of a type

static = associated with a type itself

public static void Me() { }


public const double PI = 3.141

const = constant, always uppercase


ref = pass by reference, change value of variable given permanently

static void Foo(ref int p) { ++p; }


params = allows method to accept any number of parameters

static int Add(params int[] iarr) { foreach (int i in iarr) {…} }


constructor = specify how new instances of a class get created, what variables get initialised with, etc.

class wow { public wow() : this(5) {}

make method same name as class to do this, here we’re self-referencing the class using the ‘this’ keyword, returning 5 to the calling class

static constructors = can define only one static constructor


destructor = specify how instances of a class get destroyed, connections get closed, etc.

class wow { ~wow() { console.writeline(“boom”); } }

~ defines a destructor, plus make it the same name as the class, here writing ‘boom’ to the console when the class is destroyed


this = self-referencing, denotes a variable that is a reference to a instance, allows members to reference own class

public dude(string name) { this.name = name; }
p. public void hi(dude a) { if a!=this) {..} }

a common use of ‘this’ is to unambiguate a field name from a parameter name.

e.g. = self-reference the current class instance

JAVA

  1. class Numbers {
  2. private int aNumber = 42;
  3. public int returnANumber()
  4. {
  5. return this.aNumber;
  6. }
  7. public int returnANumber(int intIn)
  8. {
  9. return (intIn * this.returnANumber());
  10. }
    #
  11. public static void main(String[] args) {
    #
  12. Numbers numberTest = new Numbers();
  13. System.out.println("The Number is " +
  14. numberTest.returnANumber() );
  15. //output is: The Number is 42
  16. System.out.println("The Number is " +
  17. numberTest.returnANumber(2) );
  18. //output is: The Number is 84
  19. }
  20. }

see how the above example works, a variable is defined inside the class, a method is defined for when no parameters are given assigning it 42. when parameters are given it runs a different method multiplying 42 with the number given. however it’s referencing (can modify directly & permanetly) the value inside it’s own class.

also in JAVA,
p. super.getName(a); = use super. to call methods in the parent class


base = similar to ‘this’, except that it accesses overridden or hidden base-class function members

basically allows you to call the original function of a class before it got replaced by one with the same name / overridden

base.Introduce(p);


interfaces = like a pure abstract class, but provides a spec rather than implementation of it’s members

public interface Me { void Delete(); }

here no code is written, just a function is defined, which when inherited by another class (using : ) can then be coded.

basically a template class, an empty shell


arrays

char[] vowels = new char[] (‘a’, ‘e’);
p. console.writeline(vowels[ 2 ]);

multidimensional arrays

int [][][] matrix = new int 3[][];
p. matrix[x][y][z] = new int 5;

= vowels.Length;
= matrix.GetLength(2)


enums = specify a group of named numeric constants


events

get { return pos; }
set { r = 44; }


try { }
p. catch { }

finally { }

basically you try something risky, you catch any error codes and then you finally clear up your mess


ArrayList = dynamically sized array of objects that implement the IList interface

HashTable = standard dictionary layout (key/value)


StringBuilder class

can grow unbound or upto a pre-defined maximum, much better than just concatenating a string.

it starts at a pre-defined size and grows dynamically as more string data is added.

StringBuilder sb = new StringBuilder(‘hello ’);

sb.Append(’world’);

sb12 = ‘!’;

console.writeline(sb); // hello world


// = comments

Subversion or SourceSafe ?

Posted by John
on Saturday, 04 August 2007

In the avenue of Software Version Control and Agile Technologies there are two competing technologies, open-source Subversion SVN and Microsoft SourceSafe 2005 (now Team System).

But which is which and what benefits does each offer?

Subversion

Subversion in it’s essence is open-source so is perfectly suited for LAMP (Linux, Apache, MySQL, PHP) projects. It is uniquely flexible and simple to apply to any medium type or operating system, with easy integration to Windows via the TortoiseSVN software add-on.

It allows you to import, commit, export and differentiate successive code releases down to their line numbers really easily.

Also being in the public domain, the source-code is frequently updated and bugs fixed rapidly due to the larger exposure of it’s code-base.

Microsoft SourceSafe

Very similar to Subversion, it has been designed as a source-code cataloging and version control tool primarily for .NET / Visual Studio projects; and thus it’s flexibility ends there. It does however allow you to set aside a server as your primary project Source center and drill down to key changes in code, much like SVN.

People however have complained about a long-running database corruption issue within but this should be fixed.

So Which ?

Well the tight integration into the VS.NET IDE environment is a definite plus and on top of this SourceSafe gives you a database and Vault repository in which it keeps track of code changes; however the O/S inflexibility and more importantly the new VS.NET Team System pricing does put it out of scope for small businesses and independent startups.

It really is like my dad says ‘horses for courses’, SS maybe good in a Microsoft-Only environment, but SVN maybe better for independent startups and projects where flexibility and O/S independence are vital.

Really down to you, I know this isn’t that detailed a guide but should give you some idea as to which to choose.

What do I use ?

In reality I employ both,

For my Ruby on Rails projects I use a mixture of Capistrano, Deprec capped to a SubVersion repository on the Linux server. Works well as my development machine for that is an Apple Mac.

Workwise, I employ Subversion + TortoiseSVN to keep catalogued and protected all my web script files and xhtml micro-sites, with the repositories kept on a protected remote server.

However all my VS.NET applications are kept under SourceSafe control, hooked up to a remote server in another office; used by other developers.

Works quite well, the quick-install nature of SVN would allow me to get up-to-speed from a stolen laptop really fast (if another machine existed on standby). VS.NET would take longer but then that comes with the territory, but could be faster if you had a disk-image on standby with a carbon-copy of your development system setup.

Your choice.

John.